Three real 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. 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 streaming surface is a small contract that does a lot of work, and getting it wrong is one of the most visible failure modes in a chat UI. Pick the wrong mode and either the UI freezes (no tokens reaching the user) or it floods with state-delta churn that has no useful UI binding.
The MCQ is checking that you can name the three real modes, messages, updates, values, and reject the plausible-sounding fake ones (tokens, nodes, stream=True). The senior tell is articulating the multi-mode list pattern and the bandwidth vs completeness tradeoff between updates and values.
Mental model: 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. Heavier than updates because unchanged fields are re-shipped, 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.
- Replit's coding agent streams messages for the editor diff preview and updates for the 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 real 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.