AnthropicClaude 托管智能体

发送事件

发送事件。使用当前 API Key 所属工作区的资源。

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

POST /anthropic/v1/sessions/{session_id}/events◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

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

  • eventsarray必填

    要发送给会话的事件列表。

返回

200

将 sesn_123 换成创建会话返回的 id。每条 user.message 只接受一个非空文本块。支持文本 user.message、user.interrupt 和工具确认;其它事件变体尚不支持。返回的是已接纳事件;模型回复从事件历史或订阅读取。会话等待工具授权时发送的 user.message 会排队:返回的事件 processed_at 为 null,授权处理完成后按发送顺序执行。

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

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>Sent events
data[].idstringUnique identifier for this event.
data[].contentarray<object>Array of content blocks comprising the user message. / The result content returned by the tool. / The result content returned by the tool. / System content blocks. Text-only.
data[].typestring
data[].processed_atnull | string | string | null | string | null | stringA timestamp in RFC 3339 format
data[].session_thread_idnull | 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. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.
data[].resultstringUserToolConfirmationResult enum
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, 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.
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[].outcome_idstringServer-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.
data[].rubricobjectRubric for grading the quality of an outcome.