Skip to content

Command

A node returns Command when it must update state and choose the next node in one decision. Command(resume=...) is also the input used to resume an interrupt.1

from typing import Literal
from langgraph.types import Command
def decide(state: RefundState) -> Command[Literal["approve", "review"]]:
next_node = "approve" if state["eligible"] else "review"
return Command(
update={"decision_recorded": True},
goto=next_node,
)
Field Meaning
update State changes from this node
goto Next node or nodes
resume Value returned by a paused interrupt()
graph=Command.PARENT Route from a subgraph to its parent

Do not combine goto with a normal outgoing edge unless both destinations should execute. Command(resume=...) is input for a paused graph; normal new input should remain a plain state dictionary.

  1. LangChain, Graph API overview — Command.