Events
List Events
$client->beta->sessions->events->list(string sessionID, ?\Datetime createdAtGt, ?\Datetime createdAtGte, ?\Datetime createdAtLt, ?\Datetime createdAtLte, ?int limit, ?Order order, ?string page, ?list<ManagedAgentsSessionEventType> types, ?list<AnthropicBeta> betas, ?string workspaceID): PageCursor<ManagedAgentsSessionEvent>Send Events
$client->beta->sessions->events->send(string sessionID, list<ManagedAgentsEventParams> events, ?list<AnthropicBeta> betas, ?string workspaceID): ManagedAgentsSendSessionEventsStream Events
$client->beta->sessions->events->streamStream(string sessionID, ?list<BetaManagedAgentsDeltaType> eventDeltas, ?list<AnthropicBeta> betas, ?string workspaceID): BaseStream<ManagedAgentsStreamSessionEvents>Models
class ManagedAgentsAgentAutoEvaluatedPermissionAllow { $type = 'allow'; }
class ManagedAgentsAgentAutoEvaluatedPermissionAsk { $type = 'ask'; $reasonCode; }
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.
class ManagedAgentsAgentAutoEvaluatedPermissionDeny { $type = 'deny'; $reasonCode; }
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.
class ManagedAgentsAgentAutoEvaluatedPermissionAllow { $type = 'allow'; }
class ManagedAgentsAgentAutoEvaluatedPermissionAsk { $type = 'ask'; $reasonCode; }
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.
class ManagedAgentsAgentAutoEvaluatedPermissionDeny { $type = 'deny'; $reasonCode; }
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.
class ManagedAgentsAgentCustomToolUseEvent { $type; $id; $input; /* 3 more */ }
Unique identifier for this event.
Input parameters for the tool call.
Name of the custom tool being called.
Timestamp when this tool use was processed.
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.
class ManagedAgentsAgentMCPToolResultEvent { $type; $id; $mcpToolUseID; /* 3 more */ }
Unique identifier for this event.
The id of the agent.mcp_tool_use event this result corresponds to.
Timestamp when this event was processed.
The result content returned by the tool.
Whether the tool execution resulted in an error.
class ManagedAgentsAgentMCPToolUseEvent { $type; $id; $input; /* 6 more */ }
Unique identifier for this event.
Input parameters for the tool call.
Name of the MCP server providing the tool.
Name of the MCP tool being used.
Timestamp when this event was processed.
The evaluated permission policy for this tool invocation.
Which resolved permission_policy produced evaluated_permission: always_allow, always_ask, or auto (with the server's per-invocation judgement). Absent only when the server refused the call before any policy applied (for example, the named tool is not enabled in the session); such a refusal has evaluated_permission deny. An event recorded before this field existed reads as the arm its evaluated_permission implies (always_allow for allow, always_ask for ask).
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.
class ManagedAgentsAgentMessageEvent { $type; $id; $content; $processedAt; }
Unique identifier for this event.
Array of text blocks comprising the agent response.
Timestamp when this response was generated.
class ManagedAgentsAgentThinkingEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp when this thinking was produced.
class ManagedAgentsAgentThreadContextCompactedEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp when compaction was processed.
class ManagedAgentsAgentThreadMessageReceivedEvent { $type; $id; $content; /* 3 more */ }
Unique identifier for this event.
Message content blocks.
Public sthr_ ID of the thread that sent the message.
Timestamp when the message was received.
Name of the callable agent this message came from. Absent when received from the primary agent.
class ManagedAgentsAgentThreadMessageSentEvent { $type; $id; $content; /* 3 more */ }
Unique identifier for this event.
Message content blocks.
Timestamp when the message was sent.
Public sthr_ ID of the thread the message was sent to.
Name of the callable agent this message was sent to. Absent when sent to the primary agent.
class ManagedAgentsAgentToolEvaluationAlwaysAllow { $type = 'always_allow'; }
class ManagedAgentsAgentToolEvaluationAlwaysAsk { $type = 'always_ask'; }
class ManagedAgentsAgentToolEvaluationAuto { $type = 'auto'; $evaluatedPermission; }
The server's judgement for this invocation.
class ManagedAgentsAgentToolEvaluationAlwaysAllow { $type = 'always_allow'; }
class ManagedAgentsAgentToolEvaluationAlwaysAsk { $type = 'always_ask'; }
class ManagedAgentsAgentToolEvaluationAuto { $type = 'auto'; $evaluatedPermission; }
The server's judgement for this invocation.
class ManagedAgentsAgentToolResultEvent { $type; $id; $processedAt; /* 3 more */ }
Unique identifier for this event.
Timestamp when this event was processed.
The id of the agent.tool_use event this result corresponds to.
The result content returned by the tool.
Whether the tool execution resulted in an error.
class ManagedAgentsAgentToolUseEvent { $type; $id; $input; /* 5 more */ }
Unique identifier for this event.
Input parameters for the tool call.
Name of the agent tool being used.
Timestamp when this event was processed.
The evaluated permission policy for this tool invocation.
Which resolved permission_policy produced evaluated_permission: always_allow, always_ask, or auto (with the server's per-invocation judgement). Absent only when the server refused the call before any policy applied (for example, the named tool is not enabled in the session); such a refusal has evaluated_permission deny. An event recorded before this field existed reads as the arm its evaluated_permission implies (always_allow for allow, always_ask for ask).
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.
class ManagedAgentsBase64DocumentSource { $type; $data; $mediaType; }
Base64-encoded document data.
MIME type of the document (e.g., "application/pdf").
class ManagedAgentsBase64ImageSource { $type; $data; $mediaType; }
Base64-encoded image data.
MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").
class ManagedAgentsBillingError { $type; $message; $retryStatus; }
Human-readable error description.
What the client should do next.
class ManagedAgentsCredentialHostUnreachableError { $type; $credentialID; $message; /* 2 more */ }
ID of the affected credential.
Human-readable error description.
What the client should do next.
ID of the vault containing the affected credential.
class ManagedAgentsDocumentBlock { $type; $source; $context; $title; }
The source of the document data.
Additional context about the document for the model.
The title of the document.
class ManagedAgentsEventParams
class ManagedAgentsFileDocumentSource { $type; $fileID; }
ID of a previously uploaded file.
class ManagedAgentsFileImageSource { $type; $fileID; }
ID of a previously uploaded file.
class ManagedAgentsFileRubric { $type; $fileID; }
ID of the rubric file.
class ManagedAgentsFileRubricParams { $type; $fileID; }
ID of the rubric file.
class ManagedAgentsImageBlock { $type; $source; }
The source of the image data.
class ManagedAgentsMaxWorkflowRunsWorkflowRunError { $type = 'max_workflow_runs_error'; $message; }
Short explanation written by the server. It never contains content from the run or its agents.
class ManagedAgentsMCPAuthenticationFailedError { $type; $mcpServerName; $message; $retryStatus; }
Name of the MCP server that failed authentication.
Human-readable error description.
What the client should do next.
class ManagedAgentsMCPConnectionFailedError { $type; $mcpServerName; $message; $retryStatus; }
Name of the MCP server that failed to connect.
Human-readable error description.
What the client should do next.
class ManagedAgentsModelOverloadedError { $type; $message; $retryStatus; }
Human-readable error description.
What the client should do next.
class ManagedAgentsModelRateLimitedError { $type; $message; $retryStatus; }
Human-readable error description.
What the client should do next.
class ManagedAgentsModelRequestFailedError { $type; $message; $retryStatus; }
Human-readable error description.
What the client should do next.
class ManagedAgentsPlainTextDocumentSource { $type; $data; $mediaType; }
The plain text content.
MIME type of the text content. Must be "text/plain".
class ManagedAgentsProgramWorkflowRunError { $type = 'program_error'; $message; }
Short explanation written by the server. It never contains content from the run or its agents.
class ManagedAgentsRedactedBlock { $type; }
class ManagedAgentsRepositoryAuthenticationError { $type = 'repository_authentication_error'; $message; $repositoryURL; $retryStatus; }
Human-readable error description.
URL of the repository that could not be cloned. Null when it could not be identified.
What the client should do next. Always retrying: the session keeps running without the repository.
class ManagedAgentsRepositoryCheckoutError { $type = 'repository_checkout_error'; $message; $repositoryURL; $retryStatus; }
Human-readable error description.
URL of the repository that could not be cloned. Null when it could not be identified.
What the client should do next. Always retrying: the session keeps running without the repository.
class ManagedAgentsRepositoryCloneError { $type = 'repository_clone_error'; $message; $repositoryURL; $retryStatus; }
Human-readable error description.
URL of the repository that could not be cloned. Null when it could not be identified.
What the client should do next. Always retrying: the session keeps running without the repository.
class ManagedAgentsRepositoryForbiddenError { $type = 'repository_forbidden_error'; $message; $repositoryURL; $retryStatus; }
Human-readable error description.
URL of the repository that could not be cloned. Null when it could not be identified.
What the client should do next. Always retrying: the session keeps running without the repository.
class ManagedAgentsRepositoryNotFoundError { $type = 'repository_not_found_error'; $message; $repositoryURL; $retryStatus; }
Human-readable error description.
URL of the repository that could not be cloned. Null when it could not be identified.
What the client should do next. Always retrying: the session keeps running without the repository.
class ManagedAgentsRetryStatusExhausted { $type; }
class ManagedAgentsRetryStatusRetrying { $type; }
class ManagedAgentsRetryStatusTerminal { $type; }
class ManagedAgentsSearchResultBlock { $type; $citations; $content; /* 2 more */ }
Citation settings for this search result.
Array of text content blocks from the search result.
The URL source of the search result.
The title of the search result.
class ManagedAgentsSearchResultCitations { $enabled; }
Whether citations are enabled for this search result.
class ManagedAgentsSearchResultContent { $type; $text; }
The text content.
class ManagedAgentsSendSessionEvents { $data; }
Sent events
class ManagedAgentsSessionBudgetReached { $type; }
class ManagedAgentsSessionDeletedEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp when the session was deleted.
class ManagedAgentsSessionEndTurn { $type; }
class ManagedAgentsSessionErrorEvent { $type; $id; $error; $processedAt; }
Unique identifier for this event.
Timestamp when the error occurred.
class ManagedAgentsSessionRefusal { $type = 'refusal'; }
class ManagedAgentsSessionRefusalStopDetails { $type = 'refusal'; $category; $explanation; }
The policy category that triggered the refusal, or null when there is no named category. New values can be added over time.
Human-readable explanation of the refusal, or null when none is available. The wording can change, so do not parse it.
class ManagedAgentsSessionRequiresAction { $type; $eventIDs; }
The ids of events the agent is blocked on. Resolving fewer than all re-emits session.status_idle with the remainder.
class ManagedAgentsSessionRetriesExhausted { $type; }
class ManagedAgentsSessionStatusIdleEvent { $type; $id; $processedAt; /* 2 more */ }
Unique identifier for this event.
Timestamp of status change.
Structured information about why the session stopped. null when there is nothing more to report.
class ManagedAgentsSessionStatusRescheduledEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp of status change.
class ManagedAgentsSessionStatusRunningEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp of status change.
class ManagedAgentsSessionStatusTerminatedEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp of status change.
class ManagedAgentsSessionThreadCreatedEvent { $type; $id; $agentName; /* 3 more */ }
Unique identifier for this event.
Name of the callable agent the thread runs.
Timestamp when the thread was created.
Public sthr_ ID of the newly created thread.
Identifier of the workflow run that created the thread, or null for any other thread.
class ManagedAgentsSessionThreadStatusIdleEvent { $type; $id; $agentName; /* 4 more */ }
Unique identifier for this event.
Name of the agent the thread runs.
Timestamp of the status transition.
Public sthr_ ID of the thread that went idle.
Structured information about why the thread stopped. null when there is nothing more to report.
class ManagedAgentsSessionThreadStatusRescheduledEvent { $type; $id; $agentName; /* 2 more */ }
Unique identifier for this event.
Name of the agent the thread runs.
Timestamp of the status transition.
Public sthr_ ID of the thread that is retrying.
class ManagedAgentsSessionThreadStatusRunningEvent { $type; $id; $agentName; /* 2 more */ }
Unique identifier for this event.
Name of the agent the thread runs.
Timestamp of the status transition.
Public sthr_ ID of the thread that started running.
class ManagedAgentsSessionThreadStatusTerminatedEvent { $type; $id; $agentName; /* 2 more */ }
Unique identifier for this event.
Name of the agent the thread runs.
Timestamp of the status transition.
Public sthr_ ID of the thread that terminated.
class ManagedAgentsSessionUsageSnapshot { $activeSeconds; $cacheCreation; $cacheReadInputTokens; /* 4 more */ }
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.
Tokens used to create prompt cache entries, broken down by cache TTL.
Total tokens read from prompt cache.
Total input tokens consumed across all turns.
Cumulative list cost of the session across all turns, priced at public list rates.
Total output tokens generated across all turns.
Cumulative server-executed tool usage across all turns.
class ManagedAgentsSpanModelRequestEndEvent { $type; $id; $isError; /* 3 more */ }
Unique identifier for this event.
Whether the model request resulted in an error.
The id of the corresponding span.model_request_start event.
Token usage for this model request.
Timestamp when the model request completed.
class ManagedAgentsSpanModelRequestStartEvent { $type; $id; $processedAt; }
Unique identifier for this event.
Timestamp when the model request started.
class ManagedAgentsSpanModelUsage { $cacheCreationInputTokens; $cacheReadInputTokens; $inputTokens; /* 2 more */ }
Tokens used to create prompt cache in this request.
Tokens read from prompt cache in this request.
Input tokens consumed by this request.
Output tokens generated by this request.
Inference speed tier this request actually ran at. Mirrors usage.speed on /v1/messages. Only present when the fast-mode beta is active.
class ManagedAgentsSpanOutcomeEvaluationEndEvent { $type; $id; $explanation; /* 6 more */ }
Unique identifier for this event.
Human-readable explanation of the verdict. For needs_revision, describes which criteria failed and why.
0-indexed revision cycle, matching the corresponding span.outcome_evaluation_start.
The id of the corresponding span.outcome_evaluation_start event.
The outc_ ID of the outcome being evaluated.
Timestamp when outcome evaluation ended.
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.
Aggregate token usage for this evaluation cycle. Sums across all grader model requests within the cycle.
class ManagedAgentsSpanOutcomeEvaluationOngoingEvent { $type; $id; $iteration; /* 2 more */ }
Unique identifier for this event.
0-indexed revision cycle, matching the corresponding span.outcome_evaluation_start.
The outc_ ID of the outcome being evaluated.
Timestamp when this heartbeat was emitted.
class ManagedAgentsSpanOutcomeEvaluationStartEvent { $type; $id; $iteration; /* 2 more */ }
Unique identifier for this event.
0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.
The outc_ ID of the outcome being evaluated.
Timestamp when outcome evaluation started.
class ManagedAgentsSystemMessageEventParams { $type; $content; }
System content blocks to append. Text-only.
class ManagedAgentsTextBlock { $type; $text; }
The text content.
class ManagedAgentsTextRubric { $type; $content; }
Rubric content. Plain text or markdown — the grader treats it as freeform text.
class ManagedAgentsTextRubricParams { $type; $content; }
Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters.
class ManagedAgentsThreadLimitWorkflowRunError { $type = 'thread_limit_error'; $message; }
Short explanation written by the server. It never contains content from the run or its agents.
class ManagedAgentsTimeoutWorkflowRunError { $type = 'timeout_error'; $message; }
Short explanation written by the server. It never contains content from the run or its agents.
class ManagedAgentsUnknownError { $type; $message; $retryStatus; }
Human-readable error description.
What the client should do next.
class ManagedAgentsUnknownWorkflowRunError { $type = 'unknown_error'; $message; }
Short explanation written by the server. It never contains content from the run or its agents.
class ManagedAgentsURLDocumentSource { $type; $url; }
URL of the document to fetch.
class ManagedAgentsURLImageSource { $type; $url; }
URL of the image to fetch.
class ManagedAgentsUserCustomToolResultEvent { $type; $id; $customToolUseID; /* 4 more */ }
Unique identifier for this event.
The id of the agent.custom_tool_use event this result corresponds to. It is also listed in the last session.status_idle event's stop_reason.event_ids field.
The result content returned by the tool.
Whether the tool execution resulted in an error.
Timestamp when this result was processed.
Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.
class ManagedAgentsUserCustomToolResultEventParams { $type; $customToolUseID; $content; $isError; }
The id of the agent.custom_tool_use event this result corresponds to. It is also listed in the last session.status_idle event's stop_reason.event_ids field.
The result content returned by the tool.
Whether the tool execution resulted in an error.
class ManagedAgentsUserDefineOutcomeEvent { $type; $id; $description; /* 4 more */ }
Unique identifier for this event.
What the agent should produce. Copied from the input event.
Evaluate-then-revise cycles before giving up. Default 3, max 20.
Server-generated outc_ ID for this outcome. Referenced by span.outcome_evaluation_* events and the session's outcome_evaluations list.
Timestamp when the outcome was accepted.
How to grade the outcome. File rubrics are currently resolved to their text content; clients should handle both variants.
class ManagedAgentsUserDefineOutcomeEventParams { $type; $description; $rubric; $maxIterations; }
What the agent should produce. This is the task specification.
How to grade the outcome. Text or file reference.
Eval→revision cycles before giving up. Default 3, max 20.
class ManagedAgentsUserInterruptEvent { $type; $id; $processedAt; $sessionThreadID; }
Unique identifier for this event.
Timestamp when the interrupt was processed.
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.
class ManagedAgentsUserInterruptEventParams { $type; $sessionThreadID; }
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.
class ManagedAgentsUserMessageEvent { $type; $id; $content; $processedAt; }
Unique identifier for this event.
Array of content blocks comprising the user message.
Timestamp when the agent finished processing this message.
class ManagedAgentsUserMessageEventParams { $type; $content; }
Array of content blocks for the user message.
class ManagedAgentsUserToolConfirmationEvent { $type; $id; $result; /* 4 more */ }
Unique identifier for this event.
The confirmation result: 'allow' or 'deny'.
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 stop_reason.event_ids field.
Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.
Timestamp when the confirmation was processed.
Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread.
class ManagedAgentsUserToolConfirmationEventParams { $type; $result; $toolUseID; $denyMessage; }
The confirmation result: 'allow' or 'deny'.
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 stop_reason.event_ids field.
Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.
class ManagedAgentsUserToolResultEventParams { $type; $toolUseID; $content; $isError; }
The id of the agent.tool_use event this result corresponds to, which can be found in the last session.status_idle event's stop_reason.event_ids field.
The result content returned by the tool.
Whether the tool execution resulted in an error.
class ManagedAgentsWorkflowRunCreatedEvent { $type = 'workflow_run.created'; $id; $description; /* 4 more */ }
Unique identifier for this event.
Description that the agent gave the run, passed on as written, or null if it gave none.
Name that the agent gave the run, passed on as written, or a name that the server assigned.
The phases that the run's plan declares, in the plan's order. Can be empty.
Timestamp when this event was processed.
Identifier of the run. The same value is on all of the run's workflow_run.* events.
class ManagedAgentsWorkflowRunErrorEvent { $type = 'workflow_run.error'; $id; $error; /* 2 more */ }
Unique identifier for this event.
Why the run did not finish, or was not created.
Timestamp when this event was processed.
Identifier of the run that met the error, or null when the error kept a run from being created.
class ManagedAgentsWorkflowRunPhase { $id; $description; $name; }
Unique identifier for the phase.
Description that the agent gave the phase, passed on as written, or null if it gave none.
Name that the agent gave the phase, passed on as written.
class ManagedAgentsWorkflowRunPhaseEndedEvent { $type = 'workflow_run.phase_ended'; $id; $phaseStartedID; /* 3 more */ }
Unique identifier for this event.
Identifier of the workflow_run.phase_started event that opened the phase.
Timestamp when this event was processed.
Identifier of the run. The same value is on all of the run's workflow_run.* events.
Identifier of the phase, as in phases on the run's workflow_run.created event.
class ManagedAgentsWorkflowRunPhaseStartedEvent { $type = 'workflow_run.phase_started'; $id; $processedAt; /* 2 more */ }
Unique identifier for this event.
Timestamp when this event was processed.
Identifier of the run. The same value is on all of the run's workflow_run.* events.
Identifier of the phase, as in phases on the run's workflow_run.created event.
class ManagedAgentsWorkflowRunResultCompleted { $type = 'completed'; }
class ManagedAgentsWorkflowRunResultError { $type = 'error'; $error; }
Why the run did not finish.
class ManagedAgentsWorkflowRunResultStopped { $type = 'stopped'; }
class ManagedAgentsWorkflowRunResultCompleted { $type = 'completed'; }
class ManagedAgentsWorkflowRunResultError { $type = 'error'; $error; }
Why the run did not finish.
class ManagedAgentsWorkflowRunResultStopped { $type = 'stopped'; }
class ManagedAgentsWorkflowRunStatusEndedEvent { $type = 'workflow_run.status_ended'; $id; $processedAt; /* 2 more */ }
Unique identifier for this event.
Timestamp when this event was processed.
How the run ended.
Identifier of the run. The same value is on all of the run's workflow_run.* events.
class ManagedAgentsWorkflowRunStatusIdleEvent { $type = 'workflow_run.status_idle'; $id; $processedAt; $workflowRunID; }
Unique identifier for this event.
Timestamp when this event was processed.
Identifier of the run. The same value is on all of the run's workflow_run.* events.
class ManagedAgentsWorkflowRunStatusRunningEvent { $type = 'workflow_run.status_running'; $id; $processedAt; $workflowRunID; }
Unique identifier for this event.
Timestamp when this event was processed.
Identifier of the run. The same value is on all of the run's workflow_run.* events.