Three main modes: messages for LLM tokens, updates for per-node state deltas, values for the full state after each node. There is no tokens or nodes mode.
Picture a relay race where each runner writes a note on a clipboard between laps. With messages you watch each runner whispering syllables as they run, the play by play. With updates you only see what each runner added to the clipboard when they handed it off, a tidy diff per leg. With values you photograph the whole clipboard after each runner finishes, complete but heavy. These are three views of the same race, picked by what your UI needs to show.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
LangGraph's stream_mode argument decides what a streaming client receives. A wrong choice is one of the most visible failures in a chat UI. Pick the wrong mode and either the UI freezes (no tokens reach the user) or it fills with state deltas the UI has no use for.
Three modes cover most UI needs: messages, updates and values. The names tokens and nodes sound plausible but do not exist, and stream=True does not pick a mode. The other modes (custom, checkpoints, tasks, debug) carry custom progress data, persistence events and debug detail.
The LLM emits tokens (
messages), the graph emits per-node deltas (updates), and the graph snapshots full state (values). Three granularities, three modes.
Three modes, three granularities
messages. Per-token granularity
stream_mode='messages' emits AIMessageChunk and ToolCallChunk events as the LLM (or tool) inside any node produces them. Each chunk carries a small token-delta payload plus metadata identifying which node emitted it.
This is the right mode for any UI that shows typewriter-style output to the user. It is also how you get tool-call previews mid-flight: the AI SDK or your custom frontend can show 'the model is calling search(query=...)' before the tool returns.
updates. Per-node delta
stream_mode='updates' emits one event per node, shaped as {node_name: state_delta} where state_delta is exactly what the node's function returned. The event is lightweight (only the fields the node changed) and structured (keyed by node name).
Use it for status bars, per-stage progress indicators, and any UI that cares about 'a node finished' rather than 'a token arrived.'
values. Per-node full state
stream_mode='values' emits the FULL state object after each node runs. Every event is a complete snapshot. It is heavier than updates because unchanged fields are re-shipped. It is useful when the client does not maintain its own state copy, or when you want each event to be self-contained for replay or debugging.
Picking by UI
| UI need | Mode |
|---|---|
| Typewriter chat output | messages |
| Status pill (planner ran, tool running) | updates |
| Debug console showing full state per step | values |
| Chat plus status combined | ['messages', 'updates'] |
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- LangGraph chat templates wire stream_mode messages to the chat surface and stream_mode updates to a status pill in the same UI.
- A coding-agent UI can stream messages for the editor diff preview and updates for a build progress timeline.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you wire both messages and updates to a single chat UI?
Call stream with stream_mode=['messages', 'updates']. Each event arrives tagged by mode. Route messages events to the typewriter renderer. Route updates events to the status pill or progress bar. Use SSE or WebSocket with explicit event types so the frontend can dispatch on tag without parsing the payload first.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Picking 'tokens' or 'nodes' as a mode name. They sound right but do not exist. The real names are messages and updates.
60 second bullets to scan on the way to the call.
The three main stream_mode names and what each emits
Why messages mode is the typewriter-output choice
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.