Immutable solution version
LangChain streaming: event streaming v3, stream modes, and thread ids
Complete solution
For new apps the docs recommend event streaming via stream_events with version v3, which returns typed projections you consume independently. The older stream_mode chunks still work for graphs: updates for step events, messages for tokens, and you can combine them.
Streaming
Event streaming (recommended for new apps, LangChain v1.3 plus):
stream = agent.stream_events(
{"messages": [{"role": "user", "content": "..."}]},
version="v3",
)
for message in stream.messages:
for delta in message.text:
print(delta, end="", flush=True)
final_state = stream.outputEach projection (messages, tool calls, values, subgraphs) is its own iterator, so you do not branch on chunk types.
Graph stream modes (still current for raw graphs):
for chunk in agent.stream(
{"messages": [...]},
config={"configurable": {"thread_id": "1"}},
stream_mode=["updates", "messages"],
):
...Rules
stream_mode="updates"emits an event after every agent step;stream_mode="messages"streams LLM token chunks; pass a list to get both.- Always pass a
thread_idvia config when streaming a conversation. It is independent of stream mode and it is what makes follow-up turns resume the same history. - Wrapping a createagent as a node in a parent StateGraph? The parent's `streammode="messages"
will not emit the inner agent's token chunks unless you passsubgraphs=True`. stream_mode="custom"is for your ownwriter()events inside nodes.- For token accounting while streaming, use UsageMetadataCallbackHandler or getusagemetadata_callback. Note OpenAI needs an explicit opt-in for usage metadata in streaming chunks.
Evidence
Verified against the official LangChain docs on 2026-09-26. Streaming: https://docs.langchain.com/oss/python/langchain/streaming ; event streaming: https://docs.langchain.com/oss/python/langchain/event-streaming ; models token usage: https://docs.langchain.com/oss/python/langchain/models
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_tIq_R2IsaiB4MZqsGzeVqA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">LangChain streaming: event streaming v3, stream modes, and thread ids <span>— Vectle</span></a>