Claude Platform Docs

Eventi

Elenca gli eventi
$client->beta->sessions->events->list(string sessionID, ?\Datetime createdAtGt, ?\Datetime createdAtGte, ?\Datetime createdAtLt, ?\Datetime createdAtLte, ?int limit, ?Order order, ?string page, ?list<string> types, ?list<AnthropicBeta> betas, ?string workspaceID): PageCursor<ManagedAgentsSessionEvent>
GET/v1/sessions/{session_id}/events
Invia eventi
$client->beta->sessions->events->send(string sessionID, list<ManagedAgentsEventParams> events, ?list<AnthropicBeta> betas, ?string workspaceID): ManagedAgentsSendSessionEvents
POST/v1/sessions/{session_id}/events
Trasmetti eventi in streaming
$client->beta->sessions->events->stream(string sessionID, ?list<BetaManagedAgentsDeltaType> eventDeltas, ?list<AnthropicBeta> betas, ?string workspaceID): ManagedAgentsStreamSessionEvents
GET/v1/sessions/{session_id}/events/stream
Models
One of the following:
class ManagedAgentsAgentAutoEvaluatedPermissionAllow { $type = 'allow'; }
"allow" type
class ManagedAgentsAgentAutoEvaluatedPermissionAsk { $type = 'ask'; $reasonCode; }
"ask" type
string 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; }
"deny" type
string 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'; }
"allow" type
class ManagedAgentsAgentAutoEvaluatedPermissionAsk { $type = 'ask'; $reasonCode; }
"ask" type
string 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; }
"deny" type
string 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 */ }
Type type
string id

Unique identifier for this event.

array<string,mixed> input

Input parameters for the tool call.

string name

Name of the custom tool being called.

\Datetime processedAt

A timestamp in RFC 3339 format

?string sessionThreadID

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 */ }
Type type
string id

Unique identifier for this event.

string mcpToolUseID

The id of the agent.mcp_tool_use event this result corresponds to.

\Datetime processedAt

A timestamp in RFC 3339 format

?list<Content> content

The result content returned by the tool.

?bool isError

Whether the tool execution resulted in an error.

class ManagedAgentsAgentMCPToolUseEvent { $type; $id; $input; /* 6 more */ }
Type type
string id

Unique identifier for this event.

array<string,mixed> input

Input parameters for the tool call.

string mcpServerName

Name of the MCP server providing the tool.

string name

Name of the MCP tool being used.

\Datetime processedAt

A timestamp in RFC 3339 format

?EvaluatedPermission evaluatedPermission

AgentEvaluatedPermission enum

Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.

?string sessionThreadID

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; }
Type type
string id

Unique identifier for this event.

list<Content> content

Array of text blocks comprising the agent response.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsAgentThinkingEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsAgentThreadContextCompactedEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsAgentThreadMessageReceivedEvent { $type; $id; $content; /* 3 more */ }
Type type
string id

Unique identifier for this event.

list<Content> content

Message content blocks.

string fromSessionThreadID

Public sthr_ ID of the thread that sent the message.

\Datetime processedAt

A timestamp in RFC 3339 format

?string fromAgentName

Name of the callable agent this message came from. Absent when received from the primary agent.

class ManagedAgentsAgentThreadMessageSentEvent { $type; $id; $content; /* 3 more */ }
Type type
string id

Unique identifier for this event.

list<Content> content

Message content blocks.

\Datetime processedAt

A timestamp in RFC 3339 format

string toSessionThreadID

Public sthr_ ID of the thread the message was sent to.

?string toAgentName

Name of the callable agent this message was sent to. Absent when sent to the primary agent.

One of the following:
class ManagedAgentsAgentToolEvaluationAlwaysAllow { $type = 'always_allow'; }
"always_allow" type
class ManagedAgentsAgentToolEvaluationAlwaysAsk { $type = 'always_ask'; }
"always_ask" type
class ManagedAgentsAgentToolEvaluationAuto { $type = 'auto'; $evaluatedPermission; }
"auto" type

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.

class ManagedAgentsAgentToolEvaluationAlwaysAllow { $type = 'always_allow'; }
"always_allow" type
class ManagedAgentsAgentToolEvaluationAlwaysAsk { $type = 'always_ask'; }
"always_ask" type
class ManagedAgentsAgentToolEvaluationAuto { $type = 'auto'; $evaluatedPermission; }
"auto" type

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.

