Zenaique

Pick the right LangGraph stream_mode for showing tokens vs node updates

MCQ·Medium·4.0 · 0·~1 min·Asked atLocusMoveworksSnap
Attempt it
TL;DR

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.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

Key concepts

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 needMode
Typewriter chat outputmessages
Status pill (planner ran, tool running)updates
Debug console showing full state per stepvalues
Chat plus status combined['messages', 'updates']
Why the distractors are wrong
The multi-mode pattern and operational notes
Putting it together in 2026 production
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

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.
Sign in to see more production examples.

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?
A

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.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Picking 'tokens' or 'nodes' as a mode name. They sound right but do not exist; the real names are messages and updates.

Sign in to see all red flags and common mistakes.

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

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Design a sensible migration…
Short answer·Hard