Overview
LangGraph supports multiple streaming modes to provide real-time feedback, build responsive UIs, and monitor graph execution. Instead of waiting for the entire graph to complete, you can process results as they become available.Stream Modes
LangGraph offers 7 different streaming modes, each serving different use cases:Mode Overview
values
Complete state after each step
updates
Individual node outputs
messages
LLM token streaming
custom
User-defined events
checkpoints
State snapshots
tasks
Task execution events
debug
Debugging information
Values Mode
Emits the complete state after each step:- Display complete state in UI
- Monitor full state changes
- Simple progress tracking
values is the default stream mode. It includes the initial state before any nodes execute.Updates Mode
Emits individual node outputs as they complete:- Key: Node name
- Value: Node’s output (state update)
- Track which nodes executed
- Show per-node progress
- Collect individual results
Parallel Node Updates
Messages Mode
Stream LLM tokens in real-time:Message Metadata
- Real-time chat interfaces
- Streaming chatbots
- Progressive text generation
Custom Mode
Emit custom events from within nodes:StreamWriter is automatically injected when requested as a parameter. It’s a no-op when not using stream_mode="custom".- Fine-grained progress tracking
- Custom metrics/telemetry
- Application-specific events
Checkpoints Mode
Emits state snapshots when checkpoints are created:values: Current statenext: Upcoming nodesconfig: Runtime configurationmetadata: Step info, sourcecreated_at: Timestamptasks: Pending tasks
- Monitor checkpointing
- Display execution timeline
- Debug state persistence
Tasks Mode
Emits events for task lifecycle:task: Task startedtask_result: Task completed (with result or error)
- Monitor task execution
- Track task duration
- Debug failures
Debug Mode
Combinescheckpoints and tasks for comprehensive debugging:
- Development debugging
- Troubleshooting execution
- Performance analysis
Multiple Stream Modes
Combine modes for richer output:Async Streaming
All streaming modes support async iteration:- Async I/O operations
- Concurrent event processing
- WebSocket connections
- Server-sent events (SSE)
Streaming with Subgraphs
Control subgraph streaming:Building a Streaming UI
Real-Time Chat Interface
Progress Bar with Custom Events
FastAPI SSE Endpoint
Stream Configuration
Early Emission
Force eager event emission:stream_eager=True reduces latency.
Filtering Stream Channels
Limit which state keys are streamed:Best Practices
Choosing Stream Modes
Choosing Stream Modes
- Use
valuesfor state monitoring and simple UIs - Use
updatesto track individual node execution - Use
messagesfor chat interfaces with LLMs - Use
customfor application-specific events - Use
debugduring development - Combine modes when you need multiple perspectives
Performance
Performance
- Use async streaming for I/O-bound applications
- Enable
stream_eagerfor lower latency - Limit state size to reduce serialization overhead
- Filter stream channels to reduce bandwidth
- Batch custom events when possible
UI Integration
UI Integration
- Buffer tokens before displaying (avoid flickering)
- Show loading indicators between node executions
- Handle reconnection for long-running streams
- Display node names from
updatesmode - Use custom events for progress bars
Troubleshooting
No events emitted
No events emitted
- Verify correct stream mode
- Check if graph has any nodes
- Ensure nodes return state updates
- For
messagesmode, confirm LLM is used - For
custommode, verifyStreamWritercalls
Delayed events
Delayed events
- Enable
stream_eager=True - Check for buffering in transport layer
- Verify async streaming is used correctly
- Review node execution time
Missing tokens in messages mode
Missing tokens in messages mode
- Ensure LLM supports streaming
- Check that LLM is configured for streaming
- Verify message format is correct
- Review LangChain callback configuration
Next Steps
Human-in-the-Loop
Combine streaming with interrupts for human oversight
Checkpointing
Use checkpoint streaming for state monitoring