Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
One change · claude-code

Stream responses in real-time changed

agent-sdk/streaming-output

Nearest release: v2.1.267, published an hour before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+8added
Lines−4removed
From line 2 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits3to this page, all time

The whole hunk

from line 2, old and new numbered
/
lines
from line 2
22 
33> Get real-time responses from the Agent SDK as text and tool calls stream in
44 
5By default, the Agent SDK yields complete `AssistantMessage` objects after Claude finishes generating each response. To receive incremental updates as text and tool calls are generated, enable partial message streaming.
5By default, the Agent SDK yields a complete `AssistantMessage` for each non-empty content block, such as a text block or a tool call, after Claude finishes generating that block. To receive incremental updates as text and tool calls are generated, enable partial message streaming.
66 
77<Tip>
88 This page covers output streaming (receiving tokens in real-time). For input modes (how you send messages), see [Send messages to agents](/docs/en/agent-sdk/streaming-vs-single-mode). You can also [stream responses using the Agent SDK via the CLI](/docs/en/headless).
from line 94
9494 uuid: UUID;
9595 session_id: string;
9696 ttft_ms?: number; // Time to first token in ms, present only on message_start events
97 user_message_uuid?: string;
9798 };
9899 ```
99100</CodeGroup>
from line 101
100101 
101102The `parent_tool_use_id` field is always `None` in Python and `null` in TypeScript. Stream events are emitted for the main session only; token-level deltas from subagents aren't forwarded. To attribute output to a subagent, use complete messages, which carry `parent_tool_use_id`. See [Detect subagent invocation](/docs/en/agent-sdk/subagents#detect-subagent-invocation).
102103 
104Claude Code sets `user_message_uuid` on the turn's first non-ping stream event, and again when the message the turn is answering changes, under the conditions in [`user_message_uuid`](/docs/en/agent-sdk/typescript#user_message_uuid). The Python `StreamEvent` doesn't expose this field.
105 
103106The `event` field contains the raw streaming event from the [Claude API](https://platform.claude.com/docs/en/build-with-claude/streaming#event-types). Common event types include:
104107 
105108| Event Type | Description |
from line 116
113116 
114117## Message flow
115118 
116With partial messages enabled, you receive messages in this order:
119Claude Code emits an `AssistantMessage` as each non-empty content block completes, so a response with a text block and a tool call yields two `AssistantMessage` objects. Each one carries only its own content block, and both share the same message ID, which you read as `message.message.id` in TypeScript and `message.message_id` in Python. With partial messages enabled, each `AssistantMessage` arrives before that block's `content_block_stop` event, and you receive messages in this order:
117120 
118121```text theme={null}
119122StreamEvent (message_start)
120123StreamEvent (content_block_start) - text block
121124StreamEvent (content_block_delta) - text chunks...
125AssistantMessage - complete text block
122126StreamEvent (content_block_stop)
123127StreamEvent (content_block_start) - tool_use block
124128StreamEvent (content_block_delta) - tool input chunks...
129AssistantMessage - complete tool_use block
125130StreamEvent (content_block_stop)
126131StreamEvent (message_delta)
127132StreamEvent (message_stop)
128AssistantMessage - complete message with all content
129133... tool executes ...
130134... more streaming events for next turn ...
131135ResultMessage - final result
132136```
133137 
134Without partial messages enabled, you receive all message types except `StreamEvent`. Common types include `SystemMessage` (session initialization), `AssistantMessage` (complete responses), `ResultMessage` (final result), and a compact boundary message indicating when conversation history was compacted (`SDKCompactBoundaryMessage` in TypeScript; `SystemMessage` with subtype `"compact_boundary"` in Python).
138Without partial messages enabled, you receive all message types except `StreamEvent`. Common types include `SystemMessage` (session initialization), `AssistantMessage` (complete content blocks), `ResultMessage` (final result), and a compact boundary message indicating when conversation history was compacted (`SDKCompactBoundaryMessage` in TypeScript; `SystemMessage` with subtype `"compact_boundary"` in Python).
135139 
136140## Stream tool calls
137141