Intermediate10 min
Nodes
Nodes as functions, async nodes, tool nodes, and the Command API for routing from inside a node.
Quick Reference
- →Function nodes: any (state) -> partial_state function added via graph.add_node()
- →Async nodes: use async def for I/O-bound work — LangGraph runs them with asyncio
- →ToolNode: a pre-built node that executes tool calls from the model's response
- →Command API: return Command(goto='node_name') to route from inside a node
- →Nodes return partial state — only the keys that changed, merged via reducers
Function Nodes
START → Agent → Tools → Agent (loop) → END
The basic node signature
A node is any function that takes state and returns a partial state update. LangGraph merges the returned dict into the full state using reducers.
Partial updates only
Return only the keys you changed. The rest of the state is preserved automatically.