
Execution Order
How LangGraph decides what runs next.
Execution Order
LangGraph execution is Sequential by Default, Parallel when Possible.
The Superstep Concept
LangGraph runs in "Supersteps".
graph TD
Step1[Superstep 1: Entry] --> Step2{Superstep 2: Fan-Out}
Step2 --> NodeA[Node A]
Step2 --> NodeB[Node B]
Step2 --> NodeC[Node C]
NodeA --> Sync[Superstep 3: Sync & Merge]
NodeB --> Sync
NodeC --> Sync
- Superstep 1: Run the Entry Node.
- Superstep 2: Look at all valid next nodes.
- If there is 1 next node -> Run it.
- If there are 3 next nodes (Fan-Out) -> Run all 3 in parallel.
- Superstep 3: Wait for all parallel nodes to finish. Merge their updates. Find next nodes.
Determinism in Parallelism
If two parallel nodes try to write to the same state key, Execution Order matters. Best Practice: Parallel nodes should write to different state keys, or use a Reducer.