Streaming Events
When Claude responds, content is streamed in real-time viasdk_message events. This page documents all streaming event types.
Event Flow
1
Client sends message
User message sent via
sdk_message2
Streaming Response
Server streams
sdk_message events with text chunks. If Claude invokes a tool, a tool_use event is sent, followed by tool_call for execution. Client responds with tool_result, then streaming continues.3
Result
Server sends final
result event with complete response and usage statsText Events
Text content streamed as it’s generated:text fields to build the full response.
Thinking Events
Extended thinking content (when enabled):Tool Use Events
When Claude decides to use a tool:| Field | Type | Description |
|---|---|---|
id | string | Unique call identifier |
name | string | Tool name |
input | object | Arguments for the tool |
Tool Call Request
After a tool use event, the server sends atool_call requesting execution:
tool_result.
Tool Result Response
Client sends tool execution result:Success Result
Error Result
Image Result
Result Event
Final result after streaming completes:Result Subtypes
| Subtype | Description |
|---|---|
success | Completed successfully |
error | Error occurred |
interrupted | Interrupted (e.g., max turns reached) |
Usage Fields
| Field | Type | Description |
|---|---|---|
input_tokens | number | Input tokens used |
output_tokens | number | Output tokens generated |
cache_creation_input_tokens | number | Tokens used to create cache |
cache_read_input_tokens | number | Tokens read from cache |