class ManagedAgentsAgentToolResultEvent { $type; $id; $processedAt; /* 3 more */ }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

string toolUseID

The id of the agent.tool_use event this result corresponds to.

?list<Content> content

The result content returned by the tool.

?bool isError

Whether the tool execution resulted in an error.

class ManagedAgentsAgentToolUseEvent { $type; $id; $input; /* 5 more */ }
Type type
string id

Unique identifier for this event.

array<string,mixed> input

Input parameters for the tool call.

string name

Name of the agent tool being used.

\Datetime processedAt

A timestamp in RFC 3339 format

?EvaluatedPermission evaluatedPermission

AgentEvaluatedPermission enum

Names the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.

?string sessionThreadID

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; }
Type type
string data

Base64-encoded document data.

string mediaType

MIME type of the document (e.g., "application/pdf").

class ManagedAgentsBase64ImageSource { $type; $data; $mediaType; }
Type type
string data

Base64-encoded image data.

string mediaType

MIME type of the image (e.g., "image/png", "image/jpeg", "image/gif", "image/webp").

class ManagedAgentsBillingError { $type; $message; $retryStatus; }
Type type
string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsCredentialHostUnreachableError { $type; $credentialID; $message; /* 2 more */ }
Type type
string credentialID

ID of the affected credential.

string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

string vaultID

ID of the vault containing the affected credential.

class ManagedAgentsDocumentBlock { $type; $source; $context; $title; }
Type type
Source source

Union type for document source variants.

?string context

Additional context about the document for the model.

?string title

The title of the document.

One of the following:
class ManagedAgentsFileDocumentSource { $type; $fileID; }
Type type
string fileID

ID of a previously uploaded file.

class ManagedAgentsFileImageSource { $type; $fileID; }
Type type
string fileID

ID of a previously uploaded file.

class ManagedAgentsFileRubric { $type; $fileID; }
Type type
string fileID

ID of the rubric file.

class ManagedAgentsFileRubricParams { $type; $fileID; }
Type type
string fileID

ID of the rubric file.

class ManagedAgentsImageBlock { $type; $source; }
Type type
Source source

Union type for image source variants.

class ManagedAgentsMCPAuthenticationFailedError { $type; $mcpServerName; $message; $retryStatus; }
Type type
string mcpServerName

Name of the MCP server that failed authentication.

string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsMCPConnectionFailedError { $type; $mcpServerName; $message; $retryStatus; }
Type type
string mcpServerName

Name of the MCP server that failed to connect.

string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsModelOverloadedError { $type; $message; $retryStatus; }
Type type
string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsModelRateLimitedError { $type; $message; $retryStatus; }
Type type
string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsModelRequestFailedError { $type; $message; $retryStatus; }
Type type
string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsPlainTextDocumentSource { $type; $data; $mediaType; }
Type type
string data

The plain text content.

MediaType mediaType

MIME type of the text content. Must be "text/plain".

class ManagedAgentsRedactedBlock { $type; }
Type type
Type type
Type type
Type type
class ManagedAgentsSearchResultBlock { $type; $citations; $content; /* 2 more */ }
Type type

Citation settings for a search result.

Array of text content blocks from the search result.

string source

The URL source of the search result.

string title

The title of the search result.

class ManagedAgentsSearchResultCitations { $enabled; }
bool enabled

Whether citations are enabled for this search result.

class ManagedAgentsSearchResultContent { $type; $text; }
Type type
string text

The text content.

class ManagedAgentsSendSessionEvents { $data; }
?list<Data> data

Sent events

Type type
class ManagedAgentsSessionDeletedEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSessionEndTurn { $type; }
Type type
class ManagedAgentsSessionErrorEvent { $type; $id; $error; $processedAt; }
Type type
string id

Unique identifier for this event.

Error error
\Datetime processedAt

A timestamp in RFC 3339 format

One of the following:
class ManagedAgentsSessionRequiresAction { $type; $eventIDs; }
Type type
list<string> eventIDs

The ids of events the agent is blocked on. Resolving fewer than all re-emits session.status_idle with the remainder.

