Send runs the same node once per item with a custom input when the item count is known only at runtime (map-reduce). Command updates state and chooses the next node in one return. For ordinary sequences, branches, and loops, see Control flow. For concepts, see Send and Command on the Graph API overview.
Use Send for map-reduce
Return one or moreSend objects from a conditional edge. Each Send names a target node and passes that invocation’s input. LangGraph runs those invocations in parallel. When workers write the same state key, use a reducer so updates merge (for example, concatenating lists).
The worker below does not receive the full graph state. Send passes { "subject": ... } as that run’s input, so the worker schema includes subject even though the overall state does not.
Send fan-out: one generate_joke invocation per subject.
Stream node updates (this example has no chat model, so there are no message tokens to iterate):
Combine control flow and state updates with Command
Return a Command from a node when that step must both update state and choose what runs next. For routing alone, prefer conditional edges. Shape of aCommand return (full graph below):
Command, so the graph has no conditional edges between A, B, and C.
StateGraph. Control flow lives in nodeA, so there are no conditional edges between A, B, and C.
Command routes from nodeA. Repeated invokes take different paths (A → B or A → C) based on the random choice in node A.
Navigate to a node in a parent graph
From a node inside a subgraph, route to a node in the parent graph withgraph=Command.PARENT:
Use inside tools
ReturnCommand(update=...) from a tool to write graph state (for example, customer lookup results) during a turn. The fragment below assumes get_user_info / getUserInfo and a message history key named messages. Complete the imports and helpers in your app.
Command, prefer the prebuilt ToolNode, which propagates those objects into graph state. In a custom tool-calling node, propagate Command returns from tools yourself.
Resume after an interrupt
UseCommand as input to invoke / stream only to resume after an interrupt (resume=..., optionally with update while resuming). Do not pass Command(update=...) alone to continue a conversation: any Command as input resumes from the latest checkpoint, not from START. Pass a plain state update to start a new turn.
For the full anti-pattern example, see Input to invoke or stream. For interrupt patterns, see Interrupts.
See also
- Send and Command on the Graph API overview
- Interrupts
- Control flow
- Use subgraphs
- Configure nodes
Connect these docs to your agent of choice via MCP for real-time answers.

