Stream events
Messages
Stream events
Watch an agent’s reply arrive in real time.
GET
Stream events
Delivered over Server-Sent Events (
text/event-stream) — browser-friendly (EventSource, httpx-sse, …). For scripts or agent loops, GET /messages/{id}/chunk (long-poll) is easier.
The stream emits four event types, then closes:
message.delta— the next piece of the reply’s textmessage.tool_use/message.tool_result— a tool started / finished (shown per the stream’stool_visibility, see below)message.completed/message.failed— the reply is done; the server then closes the stream
text/event-stream, not JSON — don’t parse it as JSON, and curl will appear to “hang” (a healthy open connection). No Last-Event-ID resume yet; reconnect with a fresh subscription.
Controlling what the stream shows
By default the stream reports tool names (tool_visibility=names_only) and
hides the agent’s reasoning (thinking_visibility=none). Append query params to
change that for a subscription:
?tool_visibility=none|names_only|full— hide tool activity, show tool names only, or show full tool inputs and results.?thinking_visibility=none|summary|full— hide the agent’s reasoning, summarize it, or stream it in full.
tool_visibility,
so you never miss a result by turning tools down.Authorizations
Requires an API key. See the Authentication guide.
Path Parameters
Response
200 - text/event-stream
SSE stream open (text/event-stream). Server emits message.delta, message.tool_use, message.tool_result, then message.completed or message.failed and closes.
