Event streaming requires
langgraph-api>=0.10.0 on the LangGraph Agent Server. Managed LangSmith deployments are updated automatically; self-hosted servers must be on a compatible version. The client SDK must be langgraph-sdk>=0.4.0 with langchain-core>=1.4.0 (Python) or @langchain/langgraph-sdk>=1.9.15 (JavaScript). Servers on earlier versions continue to serve the streaming API.Quickstart
- Python
- JavaScript
- cURL
transport="websocket" to client.threads.stream(...).
What event streaming provides
The stream returned byclient.threads.stream(...) exposes typed projections over one underlying event flow:
| Projection | Use |
|---|---|
thread.events | Iterate every raw protocol event (Python). In JavaScript, open thread.subscribe(...). |
thread.messages | Stream chat model messages, token deltas, reasoning, and tool-call argument chunks. |
thread.values | Iterate state snapshots and await the final value. |
thread.output | Await the final output. |
thread.tool_calls (thread.toolCalls in JavaScript) | Observe tool invocations with assembled input, streamed output, and result. |
thread.subgraphs | Discover and observe nested graph executions. |
thread.subagents | Subagent-oriented view of thread.subgraphs. Use this name when working with Deep Agents subagent invocations. |
thread.interrupts | Inspect human-in-the-loop interrupt payloads. |
thread.interrupted | Check whether the run paused for human input. |
thread.extensions | Consume custom stream transformer projections published on custom:<name> channels. |
thread.messages does not consume events needed by thread.values, thread.toolCalls, thread.subgraphs, or thread.output.
Stream messages
Usethread.messages for chat model output:
- Python
- JavaScript
- cURL
message.text is both an async iterable and an awaitable. Iterate it for token-by-token output, or await it for the complete text. message.reasoning exposes reasoning deltas and message.tool_calls (message.toolCalls in JavaScript) exposes tool-call argument chunks. Await message.output for the finalized message, including its usage_metadata. To consume text, reasoning, and tool-call chunks in exact arrival order, iterate the raw event stream instead of each projection separately.
Stream state
Usethread.values to stream full state snapshots after each step:
- Python
- JavaScript
- cURL
thread.values is also awaitable. Awaiting thread.values resolves to the final state, equivalent to await thread.output.
Stream tool calls
thread.tool_calls (thread.toolCalls in JavaScript) exposes assembled tool invocations. Each handle carries the tool name (call.name) and the assembled input (call.input, a plain value—not awaited). Await call.output for the tool result once the call finishes:
- Python
- JavaScript
- cURL
call.deltas is an async iterator over the tool’s output as it streams, and call.error holds the exception if the tool raised. Tool events are correlated by tool call ID with the corresponding tool-call content blocks on thread.messages.
Stream subgraphs
Usethread.subgraphs to observe nested graph work without parsing namespace strings:
- Python
- JavaScript
- cURL
subgraph.graph_name in Python, subgraph.name in JavaScript) and its namespace path (subgraph.path in Python, subgraph.namespace in JavaScript), plus per-subgraph messages, tool_calls, and nested subgraphs projections.
For Deep Agents deployments, prefer thread.subagents for subagent invocations—it exposes the subagent name and per-subagent message and tool-call projections.
Stream output
Awaitthread.output for the final state once the run completes:
- Python
- JavaScript
- cURL
thread.output shares its subscription with thread.values, so awaiting one does not require an extra round trip when the other is also being read.
Stream multiple projections
Run concurrent consumers when application code needs more than one projection at a time:- Python
- JavaScript
- cURL
Resume after an interrupt
When a graph pauses for human input, inspectthread.interrupted and thread.interrupts, then resume by responding to the interrupt:
- Python
- JavaScript
- cURL
Join an active run
To attach to a run already in flight on a thread—after a page reload, in a separate worker, or from another client—open the thread stream with the existingthread_id and skip thread.run.start(). The deployment replays buffered events when the connection opens, so consumers reconstruct the run state from the beginning without missing any output.
- Python
- JavaScript
- cURL
Stream all protocol events
Read the raw protocol event flow when application code needs every event. In Python, iteratethread.events; in JavaScript, open a subscribe (the JavaScript stream object is not itself iterable):
- Python
- JavaScript
- cURL
subscribe on the thread:ProtocolEvent envelope wrapping a channel-specific payload:
- Python
- JavaScript
- cURL
namespace is a path from the root graph to the scope that emitted the event. The root is the empty array. Each child execution adds one "name:runtime_id" segment, so a nested tool call inside a subgraph looks like ["researcher:6f4d", "tools:91ac"]. Filter raw events by namespace directly when only a specific subtree matters; thread.subgraphs already does this for nested graph executions.
Channels and event lifecycle
Raw events flow on channels. The channel name appears as the event’smethod; each channel emits a specific event shape.
| Channel | Purpose |
|---|---|
values | Full graph state snapshots. |
updates | Per-node state deltas. |
messages | Content-block-centric chat model output. |
tools | Tool call start, streamed output, finish, and error events. |
lifecycle | Run, subgraph, and subagent status changes. |
checkpoints | Lightweight checkpoint envelopes for branching and time travel. |
input | Human-in-the-loop input requests and responses. |
tasks | Pregel task creation and result events. |
custom | User-defined payloads from graph code. |
custom:<name> | Application-defined stream transformer output. |
thread.messages, thread.values, thread.toolCalls, etc.) are built from these channels. The channel name appears as the method field on raw events when iterating the stream object directly.
Messages
Themessages channel models output as content blocks. The data.event field is one of message-start, content-block-start, content-block-delta, content-block-finish, message-finish, or error. Content blocks have explicit boundaries: a block starts, emits zero or more deltas, and finishes before the next block in the same message starts. message-finish may include token usage; unrecoverable model-call failures arrive as message error events.
Tools
Thetools channel exposes tool execution. The data.event field is one of tool-started, tool-output-delta, tool-finished, tool-error. Tool events are correlated by tool call ID, so a tool execution can be joined back to its originating tool-call content block on the messages channel.
Lifecycle
Thelifecycle channel tracks root run, subgraph, and subagent status. The data.event field is one of started, running, completed, failed, interrupted. The root run resolves to a terminal completed, failed, or interrupted; child scopes may also report running. Lifecycle data may include an optional graph_name, error, and cause describing why a child scope started (parent tool call, fan-out send, edge transition).
Resume from last event
Event streams are resumable. The Agent Server buffers events per run in a bounded buffer, assigns each aseq (per-session ordering) and a durable event_id (stable across replays and replicas), and replays from a cursor on reconnect. The SDK handles transient drops automatically: each open subscription tracks its highest observed seq, and on reconnect the SDK replays from that cursor and dedupes resent events by event_id.
To resume across a process boundary—a page reload, a worker handoff, or a separate client—reopen the thread with the same thread_id. The server replays buffered events when a new subscription opens, and the SDK demultiplexes them into the same typed projections. Because the per-run buffer is bounded, the earliest events of a very long run may have been evicted.
- Python
- JavaScript
- cURL
Related
- Streaming API — the
stream_mode-based streaming API. Also supported bylanggraph-api>=0.10.0. - LangGraph event streaming — the same concepts applied to an in-process LangGraph application.
- LangChain agent event streaming — agent-focused projections for messages, tool calls, and middleware updates.
- Deep Agents event streaming — subagent streams, nested messages, and subagent tool calls.
- LangSmith Deployment API — wire-level reference for
POST /threads/{thread_id}/stream/eventsand related endpoints.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