Type type
class ManagedAgentsSessionStatusIdleEvent { $type; $id; $processedAt; $stopReason; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

StopReason stopReason
class ManagedAgentsSessionStatusRescheduledEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSessionStatusRunningEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSessionStatusTerminatedEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSessionThreadCreatedEvent { $type; $id; $agentName; /* 2 more */ }
Type type
string id

Unique identifier for this event.

string agentName

Name of the callable agent the thread runs.

\Datetime processedAt

A timestamp in RFC 3339 format

string sessionThreadID

Public sthr_ ID of the newly created thread.

class ManagedAgentsSessionThreadStatusIdleEvent { $type; $id; $agentName; /* 3 more */ }
Type type
string id

Unique identifier for this event.

string agentName

Name of the agent the thread runs.

\Datetime processedAt

A timestamp in RFC 3339 format

string sessionThreadID

Public sthr_ ID of the thread that went idle.

StopReason stopReason
class ManagedAgentsSessionThreadStatusRescheduledEvent { $type; $id; $agentName; /* 2 more */ }
Type type
string id

Unique identifier for this event.

string agentName

Name of the agent the thread runs.

\Datetime processedAt

A timestamp in RFC 3339 format

string sessionThreadID

Public sthr_ ID of the thread that is retrying.

class ManagedAgentsSessionThreadStatusRunningEvent { $type; $id; $agentName; /* 2 more */ }
Type type
string id

Unique identifier for this event.

string agentName

Name of the agent the thread runs.

\Datetime processedAt

A timestamp in RFC 3339 format

string sessionThreadID

Public sthr_ ID of the thread that started running.

class ManagedAgentsSessionThreadStatusTerminatedEvent { $type; $id; $agentName; /* 2 more */ }
Type type
string id

Unique identifier for this event.

string agentName

Name of the agent the thread runs.

\Datetime processedAt

A timestamp in RFC 3339 format

string sessionThreadID

Public sthr_ ID of the thread that terminated.

class ManagedAgentsSessionUsageSnapshot { $activeSeconds; $cacheCreation; $cacheReadInputTokens; /* 4 more */ }
?float activeSeconds

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.

Prompt-cache creation token usage broken down by cache lifetime.

?int cacheReadInputTokens

Total tokens read from prompt cache.

?int inputTokens

Total input tokens consumed across all turns.

?BetaMonetaryAmount listCost

A monetary amount in a specific currency.

?int outputTokens

Total output tokens generated across all turns.

Cumulative count of server-executed tool invocations, broken down by tool.

class ManagedAgentsSpanModelRequestEndEvent { $type; $id; $isError; /* 3 more */ }
Type type
string id

Unique identifier for this event.

?bool isError

Whether the model request resulted in an error.

string modelRequestStartID

The id of the corresponding span.model_request_start event.

Token usage for a single model request.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSpanModelRequestStartEvent { $type; $id; $processedAt; }
Type type
string id

Unique identifier for this event.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSpanModelUsage { $cacheCreationInputTokens; $cacheReadInputTokens; $inputTokens; /* 2 more */ }
int cacheCreationInputTokens

Tokens used to create prompt cache in this request.

int cacheReadInputTokens

Tokens read from prompt cache in this request.

int inputTokens

Input tokens consumed by this request.

int outputTokens

Output tokens generated by this request.

?Speed speed

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.

class ManagedAgentsSpanOutcomeEvaluationEndEvent { $type; $id; $explanation; /* 6 more */ }
Type type
string id

Unique identifier for this event.

string explanation

Human-readable explanation of the verdict. For needs_revision, describes which criteria failed and why.

int iteration

0-indexed revision cycle, matching the corresponding span.outcome_evaluation_start.

string outcomeEvaluationStartID

The id of the corresponding span.outcome_evaluation_start event.

string outcomeID

The outc_ ID of the outcome being evaluated.

\Datetime processedAt

A timestamp in RFC 3339 format

string result

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.

Token usage for a single model request.

class ManagedAgentsSpanOutcomeEvaluationOngoingEvent { $type; $id; $iteration; /* 2 more */ }
Type type
string id

Unique identifier for this event.

int iteration

0-indexed revision cycle, matching the corresponding span.outcome_evaluation_start.

string outcomeID

The outc_ ID of the outcome being evaluated.

\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsSpanOutcomeEvaluationStartEvent { $type; $id; $iteration; /* 2 more */ }
Type type
string id

Unique identifier for this event.

int iteration

0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc.

string outcomeID

The outc_ ID of the outcome being evaluated.

\Datetime processedAt

A timestamp in RFC 3339 format

One of the following:
class ManagedAgentsSystemMessageEventParams { $type; $content; }
Type type

System content blocks to append. Text-only.

class ManagedAgentsTextBlock { $type; $text; }
Type type
string text

The text content.

class ManagedAgentsTextRubric { $type; $content; }
Type type
string content

Rubric content. Plain text or markdown — the grader treats it as freeform text.

class ManagedAgentsTextRubricParams { $type; $content; }
Type type
string content

Rubric content. Plain text or markdown — the grader treats it as freeform text. Maximum 262144 characters.

class ManagedAgentsUnknownError { $type; $message; $retryStatus; }
Type type
string message

Human-readable error description.

RetryStatus retryStatus

What the client should do next in response to this error.

class ManagedAgentsURLDocumentSource { $type; $url; }
Type type
string url

URL of the document to fetch.

class ManagedAgentsURLImageSource { $type; $url; }
Type type
string url

URL of the image to fetch.

class ManagedAgentsUserCustomToolResultEvent { $type; $id; $customToolUseID; /* 4 more */ }
Type type
string id

Unique identifier for this event.

string customToolUseID

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 stop_reason.event_ids field.

?list<Content> content

The result content returned by the tool.

?bool isError

Whether the tool execution resulted in an error.

?\Datetime processedAt

A timestamp in RFC 3339 format

?string sessionThreadID

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; }
Type type
string customToolUseID

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 stop_reason.event_ids field.

