Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

events-and-streaming changedmanaged-agents/events-and-streaming

Nearest release: v2.1.307, published an hour after 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−8removed
From line 1 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits29to this page, all time

The whole hunk

from line 1, old and new numbered
/
lines
from line 1
11---
22title: Session event stream
33url: https://platform.claude.com/docs/en/managed-agents/events-and-streaming
4description: Send events, stream responses, and interrupt or redirect your session mid-execution.
4description: Send events, stream responses, and interrupt or redirect your session while it runs.
55featureMetadata:
66 topic:
77 title: Managed Agents
from line 276
276276 
277277The session reports errors through the `session.error` event. See [Event types](https://platform.claude.com/docs/en/managed-agents/reference#event-types) for its fields.
278278 
279The agent's response text arrives as buffered `agent.message` events, each emitted only after the model request that produced it finishes. To render the text while the model is still generating it, see [Preview responses with event deltas](https://platform.claude.com/docs/en/managed-agents/event-deltas).
279The agent's response text arrives as buffered `agent.message` events, each emitted only after the model request that produced it completes. To render the text while the model is still generating it, see [Preview responses with event deltas](https://platform.claude.com/docs/en/managed-agents/event-deltas).
280280 
281281### Reconnect without missing events
282282 
from line 484
484484 seen_event_ids = Set.new
485485 client.beta.sessions.events.list(session.id).auto_paging_each { seen_event_ids << it.id }
486486 
487 # Tail live events, skipping anything already seen — Set#add? returns nil for duplicates
487 # Tail live events, skipping anything already seen (Set#add? returns nil for duplicates)
488488 stream.each do |event|
489489 next unless seen_event_ids.add?(event.id)
490490 case event
from line 663
663663 
664664## Answer tool calls that pause the session
665665 
666A session pauses when the agent invokes a [custom tool](https://platform.claude.com/docs/en/managed-agents/tools#custom-tools), and when a tool call needs your confirmation under a [permission policy](https://platform.claude.com/docs/en/managed-agents/permission-policies). Both pauses follow the same sequence:
666A session pauses when the agent calls a [custom tool](https://platform.claude.com/docs/en/managed-agents/tools#custom-tools), and when a tool call needs your confirmation under a [permission policy](https://platform.claude.com/docs/en/managed-agents/permission-policies). Both pauses follow the same sequence:
667667 
6686681. The session emits the tool call as an `agent.custom_tool_use`, `agent.tool_use`, or `agent.mcp_tool_use` event.
6696692. The session pauses with a `session.status_idle` event whose `stop_reason.type` is `requires_action`. The blocking event IDs are in the `stop_reason.event_ids` array.
from line 1272
12721272 
12731273## Interrupt the agent
12741274 
1275Send a `user.interrupt` event to stop the agent mid-execution, then follow up with a `user.message` event to redirect it:
1275Send a `user.interrupt` event to stop the agent while it runs, then follow up with a `user.message` event to redirect it:
12761276 
12771277<CodeGroup>
12781278 ```bash cURL
from line 1454
145414542. The `user.interrupt` event appears on the stream, and the interrupted turn ends with a `session.status_idle` event.
145514553. The agent starts its next turn with the `user.message` you sent after the interrupt.
14561456 
1457The idle event's `stop_reason.type` is `end_turn`, the same value as a turn that finishes on its own. If workflow runs are open, the interrupt ends none of them. A run that's running can keep the session `running`, so the `session.status_idle` event in step 2 might not arrive. See [Interrupt a session with runs open](https://platform.claude.com/docs/en/managed-agents/workflow-runs#interrupt-a-session-with-runs-open).
1457The idle event's `stop_reason.type` is `end_turn`, the same value as a turn that completes on its own. If workflow runs are open, the interrupt ends none of them. A run that's running can keep the session `running`, so the `session.status_idle` event in step 2 might not arrive. See [Interrupt a session with runs open](https://platform.claude.com/docs/en/managed-agents/workflow-runs#interrupt-a-session-with-runs-open).
14581458 
14591459## List past events
14601460 
from line 1627
16271627 
16281628On a [supported model](https://platform.claude.com/docs/en/managed-agents/events-and-streaming#supported-models), send a `system.message` event to give the agent privileged system-level context. The context applies to the accompanying turn and all subsequent turns. Use it when the agent needs updated system-level guidance mid-session, for example a different persona, revised constraints, or context fetched at runtime.
16291629 
1630The event's `content` (csharp, go: `Content`) accepts 1–1000 text items. The content is appended to the session's system context as a `role: "system"` turn. It doesn't replace the top-level system prompt, which the `system` (csharp, go: `System`; ruby: `system_`) field on the agent definition sets.
1630The event's `content` (csharp, go: `Content`) accepts 1–1,000 text items. The content is appended to the session's system context as a `role: "system"` turn. It doesn't replace the top-level system prompt, which the `system` (csharp, go: `System`; ruby: `system_`) field on the agent definition sets.
16311631 
16321632<CodeGroup>
16331633 ```bash cURL
from line 1800
18001800 </Card>
18011801 
18021802 <Card title="Subscribe to webhooks" icon="link" href="https://platform.claude.com/docs/en/managed-agents/webhooks">
1803 Get notified when major events happen without polling.
1803 Get notified when major events occur without polling.
18041804 </Card>
18051805 
18061806 <Card title="Event types" icon="book" href="https://platform.claude.com/docs/en/managed-agents/reference#event-types">
Feedback