Course Content
LangGraph Agents
7 sections · 49 lessons
How does message passing relate to how nodes update shared state?
What you need to know
- Plan — decide which nodes run in this super-step, from the edges of the nodes that just finished.
- Execute — run them, in parallel if several; each sees the same state snapshot.
- Update — apply all returned updates through each key's reducer.
- Checkpoint — save the new state and what runs next.
- Repeat — until no node is scheduled, or an interrupt.
Consequences
- Order is data flow. If
BneedsA's output, draw an edgeA → B. Two nodes in the same step cannot see each other's results. messagesis not special. It is a channel withadd_messages. You can have other message-like channels, such as a privatescratchpadfor one agent.- Private channels. A node can have its own
input_schema, and graphs can hold keys that only some nodes read, which keeps agents from seeing each other's scratch work. Sendis the exception.Send("node", payload)starts a node with a custom input instead of the shared state — still delivered by the runtime, not by a direct call.
A real-life example
In an insurance claim graph, check_documents and fraud_score run in parallel after intake. A developer made fraud_score read state["documents_ok"], which check_documents writes. In tests it always saw the old value None, because both ran in the same super-step. The fix was not a sleep or a lock: an edge check_documents → fraud_score, or a join node that runs after both. Thinking "channels and rounds" instead of "function calls" makes this bug obvious.
Follow-up questions to expect
- "Is this like an actor model?" — No. Actors have mailboxes and call each other at any time. LangGraph runs in synchronised rounds over shared, versioned state.
- "How do agents talk in a multi-agent graph?" — Through state keys (a shared
messageslist or structured artifacts) andCommand(goto=...)handoffs; there is still no direct call. - "Can you watch the messages between nodes?" — Stream with
stream_mode="updates": each event is the update one node wrote.