?list<Content> content

The result content returned by the tool.

?bool isError

Whether the tool execution resulted in an error.

class ManagedAgentsUserDefineOutcomeEvent { $type; $id; $description; /* 4 more */ }
Type type
string id

Unique identifier for this event.

string description

What the agent should produce. Copied from the input event.

?int maxIterations

Evaluate-then-revise cycles before giving up. Default 3, max 20.

string outcomeID

Server-generated outc_ ID for this outcome. Referenced by span.outcome_evaluation_* events and the session's outcome_evaluations list.

\Datetime processedAt

A timestamp in RFC 3339 format

Rubric rubric

Rubric for grading the quality of an outcome.

class ManagedAgentsUserDefineOutcomeEventParams { $type; $description; $rubric; $maxIterations; }
Type type
string description

What the agent should produce. This is the task specification.

Rubric rubric

Rubric for grading the quality of an outcome.

?int maxIterations

Eval→revision cycles before giving up. Default 3, max 20.

class ManagedAgentsUserInterruptEvent { $type; $id; $processedAt; $sessionThreadID; }
Type type
string id

Unique identifier for this event.

?\Datetime processedAt

A timestamp in RFC 3339 format

?string 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 ManagedAgentsUserInterruptEventParams { $type; $sessionThreadID; }
Type type
?string 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; }
Type type
string id

Unique identifier for this event.

list<Content> content

Array of content blocks comprising the user message.

?\Datetime processedAt

A timestamp in RFC 3339 format

class ManagedAgentsUserMessageEventParams { $type; $content; }
Type type
list<Content> content

Array of content blocks for the user message.

class ManagedAgentsUserToolConfirmationEvent { $type; $id; $result; /* 4 more */ }
Type type
string id

Unique identifier for this event.

Result result

UserToolConfirmationResult enum

string toolUseID

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.

?string denyMessage

Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

?\Datetime processedAt

A timestamp in RFC 3339 format

?string sessionThreadID

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; }
Type type
Result result

UserToolConfirmationResult enum

string toolUseID

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.

?string denyMessage

Optional message providing context for a 'deny' decision. Only allowed when result is 'deny'.

class ManagedAgentsUserToolResultEventParams { $type; $toolUseID; $content; $isError; }
Type type
string toolUseID

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.

?list<Content> content

The result content returned by the tool.

?bool isError

Whether the tool execution resulted in an error.