AnthropicClaude 托管智能体

列出线程事件

列出一条执行线程产生的历史事件。

先调用「创建会话」,用返回的会话 ID 替换示例 ID。

GET /anthropic/v1/sessions/{session_id}/threads/{thread_id}/events◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • thread_idstring必填

    path: 路径参数:线程 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

读取所选线程自己的事件记录:主线程读主会话,子线程读对应子会话。沿用会话事件接口的查询参数、公开事件类型和 data + next_page 信封。使用网页工具时,两个接口均返回 search_result 块;回答 citations 为 /agent/v1 扩展,/anthropic 将引用显示为正文 [n]。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this event.
data[].contentarray<object>Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only.
data[].typestring
data[].processed_atnull | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | stringA timestamp in RFC 3339 format
data[].session_thread_idnull | string | string | string | string | string | null | string | stringIf 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. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / 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. / 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. / 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. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying.
data[].resultstringUserToolConfirmationResult enum / 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.
data[].tool_use_idstringThe 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. / The id of the `agent.tool_use` event this result corresponds to. / 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.
data[].deny_messagenull | stringOptional message providing context for a 'deny' decision. Only allowed when result is 'deny'.
data[].custom_tool_use_idstringThe 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.
data[].is_errornull | booleanWhether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error.
data[].inputobjectInput parameters for the tool call.
data[].namestringName of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used.
data[].mcp_server_namestringName of the MCP server providing the tool.
data[].evaluated_permissionstringAgentEvaluatedPermission enum
data[].evaluationobjectNames the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.
data[].mcp_tool_use_idstringThe id of the `agent.mcp_tool_use` event this result corresponds to.
data[].from_session_thread_idstringPublic `sthr_` ID of the thread that sent the message.
data[].from_agent_namenull | stringName of the callable agent this message came from. Absent when received from the primary agent.
data[].to_session_thread_idstringPublic `sthr_` ID of the thread the message was sent to.
data[].to_agent_namenull | stringName of the callable agent this message was sent to. Absent when sent to the primary agent.
data[].errorobject
data[].stop_reasonobject
data[].agent_namestringName of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs.
data[].iterationnumber0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.
data[].outcome_idstringThe `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.
data[].explanationstringHuman-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.
data[].outcome_evaluation_start_idstringThe id of the corresponding `span.outcome_evaluation_start` event.
data[].usageobjectToken usage for a single model request. / Point-in-time snapshot of a session's cumulative usage.
data[].model_request_start_idstringThe id of the corresponding `span.model_request_start` event.
data[].model_usageobjectToken usage for a single model request.
data[].descriptionstringWhat the agent should produce. Copied from the input event.
data[].max_iterationsnull | numberEvaluate-then-revise cycles before giving up. Default 3, max 20.
data[].rubricobjectRubric for grading the quality of an outcome.
data[].agentnull | objectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
data[].budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
data[].metadataobjectThe 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.
data[].titlenull | stringThe session's new title. Present only when the update changed it.
next_pagestring | null