Build your graph
Work through these decisions in order. Each step includes a short example and links to the how-to for full recipes.1
Define shared state
Decide what data nodes share and how updates merge.Here
- Pick a schema (
TypedDict, dataclass, orStateSchemain TypeScript). - Add a reducer for any key that multiple nodes write (for example, appending messages).
- Use private or input/output schemas when the graph should hide internal channels from callers.
foo overwrites. bar concatenates.For schemas, reducers, messages, and private state, see Define and update state.2
Choose control flow
Decide how work moves between nodes.For branches, parallel paths, and loops, see Build sequences, branches, and loops.
- Sequence: Fixed steps in order.
- Branch: Conditional edges pick the next node from state.
- Parallel: Fan-out to several nodes, then fan-in (often with reducers).
- Loop: Cycle until a termination condition, or cap runs with a recursion limit.
3
Decide if you need Send or Command
Most graphs only need nodes, edges, and conditional edges. Keep routing in edges unless you hit one of the cases below. For patterns and examples, see Use Send and Command.Reach for the extras when the default model is not enough:
- Use
Sendwhen you must run the same node once per item, each with its own input, and the item count is only known at runtime (map-reduce / orchestrator-worker). - Use
Commandwhen one step must both update state and choose the next node, resume after an interrupt, or update state from a tool.
4
Configure nodes as needed
Add runtime options when reliability or cost matters:See Configure nodes.
- Retries and timeouts for flaky or slow steps
- Error handlers and graph-wide node defaults
- Caching for expensive repeated work
- Runtime context or config for dependencies that do not belong in state
5
Visualize the graph
Next steps
- Thinking in the Graph API: Design walkthrough with the email agent
- Graph API overview: Concepts for state, nodes, edges,
Send, andCommand - Define and update state
- Build sequences, branches, and loops
- Use Send and Command
- Configure nodes
- Visualize your graph
- LangGraph quickstart: End-to-end calculator agent
Connect these docs to your agent of choice via MCP for real-time answers.

