Uneven LangGraph.js Branches Cause a Join Node to Run Twice, and Super-Steps Explain Why

A LangGraph.js graph in which one branch takes more steps than another can run its shared join node, combine, twice. The LangGraph.js docs say a node runs once per super-step in which any incoming branch completes, so branches of different lengths produce separate runs. LangGraph.js executes nodes in discrete rounds called super-steps, and a node activates when it receives input on an incoming edge. A plain edge compiles to a trigger channel that wakes its target, so two edges into one node each wake it independently. Equal-length branches deliver their writes in the same round and the node runs once, while an uneven branch delivers in a later round and wakes the node again. The article includes a sample ESM TypeScript project using StateSchema and Zod that demonstrates the behavior without requiring an API key.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in