SPB Git

Repository Public

stream.md 74.3 KB 2,438 lines markdown

1---2title: Stream Events3url: https://platform.claude.com/docs/en/api/beta/sessions/events/stream4---56# Stream Events78**GET** `/v1/sessions/{session_id}/events/stream`910Stream Events1112## Path parameters1314- `session_id: string`1516## Query parameters1718- `event_deltas: optional array of BetaManagedAgentsDeltaType`1920  When set, this connection also receives streaming deltas (`event_start`, `event_delta`) while an event is being produced, before the event itself arrives. Deltas are best-effort; when the final event is produced it carries the complete content. A model request that ends early (an error or interrupt) produces no final event — its terminal `span.model_request_end` closes the preview. Accepts one or more event types to preview and may be repeated: `agent.message` streams `content_delta` fragments; `agent.thinking` is start-only — a signal that the agent has begun extended thinking, concluded by the `agent.thinking` event itself. Only previews of the requested event types are sent.2122  - `"agent.message"`2324  - `"agent.thinking"`2526## Headers2728- `"anthropic-beta": optional array of AnthropicBeta`2930  Optional header to specify the beta version(s) you want to use.3132  - `string`3334  - `"message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 43 more`3536    - `"message-batches-2024-09-24"`3738    - `"prompt-caching-2024-07-31"`3940    - `"computer-use-2024-10-22"`4142    - `"computer-use-2025-01-24"`4344    - `"pdfs-2024-09-25"`4546    - `"token-counting-2024-11-01"`4748    - `"token-efficient-tools-2025-02-19"`4950    - `"output-128k-2025-02-19"`5152    - `"files-api-2025-04-14"`5354    - `"mcp-client-2025-04-04"`5556    - `"mcp-client-2025-11-20"`5758    - `"dev-full-thinking-2025-05-14"`5960    - `"interleaved-thinking-2025-05-14"`6162    - `"code-execution-2025-05-22"`6364    - `"extended-cache-ttl-2025-04-11"`6566    - `"context-1m-2025-08-07"`6768    - `"context-management-2025-06-27"`6970    - `"model-context-window-exceeded-2025-08-26"`7172    - `"skills-2025-10-02"`7374    - `"fast-mode-2026-02-01"`7576    - `"output-300k-2026-03-24"`7778    - `"user-profiles-2026-03-24"`7980    - `"user-profiles-2026-08-18"`8182    - `"user-profiles-2026-09-04"`8384    - `"advisor-tool-2026-03-01"`8586    - `"managed-agents-2026-04-01"`8788    - `"cache-diagnosis-2026-04-07"`8990    - `"dreaming-2026-04-21"`9192    - `"thinking-token-count-2026-05-13"`9394    - `"server-side-fallback-2026-06-01"`9596    - `"server-side-fallback-2026-07-01"`9798    - `"fallback-credit-2026-06-01"`99100    - `"fallback-credit-2026-07-01"`101102    - `"agent-memory-2026-07-22"`103104    - `"mid-conversation-tool-changes-2026-07-01"`105106    - `"compact-2026-01-12"`107108    - `"computer-use-2025-11-24"`109110    - `"mcp-tunnels-2026-06-22"`111112    - `"structured-outputs-2025-11-13"`113114    - `"task-budgets-2026-03-13"`115116    - `"thinking-display-updates-2026-08-18"`117118    - `"ce-user-management-2026-07-13"`119120    - `"mid-conversation-output-config-2026-07-01"`121122    - `"thinking-binding-controls-2026-08-01"`123124    - `"mid-conversation-system-clear-at-2026-08-21"`125126    - `"compact-2026-09-04"`127128- `"anthropic-workspace-id": optional string`129130## Returns131132- `BetaManagedAgentsStreamSessionEvents = BetaManagedAgentsUserMessageEvent or BetaManagedAgentsUserInterruptEvent or BetaManagedAgentsUserToolConfirmationEvent or 34 more`133134  Server-sent event in the session stream.135136  - `BetaManagedAgentsUserMessageEvent object`137138    A user message event in the session conversation.139140    - `type: "user.message"`141142    - `id: string`143144      Unique identifier for this event.145146    - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsRedactedBlock`147148      Array of content blocks comprising the user message.149150      - `BetaManagedAgentsTextBlock object`151152        Regular text content.153154        - `type: "text"`155156        - `text: string`157158          The text content.159160          minLength: 1161162      - `BetaManagedAgentsImageBlock object`163164        Image content specified directly as base64 data or as a reference via a URL.165166        - `type: "image"`167168        - `source: BetaManagedAgentsBase64ImageSource or BetaManagedAgentsURLImageSource or BetaManagedAgentsFileImageSource`169170          Union type for image source variants.171172          - `BetaManagedAgentsBase64ImageSource object`173174            Base64-encoded image data.175176            - `type: "base64"`177178            - `data: string`179180              Base64-encoded image data.181182              minLength: 1183184            - `media_type: string`185186              MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").187188              minLength: 1189190          - `BetaManagedAgentsURLImageSource object`191192            Image referenced by URL.193194            - `type: "url"`195196            - `url: string`197198              URL of the image to fetch.199200              minLength: 1201202          - `BetaManagedAgentsFileImageSource object`203204            Image referenced by file ID.205206            - `type: "file"`207208            - `file_id: string`209210              ID of a previously uploaded file.211212              minLength: 1213214      - `BetaManagedAgentsDocumentBlock object`215216        Document content, either specified directly as base64 data, as text, or as a reference via a URL.217218        - `type: "document"`219220        - `source: BetaManagedAgentsBase64DocumentSource or BetaManagedAgentsPlainTextDocumentSource or BetaManagedAgentsURLDocumentSource or BetaManagedAgentsFileDocumentSource`221222          Union type for document source variants.223224          - `BetaManagedAgentsBase64DocumentSource object`225226            Base64-encoded document data.227228            - `type: "base64"`229230            - `data: string`231232              Base64-encoded document data.233234              minLength: 1235236            - `media_type: string`237238              MIME type of the document (e.g., "application/pdf").239240              minLength: 1241242          - `BetaManagedAgentsPlainTextDocumentSource object`243244            Plain text document content.245246            - `type: "text"`247248            - `data: string`249250              The plain text content.251252              minLength: 1253254            - `media_type: "text/plain"`255256              MIME type of the text content. Must be "text/plain".257258          - `BetaManagedAgentsURLDocumentSource object`259260            Document referenced by URL.261262            - `type: "url"`263264            - `url: string`265266              URL of the document to fetch.267268              minLength: 1269270          - `BetaManagedAgentsFileDocumentSource object`271272            Document referenced by file ID.273274            - `type: "file"`275276            - `file_id: string`277278              ID of a previously uploaded file.279280              minLength: 1281282        - `context: optional string or null`283284          Additional context about the document for the model.285286        - `title: optional string or null`287288          The title of the document.289290      - `BetaManagedAgentsRedactedBlock object`291292        Placeholder for content withheld by Anthropic model policy.293294        - `type: "redacted"`295296    - `processed_at: optional string or null`297298      A timestamp in RFC 3339 format299300      format: date-time301302  - `BetaManagedAgentsUserInterruptEvent object`303304    An interrupt event that pauses agent execution and returns control to the user.305306    - `type: "user.interrupt"`307308    - `id: string`309310      Unique identifier for this event.311312    - `processed_at: optional string or null`313314      A timestamp in RFC 3339 format315316      format: date-time317318    - `session_thread_id: optional string or null`319320      If absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread.321322  - `BetaManagedAgentsUserToolConfirmationEvent object`323324    A tool confirmation event that approves or denies a pending tool execution.325326    - `type: "user.tool_confirmation"`327328    - `id: string`329330      Unique identifier for this event.331332    - `result: "allow" or "deny"`333334      UserToolConfirmationResult enum335336      - `"allow"`337338      - `"deny"`339340    - `tool_use_id: string`341342      The id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.343344    - `deny_message: optional string or null`345346      Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.347348      maxLength: 10000349350    - `processed_at: optional string or null`351352      A timestamp in RFC 3339 format353354      format: date-time355356    - `session_thread_id: optional string or null`357358      Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread.359360  - `BetaManagedAgentsUserCustomToolResultEvent object`361362    Event sent by the client providing the result of a custom tool execution.363364    - `type: "user.custom_tool_result"`365366    - `id: string`367368      Unique identifier for this event.369370    - `custom_tool_use_id: string`371372      The id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.373374    - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsSearchResultBlock`375376      The result content returned by the tool.377378      - `BetaManagedAgentsTextBlock object`379380        Regular text content.381382      - `BetaManagedAgentsImageBlock object`383384        Image content specified directly as base64 data or as a reference via a URL.385386      - `BetaManagedAgentsDocumentBlock object`387388        Document content, either specified directly as base64 data, as text, or as a reference via a URL.389390      - `BetaManagedAgentsSearchResultBlock object`391392        A block containing a web search result.393394        - `type: "search_result"`395396        - `citations: BetaManagedAgentsSearchResultCitations`397398          Citation settings for a search result.399400          - `enabled: boolean`401402            Whether citations are enabled for this search result.403404        - `content: array of BetaManagedAgentsSearchResultContent`405406          Array of text content blocks from the search result.407408          - `type: "text"`409410          - `text: string`411412            The text content.413414            minLength: 1415416        - `source: string`417418          The URL source of the search result.419420          minLength: 1421422        - `title: string`423424          The title of the search result.425426          minLength: 1427428    - `is_error: optional boolean or null`429430      Whether the tool execution resulted in an error.431432    - `processed_at: optional string or null`433434      A timestamp in RFC 3339 format435436      format: date-time437438    - `session_thread_id: optional string or null`439440      Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.441442  - `BetaManagedAgentsAgentCustomToolUseEvent object`443444    Event emitted when the agent calls a custom tool. The session goes idle until the client sends a `user.custom_tool_result` event with the result.445446    - `type: "agent.custom_tool_use"`447448    - `id: string`449450      Unique identifier for this event.451452    - `input: map[unknown]`453454      Input parameters for the tool call.455456    - `name: string`457458      Name of the custom tool being called.459460    - `processed_at: string`461462      A timestamp in RFC 3339 format463464      format: date-time465466    - `session_thread_id: optional string or null`467468      When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back.469470  - `BetaManagedAgentsAgentMessageEvent object`471472    An agent response event in the session conversation.473474    - `type: "agent.message"`475476    - `id: string`477478      Unique identifier for this event.479480    - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsRedactedBlock`481482      Array of text blocks comprising the agent response.483484      - `BetaManagedAgentsTextBlock object`485486        Regular text content.487488      - `BetaManagedAgentsRedactedBlock object`489490        Placeholder for content withheld by Anthropic model policy.491492    - `processed_at: string`493494      A timestamp in RFC 3339 format495496      format: date-time497498  - `BetaManagedAgentsAgentThinkingEvent object`499500    Indicates the agent is making forward progress via extended thinking. A progress signal, not a content carrier.501502    - `type: "agent.thinking"`503504    - `id: string`505506      Unique identifier for this event.507508    - `processed_at: string`509510      A timestamp in RFC 3339 format511512      format: date-time513514  - `BetaManagedAgentsAgentMCPToolUseEvent object`515516    Event emitted when the agent invokes a tool provided by an MCP server.517518    - `type: "agent.mcp_tool_use"`519520    - `id: string`521522      Unique identifier for this event.523524    - `input: map[unknown]`525526      Input parameters for the tool call.527528    - `mcp_server_name: string`529530      Name of the MCP server providing the tool.531532    - `name: string`533534      Name of the MCP tool being used.535536    - `processed_at: string`537538      A timestamp in RFC 3339 format539540      format: date-time541542    - `evaluated_permission: optional "allow" or "ask" or "deny"`543544      AgentEvaluatedPermission enum545546      - `"allow"`547548      - `"ask"`549550      - `"deny"`551552    - `evaluation: optional BetaManagedAgentsAgentToolEvaluation`553554      Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.555556      - `BetaManagedAgentsAgentToolEvaluationAlwaysAllow object`557558        The resolved permission_policy was always_allow; accompanies evaluated_permission "allow".559560        - `type: "always_allow"`561562      - `BetaManagedAgentsAgentToolEvaluationAlwaysAsk object`563564        The resolved permission_policy was always_ask; accompanies evaluated_permission "ask".565566        - `type: "always_ask"`567568      - `BetaManagedAgentsAgentToolEvaluationAuto object`569570        The resolved permission_policy was auto: the server judged this invocation individually.571572        - `type: "auto"`573574        - `evaluated_permission: BetaManagedAgentsAgentAutoEvaluatedPermission`575576          The server's per-invocation judgement under the auto permission policy. Its type always equals the event's top-level evaluated_permission. Open union: clients must tolerate unknown variants.577578          - `BetaManagedAgentsAgentAutoEvaluatedPermissionAllow object`579580            The server judged the invocation safe to execute without client approval.581582            - `type: "allow"`583584          - `BetaManagedAgentsAgentAutoEvaluatedPermissionAsk object`585586            The server reached no judgement; the invocation is held for client approval.587588            - `type: "ask"`589590            - `reason_code: string`591592              The judgement's grounds in registry-bound terms, for client branching and audit rather than end-user display. Open registry; currently "indeterminate" (no judgement was reached). Clients must tolerate values outside this set.593594              maxLength: 64595596          - `BetaManagedAgentsAgentAutoEvaluatedPermissionDeny object`597598            The server judged the invocation high-risk; it does not execute and a synthetic error tool result is appended.599600            - `type: "deny"`601602            - `reason_code: string`603604              The judgement's grounds in registry-bound terms. Open registry; currently "high_risk" (judged high-risk; the call does not run). Clients must tolerate values outside this set.605606              maxLength: 64607608    - `session_thread_id: optional string or null`609610      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back.611612  - `BetaManagedAgentsAgentMCPToolResultEvent object`613614    Event representing the result of an MCP tool execution.615616    - `type: "agent.mcp_tool_result"`617618    - `id: string`619620      Unique identifier for this event.621622    - `mcp_tool_use_id: string`623624      The id of the `agent.mcp_tool_use` event this result corresponds to.625626    - `processed_at: string`627628      A timestamp in RFC 3339 format629630      format: date-time631632    - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsSearchResultBlock`633634      The result content returned by the tool.635636      - `BetaManagedAgentsTextBlock object`637638        Regular text content.639640      - `BetaManagedAgentsImageBlock object`641642        Image content specified directly as base64 data or as a reference via a URL.643644      - `BetaManagedAgentsDocumentBlock object`645646        Document content, either specified directly as base64 data, as text, or as a reference via a URL.647648      - `BetaManagedAgentsSearchResultBlock object`649650        A block containing a web search result.651652    - `is_error: optional boolean or null`653654      Whether the tool execution resulted in an error.655656  - `BetaManagedAgentsAgentToolUseEvent object`657658    Event emitted when the agent invokes a built-in agent tool.659660    - `type: "agent.tool_use"`661662    - `id: string`663664      Unique identifier for this event.665666    - `input: map[unknown]`667668      Input parameters for the tool call.669670    - `name: string`671672      Name of the agent tool being used.673674    - `processed_at: string`675676      A timestamp in RFC 3339 format677678      format: date-time679680    - `evaluated_permission: optional "allow" or "ask" or "deny"`681682      AgentEvaluatedPermission enum683684      - `"allow"`685686      - `"ask"`687688      - `"deny"`689690    - `evaluation: optional BetaManagedAgentsAgentToolEvaluation`691692      Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.693694    - `session_thread_id: optional string or null`695696      When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back.697698  - `BetaManagedAgentsAgentToolResultEvent object`699700    Event representing the result of an agent tool execution.701702    - `type: "agent.tool_result"`703704    - `id: string`705706      Unique identifier for this event.707708    - `processed_at: string`709710      A timestamp in RFC 3339 format711712      format: date-time713714    - `tool_use_id: string`715716      The id of the `agent.tool_use` event this result corresponds to.717718    - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsSearchResultBlock`719720      The result content returned by the tool.721722      - `BetaManagedAgentsTextBlock object`723724        Regular text content.725726      - `BetaManagedAgentsImageBlock object`727728        Image content specified directly as base64 data or as a reference via a URL.729730      - `BetaManagedAgentsDocumentBlock object`731732        Document content, either specified directly as base64 data, as text, or as a reference via a URL.733734      - `BetaManagedAgentsSearchResultBlock object`735736        A block containing a web search result.737738    - `is_error: optional boolean or null`739740      Whether the tool execution resulted in an error.741742  - `BetaManagedAgentsAgentThreadMessageReceivedEvent object`743744    Delivery event written to the target thread's input stream when an agent-to-agent message arrives.745746    - `type: "agent.thread_message_received"`747748    - `id: string`749750      Unique identifier for this event.751752    - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsRedactedBlock`753754      Message content blocks.755756      - `BetaManagedAgentsTextBlock object`757758        Regular text content.759760      - `BetaManagedAgentsImageBlock object`761762        Image content specified directly as base64 data or as a reference via a URL.763764      - `BetaManagedAgentsDocumentBlock object`765766        Document content, either specified directly as base64 data, as text, or as a reference via a URL.767768      - `BetaManagedAgentsRedactedBlock object`769770        Placeholder for content withheld by Anthropic model policy.771772    - `from_session_thread_id: string`773774      Public `sthr_` ID of the thread that sent the message.775776    - `processed_at: string`777778      A timestamp in RFC 3339 format779780      format: date-time781782    - `from_agent_name: optional string or null`783784      Name of the callable agent this message came from. Absent when received from the primary agent.785786  - `BetaManagedAgentsAgentThreadMessageSentEvent object`787788    Observability event emitted to the sender's output stream when an agent-to-agent message is sent.789790    - `type: "agent.thread_message_sent"`791792    - `id: string`793794      Unique identifier for this event.795796    - `content: array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsRedactedBlock`797798      Message content blocks.799800      - `BetaManagedAgentsTextBlock object`801802        Regular text content.803804      - `BetaManagedAgentsImageBlock object`805806        Image content specified directly as base64 data or as a reference via a URL.807808      - `BetaManagedAgentsDocumentBlock object`809810        Document content, either specified directly as base64 data, as text, or as a reference via a URL.811812      - `BetaManagedAgentsRedactedBlock object`813814        Placeholder for content withheld by Anthropic model policy.815816    - `processed_at: string`817818      A timestamp in RFC 3339 format819820      format: date-time821822    - `to_session_thread_id: string`823824      Public `sthr_` ID of the thread the message was sent to.825826    - `to_agent_name: optional string or null`827828      Name of the callable agent this message was sent to. Absent when sent to the primary agent.829830  - `BetaManagedAgentsAgentThreadContextCompactedEvent object`831832    Indicates that context compaction (summarization) occurred during the session.833834    - `type: "agent.thread_context_compacted"`835836    - `id: string`837838      Unique identifier for this event.839840    - `processed_at: string`841842      A timestamp in RFC 3339 format843844      format: date-time845846  - `BetaManagedAgentsSessionErrorEvent object`847848    An error event indicating a problem occurred during session execution.849850    - `type: "session.error"`851852    - `id: string`853854      Unique identifier for this event.855856    - `error: BetaManagedAgentsUnknownError or BetaManagedAgentsModelOverloadedError or BetaManagedAgentsModelRateLimitedError or 5 more`857858      - `BetaManagedAgentsUnknownError object`859860        An unknown or unexpected error occurred during session execution. A fallback variant; clients that don't recognize a new error code can match on `retry_status` and `message` alone.861862        - `type: "unknown_error"`863864        - `message: string`865866          Human-readable error description.867868        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`869870          What the client should do next in response to this error.871872          - `BetaManagedAgentsRetryStatusRetrying object`873874            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.875876            - `type: "retrying"`877878          - `BetaManagedAgentsRetryStatusExhausted object`879880            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.881882            - `type: "exhausted"`883884          - `BetaManagedAgentsRetryStatusTerminal object`885886            The session encountered a terminal error and will transition to `terminated` state.887888            - `type: "terminal"`889890      - `BetaManagedAgentsModelOverloadedError object`891892        The model is currently overloaded. Emitted after automatic retries are exhausted.893894        - `type: "model_overloaded_error"`895896        - `message: string`897898          Human-readable error description.899900        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`901902          What the client should do next in response to this error.903904          - `BetaManagedAgentsRetryStatusRetrying object`905906            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.907908          - `BetaManagedAgentsRetryStatusExhausted object`909910            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.911912          - `BetaManagedAgentsRetryStatusTerminal object`913914            The session encountered a terminal error and will transition to `terminated` state.915916      - `BetaManagedAgentsModelRateLimitedError object`917918        The model request was rate-limited.919920        - `type: "model_rate_limited_error"`921922        - `message: string`923924          Human-readable error description.925926        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`927928          What the client should do next in response to this error.929930          - `BetaManagedAgentsRetryStatusRetrying object`931932            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.933934          - `BetaManagedAgentsRetryStatusExhausted object`935936            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.937938          - `BetaManagedAgentsRetryStatusTerminal object`939940            The session encountered a terminal error and will transition to `terminated` state.941942      - `BetaManagedAgentsModelRequestFailedError object`943944        A model request failed for a reason other than overload or rate-limiting.945946        - `type: "model_request_failed_error"`947948        - `message: string`949950          Human-readable error description.951952        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`953954          What the client should do next in response to this error.955956          - `BetaManagedAgentsRetryStatusRetrying object`957958            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.959960          - `BetaManagedAgentsRetryStatusExhausted object`961962            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.963964          - `BetaManagedAgentsRetryStatusTerminal object`965966            The session encountered a terminal error and will transition to `terminated` state.967968      - `BetaManagedAgentsMCPConnectionFailedError object`969970        Failed to connect to an MCP server.971972        - `type: "mcp_connection_failed_error"`973974        - `mcp_server_name: string`975976          Name of the MCP server that failed to connect.977978        - `message: string`979980          Human-readable error description.981982        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`983984          What the client should do next in response to this error.985986          - `BetaManagedAgentsRetryStatusRetrying object`987988            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.989990          - `BetaManagedAgentsRetryStatusExhausted object`991992            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.993994          - `BetaManagedAgentsRetryStatusTerminal object`995996            The session encountered a terminal error and will transition to `terminated` state.997998      - `BetaManagedAgentsMCPAuthenticationFailedError object`9991000        Authentication to an MCP server failed.10011002        - `type: "mcp_authentication_failed_error"`10031004        - `mcp_server_name: string`10051006          Name of the MCP server that failed authentication.10071008        - `message: string`10091010          Human-readable error description.10111012        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`10131014          What the client should do next in response to this error.10151016          - `BetaManagedAgentsRetryStatusRetrying object`10171018            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.10191020          - `BetaManagedAgentsRetryStatusExhausted object`10211022            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.10231024          - `BetaManagedAgentsRetryStatusTerminal object`10251026            The session encountered a terminal error and will transition to `terminated` state.10271028      - `BetaManagedAgentsBillingError object`10291030        The caller's organization or workspace cannot make model requests — out of credits or spend limit reached. Retrying with the same credentials will not succeed; the caller must resolve the billing state.10311032        - `type: "billing_error"`10331034        - `message: string`10351036          Human-readable error description.10371038        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`10391040          What the client should do next in response to this error.10411042          - `BetaManagedAgentsRetryStatusRetrying object`10431044            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.10451046          - `BetaManagedAgentsRetryStatusExhausted object`10471048            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.10491050          - `BetaManagedAgentsRetryStatusTerminal object`10511052            The session encountered a terminal error and will transition to `terminated` state.10531054      - `BetaManagedAgentsCredentialHostUnreachableError object`10551056        An `environment_variable` credential's `auth.networking.allowed_hosts` includes a host the environment's network policy does not permit.10571058        - `type: "credential_host_unreachable_error"`10591060        - `credential_id: string`10611062          ID of the affected credential.10631064        - `message: string`10651066          Human-readable error description.10671068        - `retry_status: BetaManagedAgentsRetryStatusRetrying or BetaManagedAgentsRetryStatusExhausted or BetaManagedAgentsRetryStatusTerminal`10691070          What the client should do next in response to this error.10711072          - `BetaManagedAgentsRetryStatusRetrying object`10731074            The server is retrying automatically. Client should wait; the same error type may fire again as retrying, then once as exhausted when the retry budget runs out.10751076          - `BetaManagedAgentsRetryStatusExhausted object`10771078            This turn is dead; queued inputs are flushed and the session returns to idle. Client may send a new prompt.10791080          - `BetaManagedAgentsRetryStatusTerminal object`10811082            The session encountered a terminal error and will transition to `terminated` state.10831084        - `vault_id: string`10851086          ID of the vault containing the affected credential.10871088    - `processed_at: string`10891090      A timestamp in RFC 3339 format10911092      format: date-time10931094  - `BetaManagedAgentsSessionStatusRescheduledEvent object`10951096    Indicates the session is recovering from an error state and is rescheduled for execution.10971098    - `type: "session.status_rescheduled"`10991100    - `id: string`11011102      Unique identifier for this event.11031104    - `processed_at: string`11051106      A timestamp in RFC 3339 format11071108      format: date-time11091110  - `BetaManagedAgentsSessionStatusRunningEvent object`11111112    Indicates the session is actively running and the agent is working.11131114    - `type: "session.status_running"`11151116    - `id: string`11171118      Unique identifier for this event.11191120    - `processed_at: string`11211122      A timestamp in RFC 3339 format11231124      format: date-time11251126  - `BetaManagedAgentsSessionStatusIdleEvent object`11271128    Indicates the agent has paused and is awaiting user input.11291130    - `type: "session.status_idle"`11311132    - `id: string`11331134      Unique identifier for this event.11351136    - `processed_at: string`11371138      A timestamp in RFC 3339 format11391140      format: date-time11411142    - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted or BetaManagedAgentsSessionBudgetReached`11431144      - `BetaManagedAgentsSessionEndTurn object`11451146        The agent completed its turn naturally and is ready for the next user message.11471148        - `type: "end_turn"`11491150      - `BetaManagedAgentsSessionRequiresAction object`11511152        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.11531154        - `type: "requires_action"`11551156        - `event_ids: array of string`11571158          The ids of events the agent is blocked on. Resolving fewer than all re-emits `session.status_idle` with the remainder.11591160      - `BetaManagedAgentsSessionRetriesExhausted object`11611162        The turn ended because repeated errors exhausted the retry budget or an error escalated to `retry_status: 'exhausted'`.11631164        - `type: "retries_exhausted"`11651166      - `BetaManagedAgentsSessionBudgetReached object`11671168        The agent stopped because the session's tracked list cost reached its budget, or because its usage includes a model with no list price (which the budget cannot measure). Raise the budget to continue — or, if raising is rejected because a model has no list price, remove the budget.11691170        - `type: "budget_reached"`11711172  - `BetaManagedAgentsSessionStatusTerminatedEvent object`11731174    Indicates the session has terminated, either due to an error or completion.11751176    - `type: "session.status_terminated"`11771178    - `id: string`11791180      Unique identifier for this event.11811182    - `processed_at: string`11831184      A timestamp in RFC 3339 format11851186      format: date-time11871188  - `BetaManagedAgentsSessionThreadCreatedEvent object`11891190    Emitted when a subagent is spawned as a new thread. Written to the parent thread's output stream so clients observing the session see child creation.11911192    - `type: "session.thread_created"`11931194    - `id: string`11951196      Unique identifier for this event.11971198    - `agent_name: string`11991200      Name of the callable agent the thread runs.12011202    - `processed_at: string`12031204      A timestamp in RFC 3339 format12051206      format: date-time12071208    - `session_thread_id: string`12091210      Public `sthr_` ID of the newly created thread.12111212  - `BetaManagedAgentsSpanOutcomeEvaluationStartEvent object`12131214    Emitted when an outcome evaluation cycle begins.12151216    - `type: "span.outcome_evaluation_start"`12171218    - `id: string`12191220      Unique identifier for this event.12211222    - `iteration: number`12231224      0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.12251226      format: int3212271228    - `outcome_id: string`12291230      The `outc_` ID of the outcome being evaluated.12311232    - `processed_at: string`12331234      A timestamp in RFC 3339 format12351236      format: date-time12371238  - `BetaManagedAgentsSpanOutcomeEvaluationEndEvent object`12391240    Emitted when an outcome evaluation cycle completes. Carries the verdict and aggregate token usage. A verdict of `needs_revision` means another evaluation cycle follows; `satisfied`, `max_iterations_reached`, `failed`, or `interrupted` are terminal — no further evaluation cycles follow.12411242    - `type: "span.outcome_evaluation_end"`12431244    - `id: string`12451246      Unique identifier for this event.12471248    - `explanation: string`12491250      Human-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.12511252    - `iteration: number`12531254      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.12551256      format: int3212571258    - `outcome_evaluation_start_id: string`12591260      The id of the corresponding `span.outcome_evaluation_start` event.12611262    - `outcome_id: string`12631264      The `outc_` ID of the outcome being evaluated.12651266    - `processed_at: string`12671268      A timestamp in RFC 3339 format12691270      format: date-time12711272    - `result: string`12731274      Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.12751276    - `usage: BetaManagedAgentsSpanModelUsage`12771278      Token usage for a single model request.12791280      - `cache_creation_input_tokens: number`12811282        Tokens used to create prompt cache in this request.12831284        format: int3212851286      - `cache_read_input_tokens: number`12871288        Tokens read from prompt cache in this request.12891290        format: int3212911292      - `input_tokens: number`12931294        Input tokens consumed by this request.12951296        format: int3212971298      - `output_tokens: number`12991300        Output tokens generated by this request.13011302        format: int3213031304      - `speed: optional "standard" or "fast" or null`13051306        Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.13071308        - `"standard"`13091310        - `"fast"`13111312  - `BetaManagedAgentsSpanModelRequestStartEvent object`13131314    Emitted when a model request is initiated by the agent.13151316    - `type: "span.model_request_start"`13171318    - `id: string`13191320      Unique identifier for this event.13211322    - `processed_at: string`13231324      A timestamp in RFC 3339 format13251326      format: date-time13271328  - `BetaManagedAgentsSpanModelRequestEndEvent object`13291330    Emitted when a model request completes.13311332    - `type: "span.model_request_end"`13331334    - `id: string`13351336      Unique identifier for this event.13371338    - `is_error: boolean or null`13391340      Whether the model request resulted in an error.13411342    - `model_request_start_id: string`13431344      The id of the corresponding `span.model_request_start` event.13451346    - `model_usage: BetaManagedAgentsSpanModelUsage`13471348      Token usage for a single model request.13491350    - `processed_at: string`13511352      A timestamp in RFC 3339 format13531354      format: date-time13551356  - `BetaManagedAgentsSpanOutcomeEvaluationOngoingEvent object`13571358    Periodic heartbeat emitted while an outcome evaluation cycle is in progress. Distinguishes 'evaluation is actively running' from 'evaluation is stuck' between the corresponding `span.outcome_evaluation_start` and `span.outcome_evaluation_end` events.13591360    - `type: "span.outcome_evaluation_ongoing"`13611362    - `id: string`13631364      Unique identifier for this event.13651366    - `iteration: number`13671368      0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.13691370      format: int3213711372    - `outcome_id: string`13731374      The `outc_` ID of the outcome being evaluated.13751376    - `processed_at: string`13771378      A timestamp in RFC 3339 format13791380      format: date-time13811382  - `BetaManagedAgentsUserDefineOutcomeEvent object`13831384    Echo of a `user.define_outcome` input event. Carries the server-generated `outcome_id` that subsequent `span.outcome_evaluation_*` events reference.13851386    - `type: "user.define_outcome"`13871388    - `id: string`13891390      Unique identifier for this event.13911392    - `description: string`13931394      What the agent should produce. Copied from the input event.13951396    - `max_iterations: number or null`13971398      Evaluate-then-revise cycles before giving up. Default 3, max 20.13991400      format: int3214011402    - `outcome_id: string`14031404      Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.14051406    - `processed_at: string`14071408      A timestamp in RFC 3339 format14091410      format: date-time14111412    - `rubric: BetaManagedAgentsFileRubric or BetaManagedAgentsTextRubric`14131414      Rubric for grading the quality of an outcome.14151416      - `BetaManagedAgentsFileRubric object`14171418        Rubric referenced by a file uploaded via the Files API.14191420        - `type: "file"`14211422        - `file_id: string`14231424          ID of the rubric file.14251426      - `BetaManagedAgentsTextRubric object`14271428        Rubric content provided inline as text.14291430        - `type: "text"`14311432        - `content: string`14331434          Rubric content. Plain text or markdown — the grader treats it as freeform text.14351436  - `BetaManagedAgentsSessionDeletedEvent object`14371438    Emitted when a session has been deleted. Terminates any active event stream — no further events will be emitted for this session.14391440    - `type: "session.deleted"`14411442    - `id: string`14431444      Unique identifier for this event.14451446    - `processed_at: string`14471448      A timestamp in RFC 3339 format14491450      format: date-time14511452  - `BetaManagedAgentsSessionThreadStatusRunningEvent object`14531454    A session thread has begun executing. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.14551456    - `type: "session.thread_status_running"`14571458    - `id: string`14591460      Unique identifier for this event.14611462    - `agent_name: string`14631464      Name of the agent the thread runs.14651466    - `processed_at: string`14671468      A timestamp in RFC 3339 format14691470      format: date-time14711472    - `session_thread_id: string`14731474      Public sthr_ ID of the thread that started running.14751476  - `BetaManagedAgentsSessionThreadStatusIdleEvent object`14771478    A session thread has yielded and is awaiting input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.14791480    - `type: "session.thread_status_idle"`14811482    - `id: string`14831484      Unique identifier for this event.14851486    - `agent_name: string`14871488      Name of the agent the thread runs.14891490    - `processed_at: string`14911492      A timestamp in RFC 3339 format14931494      format: date-time14951496    - `session_thread_id: string`14971498      Public sthr_ ID of the thread that went idle.14991500    - `stop_reason: BetaManagedAgentsSessionEndTurn or BetaManagedAgentsSessionRequiresAction or BetaManagedAgentsSessionRetriesExhausted or BetaManagedAgentsSessionBudgetReached`15011502      - `BetaManagedAgentsSessionEndTurn object`15031504        The agent completed its turn naturally and is ready for the next user message.15051506      - `BetaManagedAgentsSessionRequiresAction object`15071508        The agent is idle waiting on one or more blocking user-input events (tool confirmation, custom tool result, etc.). Resolving all of them transitions the session back to running.15091510      - `BetaManagedAgentsSessionRetriesExhausted object`15111512        The turn ended because repeated errors exhausted the retry budget or an error escalated to `retry_status: 'exhausted'`.15131514      - `BetaManagedAgentsSessionBudgetReached object`15151516        The agent stopped because the session's tracked list cost reached its budget, or because its usage includes a model with no list price (which the budget cannot measure). Raise the budget to continue — or, if raising is rejected because a model has no list price, remove the budget.15171518  - `BetaManagedAgentsSessionThreadStatusTerminatedEvent object`15191520    A session thread has terminated and will accept no further input. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.15211522    - `type: "session.thread_status_terminated"`15231524    - `id: string`15251526      Unique identifier for this event.15271528    - `agent_name: string`15291530      Name of the agent the thread runs.15311532    - `processed_at: string`15331534      A timestamp in RFC 3339 format15351536      format: date-time15371538    - `session_thread_id: string`15391540      Public sthr_ ID of the thread that terminated.15411542  - `BetaManagedAgentsUserToolResultEvent object`15431544    Event sent by the client providing the result of an agent-toolset tool execution. Only valid on `self_hosted` environments, where sandbox-routed tools are executed by the client rather than the server.15451546    - `type: "user.tool_result"`15471548    - `id: string`15491550      Unique identifier for this event.15511552    - `tool_use_id: string`15531554      The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` [event's](https://platform.claude.com/docs/en/api/beta/sessions/events/list#beta_managed_agents_session_requires_action.event_ids) `stop_reason.event_ids` field.15551556    - `content: optional array of BetaManagedAgentsTextBlock or BetaManagedAgentsImageBlock or BetaManagedAgentsDocumentBlock or BetaManagedAgentsSearchResultBlock`15571558      The result content returned by the tool.15591560      - `BetaManagedAgentsTextBlock object`15611562        Regular text content.15631564      - `BetaManagedAgentsImageBlock object`15651566        Image content specified directly as base64 data or as a reference via a URL.15671568      - `BetaManagedAgentsDocumentBlock object`15691570        Document content, either specified directly as base64 data, as text, or as a reference via a URL.15711572      - `BetaManagedAgentsSearchResultBlock object`15731574        A block containing a web search result.15751576    - `is_error: optional boolean or null`15771578      Whether the tool execution resulted in an error.15791580    - `processed_at: optional string or null`15811582      A timestamp in RFC 3339 format15831584      format: date-time15851586    - `session_thread_id: optional string or null`15871588      Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.15891590  - `BetaManagedAgentsSessionThreadStatusRescheduledEvent object`15911592    A session thread hit a transient error and is retrying automatically. Emitted on the thread's own stream and cross-posted to the primary stream for child threads.15931594    - `type: "session.thread_status_rescheduled"`15951596    - `id: string`15971598      Unique identifier for this event.15991600    - `agent_name: string`16011602      Name of the agent the thread runs.16031604    - `processed_at: string`16051606      A timestamp in RFC 3339 format16071608      format: date-time16091610    - `session_thread_id: string`16111612      Public sthr_ ID of the thread that is retrying.16131614  - `BetaManagedAgentsSessionUpdatedEvent object`16151616    Emitted when an UpdateSession request changed at least one field. Carries only the fields that changed; absent fields were not part of the update. The new configuration applies from the next turn.16171618    - `type: "session.updated"`16191620    - `id: string`16211622      Unique identifier for this event.16231624    - `processed_at: string`16251626      A timestamp in RFC 3339 format16271628      format: date-time16291630    - `agent: optional BetaManagedAgentsSessionAgent or null`16311632      Resolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.16331634      - `type: "agent"`16351636      - `id: string`16371638      - `description: string or null`16391640      - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition`16411642        - `type: "url"`16431644        - `name: string`16451646        - `url: string`16471648      - `model: BetaManagedAgentsModelConfig`16491650        Model identifier and configuration.16511652        - `id: BetaManagedAgentsModel`16531654          The model that will power your agent.16551656          See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.16571658          - `"claude-fable-5-1" or "claude-sonnet-5" or "claude-fable-5" or 11 more`16591660            The model that will power your agent.16611662            See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.16631664            - `"claude-fable-5-1"`16651666              Frontier intelligence for ambitious tasks across coding, scientific discovery, and enterprise workflows16671668            - `"claude-sonnet-5"`16691670              High-performance model for coding and agents16711672            - `"claude-fable-5"`16731674              Next generation of intelligence for the hardest knowledge work and coding problems16751676            - `"claude-opus-5"`16771678              Powerful intelligence for long-running agents and coding16791680            - `"claude-opus-4-8"`16811682              Powerful intelligence for long-running agents and coding16831684            - `"claude-opus-4-7"`16851686              Powerful intelligence for long-running agents and coding16871688            - `"claude-opus-4-6"`16891690              Powerful intelligence for long-running agents and coding16911692            - `"claude-sonnet-4-6"`16931694              Best combination of speed and intelligence16951696            - `"claude-haiku-4-5"`16971698              Fastest model with near-frontier intelligence16991700            - `"claude-haiku-4-5-20251001"`17011702              Fastest model with near-frontier intelligence17031704            - `"claude-opus-4-5"`17051706              Powerful intelligence for long-running agents and coding17071708            - `"claude-opus-4-5-20251101"`17091710              Powerful intelligence for long-running agents and coding17111712            - `"claude-sonnet-4-5"`17131714              High-performance model for agents and coding17151716            - `"claude-sonnet-4-5-20250929"`17171718              High-performance model for agents and coding17191720          - `string`17211722        - `effort: optional BetaManagedAgentsEffortLow or BetaManagedAgentsEffortMedium or BetaManagedAgentsEffortHigh or 2 more`17231724          How hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes.17251726          - `BetaManagedAgentsEffortLow object`17271728            Low effort. Favors latency over reasoning depth.17291730            - `type: "low"`17311732          - `BetaManagedAgentsEffortMedium object`17331734            Medium effort. Balances latency and reasoning depth.17351736            - `type: "medium"`17371738          - `BetaManagedAgentsEffortHigh object`17391740            High effort. Favors reasoning depth.17411742            - `type: "high"`17431744          - `BetaManagedAgentsEffortXhigh object`17451746            Extra-high effort. Not all models accept this level.17471748            - `type: "xhigh"`17491750          - `BetaManagedAgentsEffortMax object`17511752            Maximum effort. Favors reasoning depth over latency.17531754            - `type: "max"`17551756        - `inference_geo: optional string`17571758          Geographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo.17591760        - `speed: optional "standard" or "fast"`17611762          Inference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.17631764          - `"standard"`17651766          - `"fast"`17671768      - `multiagent: BetaManagedAgentsSessionMultiagentCoordinator or null`17691770        Resolved coordinator topology with full agent definitions for each roster member.17711772        - `type: "coordinator"`17731774        - `agents: array of BetaManagedAgentsSessionThreadAgent or BetaManagedAgentsAdvisor`17751776          Full `agent` definitions the coordinator may spawn as session threads.17771778          - `BetaManagedAgentsSessionThreadAgent object`17791780            Resolved `agent` definition for a single `session_thread`. Snapshot of the agent at thread creation time. The multiagent roster is not repeated here; read it from `Session.agent`.17811782            - `type: "agent"`17831784            - `id: string`17851786            - `description: string or null`17871788            - `mcp_servers: array of BetaManagedAgentsMCPServerURLDefinition`17891790              - `type: "url"`17911792              - `name: string`17931794              - `url: string`17951796            - `model: BetaManagedAgentsModelConfig`17971798              Model identifier and configuration.17991800            - `name: string`18011802            - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill`18031804              - `BetaManagedAgentsAnthropicSkill object`18051806                A resolved Anthropic-managed skill.18071808                - `type: "anthropic"`18091810                - `skill_id: string`18111812                - `version: string`18131814              - `BetaManagedAgentsCustomSkill object`18151816                A resolved user-created custom skill.18171818                - `type: "custom"`18191820                - `skill_id: string`18211822                - `version: string`18231824            - `system: string or null`18251826            - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool`18271828              - `BetaManagedAgentsAgentToolset20260401 object`18291830                - `type: "agent_toolset_20260401"`18311832                - `configs: array of BetaManagedAgentsAgentToolConfig`18331834                  - `BetaManagedAgentsBashToolConfig object`18351836                    Configuration for the bash tool.18371838                    - `type: "bash"`18391840                    - `enabled: boolean`18411842                    - `name: "bash"`18431844                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`18451846                      Permission policy for tool execution.18471848                      - `BetaManagedAgentsAlwaysAllowPolicy object`18491850                        Tool calls are automatically approved without user confirmation.18511852                        - `type: "always_allow"`18531854                      - `BetaManagedAgentsAlwaysAskPolicy object`18551856                        Tool calls require user confirmation before execution.18571858                        - `type: "always_ask"`18591860                      - `BetaManagedAgentsAutoPolicy object`18611862                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.18631864                        - `type: "auto"`18651866                  - `BetaManagedAgentsEditToolConfig object`18671868                    Configuration for the edit tool.18691870                    - `type: "edit"`18711872                    - `enabled: boolean`18731874                    - `name: "edit"`18751876                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`18771878                      Permission policy for tool execution.18791880                      - `BetaManagedAgentsAlwaysAllowPolicy object`18811882                        Tool calls are automatically approved without user confirmation.18831884                      - `BetaManagedAgentsAlwaysAskPolicy object`18851886                        Tool calls require user confirmation before execution.18871888                      - `BetaManagedAgentsAutoPolicy object`18891890                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.18911892                  - `BetaManagedAgentsReadToolConfig object`18931894                    Configuration for the read tool.18951896                    - `type: "read"`18971898                    - `enabled: boolean`18991900                    - `name: "read"`19011902                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`19031904                      Permission policy for tool execution.19051906                      - `BetaManagedAgentsAlwaysAllowPolicy object`19071908                        Tool calls are automatically approved without user confirmation.19091910                      - `BetaManagedAgentsAlwaysAskPolicy object`19111912                        Tool calls require user confirmation before execution.19131914                      - `BetaManagedAgentsAutoPolicy object`19151916                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.19171918                  - `BetaManagedAgentsWriteToolConfig object`19191920                    Configuration for the write tool.19211922                    - `type: "write"`19231924                    - `enabled: boolean`19251926                    - `name: "write"`19271928                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`19291930                      Permission policy for tool execution.19311932                      - `BetaManagedAgentsAlwaysAllowPolicy object`19331934                        Tool calls are automatically approved without user confirmation.19351936                      - `BetaManagedAgentsAlwaysAskPolicy object`19371938                        Tool calls require user confirmation before execution.19391940                      - `BetaManagedAgentsAutoPolicy object`19411942                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.19431944                  - `BetaManagedAgentsGlobToolConfig object`19451946                    Configuration for the glob tool.19471948                    - `type: "glob"`19491950                    - `enabled: boolean`19511952                    - `name: "glob"`19531954                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`19551956                      Permission policy for tool execution.19571958                      - `BetaManagedAgentsAlwaysAllowPolicy object`19591960                        Tool calls are automatically approved without user confirmation.19611962                      - `BetaManagedAgentsAlwaysAskPolicy object`19631964                        Tool calls require user confirmation before execution.19651966                      - `BetaManagedAgentsAutoPolicy object`19671968                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.19691970                  - `BetaManagedAgentsGrepToolConfig object`19711972                    Configuration for the grep tool.19731974                    - `type: "grep"`19751976                    - `enabled: boolean`19771978                    - `name: "grep"`19791980                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`19811982                      Permission policy for tool execution.19831984                      - `BetaManagedAgentsAlwaysAllowPolicy object`19851986                        Tool calls are automatically approved without user confirmation.19871988                      - `BetaManagedAgentsAlwaysAskPolicy object`19891990                        Tool calls require user confirmation before execution.19911992                      - `BetaManagedAgentsAutoPolicy object`19931994                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.19951996                  - `BetaManagedAgentsWebFetchToolConfig object`19971998                    Configuration for the web_fetch tool.19992000                    - `type: "web_fetch"`20012002                    - `enabled: boolean`20032004                    - `name: "web_fetch"`20052006                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`20072008                      Permission policy for tool execution.20092010                      - `BetaManagedAgentsAlwaysAllowPolicy object`20112012                        Tool calls are automatically approved without user confirmation.20132014                      - `BetaManagedAgentsAlwaysAskPolicy object`20152016                        Tool calls require user confirmation before execution.20172018                      - `BetaManagedAgentsAutoPolicy object`20192020                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.20212022                    - `allowed_domains: optional array of string`20232024                    - `blocked_domains: optional array of string`20252026                    - `max_content_tokens: optional number or null`20272028                      format: int3220292030                  - `BetaManagedAgentsWebSearchToolConfig object`20312032                    Configuration for the web_search tool.20332034                    - `type: "web_search"`20352036                    - `enabled: boolean`20372038                    - `name: "web_search"`20392040                    - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`20412042                      Permission policy for tool execution.20432044                      - `BetaManagedAgentsAlwaysAllowPolicy object`20452046                        Tool calls are automatically approved without user confirmation.20472048                      - `BetaManagedAgentsAlwaysAskPolicy object`20492050                        Tool calls require user confirmation before execution.20512052                      - `BetaManagedAgentsAutoPolicy object`20532054                        The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.20552056                    - `allowed_domains: optional array of string`20572058                    - `blocked_domains: optional array of string`20592060                    - `user_location: optional BetaManagedAgentsUserLocation or null`20612062                      Approximate user location for search result localization.20632064                      - `type: "approximate"`20652066                        Location precision. Only "approximate" is supported.20672068                      - `city: optional string or null`20692070                        City name.20712072                        minLength: 1, maxLength: 25520732074                      - `country: optional string or null`20752076                        Two-letter ISO 3166-1 country code, uppercase.20772078                      - `region: optional string or null`20792080                        Region or state name.20812082                        minLength: 1, maxLength: 25520832084                      - `timezone: optional string or null`20852086                        IANA timezone identifier, e.g. "America/Los_Angeles".20872088                        minLength: 1, maxLength: 25520892090                - `default_config: BetaManagedAgentsAgentToolsetDefaultConfig`20912092                  Resolved default configuration for agent tools.20932094                  - `enabled: boolean`20952096                  - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`20972098                    Permission policy for tool execution.20992100                    - `BetaManagedAgentsAlwaysAllowPolicy object`21012102                      Tool calls are automatically approved without user confirmation.21032104                    - `BetaManagedAgentsAlwaysAskPolicy object`21052106                      Tool calls require user confirmation before execution.21072108                    - `BetaManagedAgentsAutoPolicy object`21092110                      The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.21112112              - `BetaManagedAgentsMCPToolset object`21132114                - `type: "mcp_toolset"`21152116                - `configs: array of BetaManagedAgentsMCPToolConfig`21172118                  - `enabled: boolean`21192120                  - `name: string`21212122                  - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`21232124                    Permission policy for tool execution.21252126                    - `BetaManagedAgentsAlwaysAllowPolicy object`21272128                      Tool calls are automatically approved without user confirmation.21292130                    - `BetaManagedAgentsAlwaysAskPolicy object`21312132                      Tool calls require user confirmation before execution.21332134                    - `BetaManagedAgentsAutoPolicy object`21352136                      The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.21372138                - `default_config: BetaManagedAgentsMCPToolsetDefaultConfig`21392140                  Resolved default configuration for all tools from an MCP server.21412142                  - `enabled: boolean`21432144                  - `permission_policy: BetaManagedAgentsAlwaysAllowPolicy or BetaManagedAgentsAlwaysAskPolicy or BetaManagedAgentsAutoPolicy`21452146                    Permission policy for tool execution.21472148                    - `BetaManagedAgentsAlwaysAllowPolicy object`21492150                      Tool calls are automatically approved without user confirmation.21512152                    - `BetaManagedAgentsAlwaysAskPolicy object`21532154                      Tool calls require user confirmation before execution.21552156                    - `BetaManagedAgentsAutoPolicy object`21572158                      The server decides each tool call individually: it judges, from the tool, its input, and the session content so far, whether the call is safe to execute or high-risk, and evaluates it to allow when judged safe and to deny when judged high-risk. A call the server cannot reach a judgement on evaluates to ask.21592160                - `mcp_server_name: string`21612162              - `BetaManagedAgentsCustomTool object`21632164                A custom tool as returned in API responses.21652166                - `type: "custom"`21672168                - `description: string`21692170                - `input_schema: BetaManagedAgentsCustomToolInputSchema`21712172                  JSON Schema for custom tool input parameters.21732174                  - `type: "object"`21752176                  - `properties: optional map[unknown] or null`21772178                  - `required: optional array of string or null`21792180                - `name: string`21812182            - `version: number`21832184              format: int3221852186          - `BetaManagedAgentsAdvisor object`21872188            Platform advisor roster entry: a model the session's primary thread may consult mid-turn.21892190            - `type: "advisor"`21912192            - `model: string`21932194              The advisor model id.21952196      - `name: string`21972198      - `skills: array of BetaManagedAgentsAnthropicSkill or BetaManagedAgentsCustomSkill`21992200        - `BetaManagedAgentsAnthropicSkill object`22012202          A resolved Anthropic-managed skill.22032204        - `BetaManagedAgentsCustomSkill object`22052206          A resolved user-created custom skill.22072208      - `system: string or null`22092210      - `tools: array of BetaManagedAgentsAgentToolset20260401 or BetaManagedAgentsMCPToolset or BetaManagedAgentsCustomTool`22112212        - `BetaManagedAgentsAgentToolset20260401 object`22132214        - `BetaManagedAgentsMCPToolset object`22152216        - `BetaManagedAgentsCustomTool object`22172218          A custom tool as returned in API responses.22192220      - `version: number`22212222        format: int3222232224    - `budget: optional BetaManagedAgentsBudgetLimit or null`22252226      A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.22272228      - `type: "limit"`22292230      - `max_list_cost: BetaMonetaryAmount`22312232        A monetary amount in a specific currency.22332234        - `amount: string`22352236          Amount in minor units of the currency, as an integer decimal string with no leading zeros: "2500" is $25.00 and "50" is fifty cents. A string rather than a number so no float rounding is ever applied.22372238        - `currency: BetaCurrency`22392240          Uppercase ISO-4217 currency code. `USD` is the only currency currently supported; the accepted set is closed and grows only when a new currency is priced.22412242    - `metadata: optional map[string]`22432244      The session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.22452246    - `title: optional string or null`22472248      The session's new title. Present only when the update changed it.22492250  - `BetaManagedAgentsStartEvent object`22512252    Opens a preview of a buffered event. Carries the previewed event's type and id only. Followed by zero or more event_delta events with the same event id, normally concluded by the buffered event carrying that id. If the producing model request ends without that event (an error or interrupt mid-stream), its terminal span.model_request_end closes the preview. Only sent on stream connections that opt in via event_deltas; never appears in event history.22532254    - `type: "event_start"`22552256    - `event: BetaManagedAgentsStartEventPreview`22572258      The previewed event's type and id. The event type determines which delta types the preview's event_delta events carry: agent.message events stream content_delta fragments; agent.thinking previews are start-only — no deltas follow, and the buffered agent.thinking with the same id concludes them.22592260      - `BetaManagedAgentsAgentMessagePreview object`22612262        - `type: "agent.message"`22632264        - `id: string`22652266          The id the buffered agent.message will carry if it is emitted. Matches the event_id on this preview's event_delta events.22672268      - `BetaManagedAgentsAgentThinkingPreview object`22692270        - `type: "agent.thinking"`22712272        - `id: string`22732274          The id the buffered agent.thinking will carry if it is emitted. Start-only — no event_delta events follow.22752276  - `BetaManagedAgentsDeltaEvent object`22772278    An incremental update to an event that is still being streamed. Deltas are best-effort and may stop early; when the buffered event with id == event_id is produced it carries the complete content. A model request that ends early (an error or interrupt) produces no buffered event — its terminal span.model_request_end closes the preview. Only sent on stream connections that opt in via event_deltas; never appears in event history.22792280    - `type: "event_delta"`22812282    - `delta: BetaManagedAgentsDeltaContent`22832284      One fragment of the previewed event. The delta type is named for the previewed event's field it streams into: agent.message events stream content_delta fragments, each a partial element of the content array.22852286      - `type: "content_delta"`22872288      - `content: BetaManagedAgentsTextBlock`22892290        Regular text content.22912292      - `index: optional number`22932294        Which entry in the previewed event's content array this fragment lands in. Insert content as that entry when the index is new; append to the existing entry otherwise.22952296        format: uint3222972298    - `event_id: string`22992300      The id of the event being previewed. Matches event.id on the corresponding event_start and the buffered event that reconciles the preview.23012302  - `BetaManagedAgentsSystemMessageEvent object`23032304    A mid-conversation system message event. Carries system-role content that is appended to the session as a `role: "system"` turn.23052306    - `type: "system.message"`23072308    - `id: string`23092310      Unique identifier for this event.23112312    - `content: array of BetaManagedAgentsSystemContentBlock`23132314      System content blocks. Text-only.23152316      - `type: "text"`23172318      - `text: string`23192320        The text content.23212322        minLength: 123232324    - `processed_at: optional string or null`23252326      A timestamp in RFC 3339 format23272328      format: date-time23292330  - `BetaManagedAgentsSessionUsageEvent object`23312332    Periodic snapshot of the session's cumulative usage and tracked list cost.23332334    - `type: "session.usage"`23352336    - `id: string`23372338      Unique identifier for this event.23392340    - `processed_at: string`23412342      A timestamp in RFC 3339 format23432344      format: date-time23452346    - `usage: BetaManagedAgentsSessionUsageSnapshot`23472348      Point-in-time snapshot of a session's cumulative usage.23492350      - `active_seconds: optional number`23512352        Cumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once. This is the duration the session's runtime cost is priced on.23532354        format: double23552356      - `cache_creation: optional BetaManagedAgentsCacheCreationUsage`23572358        Prompt-cache creation token usage broken down by cache lifetime.23592360        - `ephemeral_1h_input_tokens: optional number`23612362          Tokens used to create 1-hour ephemeral cache entries.23632364          format: int3223652366        - `ephemeral_5m_input_tokens: optional number`23672368          Tokens used to create 5-minute ephemeral cache entries.23692370          format: int3223712372      - `cache_read_input_tokens: optional number`23732374        Total tokens read from prompt cache.23752376        format: int3223772378      - `input_tokens: optional number`23792380        Total input tokens consumed across all turns.23812382        format: int3223832384      - `list_cost: optional BetaMonetaryAmount`23852386        A monetary amount in a specific currency.23872388      - `output_tokens: optional number`23892390        Total output tokens generated across all turns.23912392        format: int3223932394      - `server_tool_use: optional BetaManagedAgentsServerToolUsage`23952396        Cumulative count of server-executed tool invocations, broken down by tool.23972398        - `web_fetch_requests: optional number`23992400          Number of server-executed web fetch requests.24012402          format: int3224032404        - `web_search_requests: optional number`24052406          Number of server-executed web search requests.24072408          format: int3224092410    - `budget: optional BetaManagedAgentsBudgetLimit or null`24112412      A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.24132414## Example24152416```bash2417curl https://api.anthropic.com/v1/sessions/$SESSION_ID/events/stream \2418    -H 'anthropic-version: 2023-06-01' \2419    -H 'anthropic-beta: managed-agents-2026-04-01' \2420    -H "X-Api-Key: $ANTHROPIC_API_KEY"2421```24222423### Response (200)24242425```json2426{2427  "id": "sevt_011CZkZGOp0iBcp4kaQSihUmy",2428  "content": [2429    {2430      "text": "Where is my order #1234?",2431      "type": "text"2432    }2433  ],2434  "type": "user.message",2435  "processed_at": "2026-03-15T10:00:00Z"2436}2437```2438
Files main
Menu

Theme