LangGraph/Control Flow
Intermediate9 min

Streaming v2

Unified StreamPart protocol, type-safe output modes, and real-time token streaming.

Quick Reference

  • version='v2' streaming: unified StreamPart objects with .event and .data fields
  • stream_mode='values': emits full state after each super-step
  • stream_mode='updates': emits only the delta (changed keys) from each node
  • stream_mode='messages': emits individual LLM tokens for real-time UI streaming
  • Multiple modes: stream_mode=['updates', 'messages'] to get both in one stream

The v2 Streaming Protocol

GraphExecutionvalues— full state snapshotsstate_v1state_v2state_v3updates— delta patchesdelta_1delta_2delta_3delta_4messages— individual tokenst1t2t3t4t5t6t7t8slowermediumfastest

Three stream modes: values (snapshots), updates (deltas), messages (tokens)

v2 streaming is the standard

version='v2' returns typed StreamPart objects with .event and .data fields. Each part is self-describing -- you know what kind of event it is (values, updates, messages, custom, debug) without guessing. v1 returned raw tuples and dicts; v2 is structured, typed, and extensible.

Basic v2 streaming loop