> ## Documentation Index
> Fetch the complete documentation index at: https://oma-codex-339-workspace-permissions.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 发送会话事件

> 通过 OMA API 发送会话事件。

<Info>每个请求都必须发送 `?beta=true`。</Info>


## OpenAPI

````yaml /openapi/oma.zh.json post /v1/sessions/{session_id}/events
openapi: 3.1.0
info:
  title: OMA API 参考
  version: 1.0.0
  description: Open Managed Agents 应用 API 参考。
servers:
  - url: http://localhost:38080
    description: 本地 OMA 服务器
security:
  - omaApiKey: []
  - omaBearer: []
paths:
  /v1/sessions/{session_id}/events:
    post:
      summary: 发送会话事件
      operationId: BetaSendEvents
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
        - name: anthropic-version
          in: header
          required: false
          schema:
            type: string
        - name: anthropic-beta
          in: header
          required: false
          schema:
            type: string
            items:
              type: string
            x-stainless-override-schema:
              x-stainless-param: betas
              x-stainless-extend-default: true
              type: array
              description: 用于指定一个或多个 Beta 版本的可选请求头。
              items:
                $ref: '#/components/schemas/AnthropicBeta'
            x-default: managed-agents-2026-04-01
        - name: session_id
          in: path
          required: true
          schema:
            type: string
          description: 会话标识符。
          example: sesn_011CZkZAtmR3yMPDzynEDxu7
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BetaManagedAgentsSendSessionEventsParams'
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsSendSessionEvents'
        '400':
          description: Invalid argument - 客户端指定了无效的参数
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '401':
          description: 未认证 - 请求没有有效的认证凭据
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '403':
          description: 权限被拒绝 - 调用方没有执行指定操作的权限
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '404':
          description: 未找到 - 请求的某个实体不存在
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '408':
          description: 超出截止时间 - 截止时间在操作完成之前已过期
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '409':
          description: 已中止 - 该操作因并发问题而被中止
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '412':
          description: 前置条件不满足 - 由于系统未处于所需状态，操作被拒绝
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '413':
          description: Out of range - 尝试的操作超出了有效范围
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '429':
          description: 资源耗尽 - 某些资源已被耗尽（限流）
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '431':
          description: 请求头字段过大 - 请求元数据过大
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '499':
          description: Cancelled - 操作已被客户端取消
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '500':
          description: Internal - 内部服务器错误
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '501':
          description: 未实现 - 该操作未实现或不受支持
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '503':
          description: 不可用 - 服务当前不可用
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
        '504':
          description: 超时 - 上游服务未及时响应
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaErrorResponse'
components:
  schemas:
    BetaManagedAgentsSendSessionEventsParams:
      description: 向 `session` 发送事件的请求参数。
      type: object
      additionalProperties: false
      required:
        - events
      properties:
        events:
          description: 要发送到 `session` 的事件。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsEventParams'
          examples:
            - - type: user.message
                content:
                  - type: text
                    text: '我的订单 #1234 到哪里了？'
      example:
        events:
          - type: user.message
            content:
              - type: text
                text: '我的订单 #1234 到哪里了？'
    BetaManagedAgentsSendSessionEvents:
      description: 已成功发送至该会话的事件。
      type: object
      additionalProperties: false
      properties:
        data:
          description: 已发送的事件
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsInputEvent'
    BetaErrorResponse:
      properties:
        error:
          discriminator:
            mapping:
              api_error:
                $ref: '#/components/schemas/BetaAPIError'
              authentication_error:
                $ref: '#/components/schemas/BetaAuthenticationError'
              billing_error:
                $ref: '#/components/schemas/BetaBillingError'
              invalid_request_error:
                $ref: '#/components/schemas/BetaInvalidRequestError'
              not_found_error:
                $ref: '#/components/schemas/BetaNotFoundError'
              overloaded_error:
                $ref: '#/components/schemas/BetaOverloadedError'
              permission_error:
                $ref: '#/components/schemas/BetaPermissionError'
              rate_limit_error:
                $ref: '#/components/schemas/BetaRateLimitError'
              timeout_error:
                $ref: '#/components/schemas/BetaGatewayTimeoutError'
            propertyName: type
          oneOf:
            - $ref: '#/components/schemas/BetaInvalidRequestError'
            - $ref: '#/components/schemas/BetaAuthenticationError'
            - $ref: '#/components/schemas/BetaBillingError'
            - $ref: '#/components/schemas/BetaPermissionError'
            - $ref: '#/components/schemas/BetaNotFoundError'
            - $ref: '#/components/schemas/BetaRateLimitError'
            - $ref: '#/components/schemas/BetaGatewayTimeoutError'
            - $ref: '#/components/schemas/BetaAPIError'
            - $ref: '#/components/schemas/BetaOverloadedError'
          title: 错误
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          title: 请求 ID
        type:
          const: error
          default: error
          title: 类型
          type: string
      required:
        - error
        - request_id
        - type
      title: ErrorResponse
      type: object
    BetaManagedAgentsEventParams:
      description: 可发送到会话的事件参数的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          user.message:
            $ref: '#/components/schemas/BetaManagedAgentsUserMessageEventParams'
          user.interrupt:
            $ref: '#/components/schemas/BetaManagedAgentsUserInterruptEventParams'
          user.tool_confirmation:
            $ref: >-
              #/components/schemas/BetaManagedAgentsUserToolConfirmationEventParams
          user.custom_tool_result:
            $ref: >-
              #/components/schemas/BetaManagedAgentsUserCustomToolResultEventParams
          user.define_outcome:
            $ref: '#/components/schemas/BetaManagedAgentsUserDefineOutcomeEventParams'
          user.tool_result:
            $ref: '#/components/schemas/BetaManagedAgentsUserToolResultEventParams'
          system.message:
            $ref: '#/components/schemas/BetaManagedAgentsSystemMessageEventParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsUserMessageEventParams'
        - $ref: '#/components/schemas/BetaManagedAgentsUserInterruptEventParams'
        - $ref: >-
            #/components/schemas/BetaManagedAgentsUserToolConfirmationEventParams
        - $ref: >-
            #/components/schemas/BetaManagedAgentsUserCustomToolResultEventParams
        - $ref: '#/components/schemas/BetaManagedAgentsUserDefineOutcomeEventParams'
        - $ref: '#/components/schemas/BetaManagedAgentsUserToolResultEventParams'
        - $ref: '#/components/schemas/BetaManagedAgentsSystemMessageEventParams'
    BetaManagedAgentsInputEvent:
      description: 可发送到会话的事件的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          user.message:
            $ref: '#/components/schemas/BetaManagedAgentsUserMessageEvent'
          user.interrupt:
            $ref: '#/components/schemas/BetaManagedAgentsUserInterruptEvent'
          user.tool_confirmation:
            $ref: '#/components/schemas/BetaManagedAgentsUserToolConfirmationEvent'
          user.custom_tool_result:
            $ref: '#/components/schemas/BetaManagedAgentsUserCustomToolResultEvent'
          user.define_outcome:
            $ref: '#/components/schemas/BetaManagedAgentsUserDefineOutcomeEvent'
          user.tool_result:
            $ref: '#/components/schemas/BetaManagedAgentsUserToolResultEvent'
          system.message:
            $ref: '#/components/schemas/BetaManagedAgentsSystemMessageEvent'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsUserMessageEvent'
        - $ref: '#/components/schemas/BetaManagedAgentsUserInterruptEvent'
        - $ref: '#/components/schemas/BetaManagedAgentsUserToolConfirmationEvent'
        - $ref: '#/components/schemas/BetaManagedAgentsUserCustomToolResultEvent'
        - $ref: '#/components/schemas/BetaManagedAgentsUserDefineOutcomeEvent'
        - $ref: '#/components/schemas/BetaManagedAgentsUserToolResultEvent'
        - $ref: '#/components/schemas/BetaManagedAgentsSystemMessageEvent'
    BetaAPIError:
      properties:
        message:
          default: Internal server error
          title: 消息
          type: string
        type:
          const: api_error
          default: api_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: APIError
      type: object
    BetaAuthenticationError:
      properties:
        message:
          default: Authentication error
          title: 消息
          type: string
        type:
          const: authentication_error
          default: authentication_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: AuthenticationError
      type: object
    BetaBillingError:
      properties:
        message:
          default: Billing error
          title: 消息
          type: string
        type:
          const: billing_error
          default: billing_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: BillingError
      type: object
    BetaInvalidRequestError:
      properties:
        message:
          default: Invalid request
          title: 消息
          type: string
        type:
          const: invalid_request_error
          default: invalid_request_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: InvalidRequestError
      type: object
    BetaNotFoundError:
      properties:
        message:
          default: Not found
          title: 消息
          type: string
        type:
          const: not_found_error
          default: not_found_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: NotFoundError
      type: object
    BetaOverloadedError:
      properties:
        message:
          default: Overloaded
          title: 消息
          type: string
        type:
          const: overloaded_error
          default: overloaded_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: OverloadedError
      type: object
    BetaPermissionError:
      properties:
        message:
          default: Permission denied
          title: 消息
          type: string
        type:
          const: permission_error
          default: permission_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: PermissionError
      type: object
    BetaRateLimitError:
      properties:
        message:
          default: Rate limited
          title: 消息
          type: string
        type:
          const: rate_limit_error
          default: rate_limit_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: RateLimitError
      type: object
    BetaGatewayTimeoutError:
      properties:
        message:
          default: Request timeout
          title: 消息
          type: string
        type:
          const: timeout_error
          default: timeout_error
          title: 类型
          type: string
      required:
        - message
        - type
      title: GatewayTimeoutError
      type: object
    BetaManagedAgentsUserMessageEventParams:
      description: 向会话发送用户消息的参数。
      type: object
      additionalProperties: false
      required:
        - type
        - content
      properties:
        type:
          type: string
          enum:
            - user.message
          examples:
            - user.message
        content:
          description: 用户消息的内容块数组。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsUserContentBlock'
          examples:
            - - type: text
                text: '我的订单 #1234 到哪里了？'
      example:
        type: user.message
        content:
          - type: text
            text: '我的订单 #1234 到哪里了？'
    BetaManagedAgentsUserInterruptEventParams:
      description: 发送中断以暂停智能体的参数。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - user.interrupt
        session_thread_id:
          description: 缺省时，中断多智能体会话中所有未归档的线程（在单智能体会话中则仅中断主线程）。存在时，仅中断指定名称的线程。
          type: string
          nullable: true
    BetaManagedAgentsUserToolConfirmationEventParams:
      description: 用于确认或拒绝工具执行请求的参数。
      type: object
      additionalProperties: false
      required:
        - type
        - tool_use_id
        - result
      properties:
        type:
          type: string
          enum:
            - user.tool_confirmation
        tool_use_id:
          description: >-
            该结果对应的 `agent.tool_use` 或 `agent.mcp_tool_use` 事件的 ID，可在最近一次
            `session.status_idle` 事件的 `stop_reason.event_ids` 字段中找到。
          type: string
          minLength: 1
          maxLength: 128
        result:
          description: 确认结果：'allow' 或 'deny'。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsUserToolConfirmationResult'
        deny_message:
          description: 可选消息，为 'deny' 决定提供上下文。仅当 result 为 'deny' 时允许。
          type: string
          maxLength: 10000
          nullable: true
    BetaManagedAgentsUserCustomToolResultEventParams:
      description: 用于提供自定义工具执行结果的参数。
      type: object
      additionalProperties: false
      required:
        - type
        - custom_tool_use_id
      properties:
        type:
          type: string
          enum:
            - user.custom_tool_result
        custom_tool_use_id:
          description: >-
            此结果对应的 `agent.custom_tool_use` 事件的 ID，可在最近一次 `session.status_idle`
            事件的 `stop_reason.event_ids` 字段中找到。
          type: string
          minLength: 1
          maxLength: 128
        content:
          description: 工具返回的结果内容。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsToolResultContentBlock'
        is_error:
          description: 工具执行是否出错。
          type: boolean
          nullable: true
    BetaManagedAgentsUserDefineOutcomeEventParams:
      description: 用于定义智能体应努力达成的结果的参数。智能体在收到后立即开始工作。
      type: object
      additionalProperties: false
      required:
        - type
        - description
        - rubric
      properties:
        type:
          type: string
          enum:
            - user.define_outcome
          examples:
            - user.define_outcome
        description:
          description: 智能体应产出的内容。这是任务说明。
          type: string
          examples:
            - 生成一份两页的摘要并保存为 summary.md
        rubric:
          description: 如何评估结果。文本或文件引用。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRubricParams'
          examples:
            - type: text
              content: 必须涵盖全部五个部分，并在正文中引用来源。
        max_iterations:
          description: 放弃前的评估→修订循环次数。默认为 3，最大为 20。
          type: integer
          format: int32
          nullable: true
          examples:
            - 3
      example:
        type: user.define_outcome
        description: 生成一份 2 页的摘要并保存为 summary.md
        rubric:
          type: text
          content: 必须涵盖全部五个部分，并在正文中引用来源。
        max_iterations: 3
    BetaManagedAgentsUserToolResultEventParams:
      description: 用于提供智能体工具集工具执行结果的参数。仅在 `self_hosted` 环境上有效，在这些环境中，路由到沙箱的工具由客户端而非服务端执行。
      type: object
      additionalProperties: false
      required:
        - type
        - tool_use_id
      properties:
        type:
          type: string
          enum:
            - user.tool_result
        tool_use_id:
          description: >-
            此结果对应的 `agent.tool_use` 事件的 ID，可在最近一次 `session.status_idle` 事件的
            `stop_reason.event_ids` 字段中找到。
          type: string
          minLength: 1
          maxLength: 128
        content:
          description: 工具返回的结果内容。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsToolResultContentBlock'
        is_error:
          description: 工具执行是否出错。
          type: boolean
          nullable: true
    BetaManagedAgentsSystemMessageEventParams:
      description: >-
        为随附轮次及所有后续轮次提供的特权上下文，以 `role: "system"`
        轮次追加到会话的系统上下文中，而不是替换顶层系统提示词。每个请求最多一个：它必须是最后一个事件，并紧跟在其随附的
        `user.message`、`user.tool_result` 或 `user.custom_tool_result`
        之后。仅支持接受对话中途系统消息的模型。
      type: object
      additionalProperties: false
      required:
        - type
        - content
      properties:
        type:
          type: string
          enum:
            - system.message
        content:
          description: 要追加的系统内容块。仅限文本。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSystemContentBlock'
    BetaManagedAgentsUserMessageEvent:
      description: 会话对话中的用户消息事件。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - content
      properties:
        type:
          type: string
          enum:
            - user.message
          examples:
            - user.message
        id:
          description: 此事件的唯一标识符。
          type: string
          examples:
            - sevt_011CZkZGOp0iBcp4kaQSihUmy
        content:
          description: 构成用户消息的内容块数组。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsUserContentBlock'
          examples:
            - - type: text
                text: '我的订单 #1234 到哪里了？'
        processed_at:
          description: 智能体完成处理此消息的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
          examples:
            - '2026-03-15T10:00:00Z'
      example:
        type: user.message
        id: sevt_011CZkZGOp0iBcp4kaQSihUmy
        content:
          - type: text
            text: '我的订单 #1234 到哪里了？'
        processed_at: '2026-03-15T10:00:00Z'
    BetaManagedAgentsUserInterruptEvent:
      description: 暂停智能体执行并将控制权交还给用户的中断事件。
      type: object
      additionalProperties: false
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - user.interrupt
        id:
          description: 此事件的唯一标识符。
          type: string
        processed_at:
          description: 中断被处理时的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
        session_thread_id:
          description: 缺省时，中断多智能体会话中所有未归档的线程（在单智能体会话中则仅中断主线程）。存在时，仅中断指定名称的线程。
          type: string
          nullable: true
    BetaManagedAgentsUserToolConfirmationEvent:
      description: 用于批准或拒绝待执行工具调用的工具确认事件。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - tool_use_id
        - result
      properties:
        type:
          type: string
          enum:
            - user.tool_confirmation
        id:
          description: 此事件的唯一标识符。
          type: string
        tool_use_id:
          description: >-
            该结果对应的 `agent.tool_use` 或 `agent.mcp_tool_use` 事件的 ID，可在最近一次
            `session.status_idle` 事件的 `stop_reason.event_ids` 字段中找到。
          type: string
        result:
          description: 确认结果：'allow' 或 'deny'。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsUserToolConfirmationResult'
        deny_message:
          description: 可选消息，为 'deny' 决定提供上下文。仅当 result 为 'deny' 时允许。
          type: string
          maxLength: 10000
          nullable: true
        processed_at:
          description: 该确认被处理的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
        session_thread_id:
          description: >-
            设置后，确认将路由到该子智能体的线程而非主线程。请从触发本次审批的 `agent.tool_use` 或
            `agent.mcp_tool_use` 事件的 `session_thread_id` 原样回传该值。
          type: string
          nullable: true
    BetaManagedAgentsUserCustomToolResultEvent:
      description: 由客户端发送的事件，提供自定义工具执行的结果。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - custom_tool_use_id
      properties:
        type:
          type: string
          enum:
            - user.custom_tool_result
        id:
          description: 此事件的唯一标识符。
          type: string
        custom_tool_use_id:
          description: >-
            此结果对应的 `agent.custom_tool_use` 事件的 ID，可在最近一次 `session.status_idle`
            事件的 `stop_reason.event_ids` 字段中找到。
          type: string
        content:
          description: 工具返回的结果内容。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsToolResultContentBlock'
        is_error:
          description: 工具执行是否出错。
          type: boolean
          nullable: true
        processed_at:
          description: 本结果被处理时的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
        session_thread_id:
          description: >-
            将此结果路由到一个子智能体线程。从 `agent.custom_tool_use` 事件的 `session_thread_id`
            复制。
          type: string
          nullable: true
    BetaManagedAgentsUserDefineOutcomeEvent:
      description: >-
        `user.define_outcome` 输入事件的回显。携带由服务端生成的 `outcome_id`，后续的
        `span.outcome_evaluation_*` 事件将引用该 ID。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - processed_at
        - outcome_id
        - description
        - max_iterations
        - rubric
      properties:
        type:
          type: string
          enum:
            - user.define_outcome
          examples:
            - user.define_outcome
        id:
          description: 此事件的唯一标识符。
          type: string
          examples:
            - sevt_011CZkZSTx3lFgt7odUWmkyq
        processed_at:
          description: 结果被接受时的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:02:14Z'
        outcome_id:
          description: >-
            由服务端为该结果生成的 `outc_` ID。会被 `span.outcome_evaluation_*` 事件和会话的
            `outcome_evaluations` 列表引用。
          type: string
          examples:
            - outc_011CZkZRSw2kEfs6ncTVljxP
        description:
          description: 智能体应产出的内容。从输入事件复制而来。
          type: string
          examples:
            - 生成一份两页的摘要并保存为 summary.md
        max_iterations:
          description: 放弃前的评估后修订循环次数。默认 3 次，最多 20 次。
          type: integer
          format: int32
          nullable: true
          examples:
            - 3
        rubric:
          description: 如何对结果进行评分。文件形式的评分标准目前会被解析为其文本内容；客户端应能处理两种变体。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRubric'
          examples:
            - type: text
              content: 必须涵盖全部五个部分，并在正文中引用来源。
      example:
        type: user.define_outcome
        id: sevt_011CZkZSTx3lFgt7odUWmkyq
        processed_at: '2026-03-15T10:02:14Z'
        outcome_id: outc_011CZkZRSw2kEfs6ncTVljxP
        description: 生成一份 2 页的摘要并保存为 summary.md
        max_iterations: 3
        rubric:
          type: text
          content: 必须涵盖全部五个部分，并在正文中引用来源。
    BetaManagedAgentsUserToolResultEvent:
      description: >-
        由客户端发送的事件，用于提供智能体工具集工具执行的结果。仅在 `self_hosted`
        环境上有效，在这些环境中，路由到沙箱的工具由客户端而非服务端执行。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - tool_use_id
      properties:
        type:
          type: string
          enum:
            - user.tool_result
        id:
          description: 此事件的唯一标识符。
          type: string
        tool_use_id:
          description: >-
            此结果对应的 `agent.tool_use` 事件的 ID，可在最近一次 `session.status_idle` 事件的
            `stop_reason.event_ids` 字段中找到。
          type: string
        content:
          description: 工具返回的结果内容。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsToolResultContentBlock'
        is_error:
          description: 工具执行是否出错。
          type: boolean
          nullable: true
        processed_at:
          description: 本结果被处理时的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
        session_thread_id:
          description: 将此结果路由到一个子智能体线程。从 `agent.tool_use` 事件的 `session_thread_id` 复制。
          type: string
          nullable: true
    BetaManagedAgentsSystemMessageEvent:
      description: '会话中途的 system 消息事件。携带 system 角色的内容，该内容会以 `role: "system"` 轮次的形式追加到会话中。'
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - content
      properties:
        type:
          type: string
          enum:
            - system.message
        id:
          description: 此事件的唯一标识符。
          type: string
        content:
          description: 系统内容块。仅文本。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSystemContentBlock'
        processed_at:
          description: 此系统消息被处理的时间戳。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
    BetaManagedAgentsUserContentBlock:
      description: 用户消息中的内容块。可以是 `text`、`image` 或 `document`。
      type: object
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/BetaManagedAgentsTextBlock'
          image:
            $ref: '#/components/schemas/BetaManagedAgentsImageBlock'
          document:
            $ref: '#/components/schemas/BetaManagedAgentsDocumentBlock'
          redacted:
            $ref: '#/components/schemas/BetaManagedAgentsRedactedBlock'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsTextBlock'
        - $ref: '#/components/schemas/BetaManagedAgentsImageBlock'
        - $ref: '#/components/schemas/BetaManagedAgentsDocumentBlock'
        - $ref: '#/components/schemas/BetaManagedAgentsRedactedBlock'
    BetaManagedAgentsUserToolConfirmationResult:
      type: string
      description: UserToolConfirmationResult 枚举
      enum:
        - allow
        - deny
    BetaManagedAgentsToolResultContentBlock:
      description: 工具结果中的内容块。可以是 `text`、`image`、`document` 或 `search_result`。
      type: object
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/BetaManagedAgentsTextBlock'
          image:
            $ref: '#/components/schemas/BetaManagedAgentsImageBlock'
          document:
            $ref: '#/components/schemas/BetaManagedAgentsDocumentBlock'
          search_result:
            $ref: '#/components/schemas/BetaManagedAgentsSearchResultBlock'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsTextBlock'
        - $ref: '#/components/schemas/BetaManagedAgentsImageBlock'
        - $ref: '#/components/schemas/BetaManagedAgentsDocumentBlock'
        - $ref: '#/components/schemas/BetaManagedAgentsSearchResultBlock'
    BetaManagedAgentsRubricParams:
      description: 用于评估结果质量的评分标准。
      discriminator:
        propertyName: type
        mapping:
          file:
            $ref: '#/components/schemas/BetaManagedAgentsFileRubricParams'
          text:
            $ref: '#/components/schemas/BetaManagedAgentsTextRubricParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsFileRubricParams'
        - $ref: '#/components/schemas/BetaManagedAgentsTextRubricParams'
    BetaManagedAgentsSystemContentBlock:
      description: 对话中途的 system 消息中的内容块。仅支持文本。
      type: object
      discriminator:
        propertyName: type
        mapping:
          text:
            $ref: '#/components/schemas/BetaManagedAgentsTextBlock'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsTextBlock'
    BetaTimestamp:
      description: RFC 3339 格式的时间戳
      type: string
      format: date-time
    BetaManagedAgentsRubric:
      description: 用于评估结果质量的评分标准。
      discriminator:
        propertyName: type
        mapping:
          file:
            $ref: '#/components/schemas/BetaManagedAgentsFileRubric'
          text:
            $ref: '#/components/schemas/BetaManagedAgentsTextRubric'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsFileRubric'
        - $ref: '#/components/schemas/BetaManagedAgentsTextRubric'
    BetaManagedAgentsTextBlock:
      description: 普通文本内容。
      type: object
      additionalProperties: false
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
          examples:
            - text
        text:
          description: 文本内容。
          type: string
          minLength: 1
          examples:
            - '我的订单 #1234 到哪里了？'
      example:
        type: text
        text: '我的订单 #1234 到哪里了？'
    BetaManagedAgentsImageBlock:
      description: 直接以 base64 数据指定，或通过 URL 引用指定的图片内容。
      type: object
      additionalProperties: false
      required:
        - type
        - source
      properties:
        type:
          type: string
          enum:
            - image
        source:
          description: 图像数据的来源。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsImageSource'
    BetaManagedAgentsDocumentBlock:
      description: 文档内容，可直接指定为 base64 数据、文本，或通过 URL 引用。
      type: object
      additionalProperties: false
      required:
        - type
        - source
      properties:
        type:
          type: string
          enum:
            - document
        source:
          description: 文档数据的来源。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsDocumentSource'
        title:
          description: 文档的标题。
          type: string
          nullable: true
        context:
          description: 为模型提供的有关该文档的附加上下文。
          type: string
          nullable: true
    BetaManagedAgentsRedactedBlock:
      description: 被 OMA 模型策略屏蔽的内容的占位符。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - redacted
    BetaManagedAgentsSearchResultBlock:
      description: 包含网页搜索结果的块。
      type: object
      additionalProperties: false
      required:
        - type
        - source
        - title
        - content
        - citations
      properties:
        type:
          type: string
          enum:
            - search_result
        source:
          description: 搜索结果的 URL 来源。
          type: string
          minLength: 1
        title:
          description: 搜索结果的标题。
          type: string
          minLength: 1
        content:
          description: 来自搜索结果的文本内容块数组。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSearchResultContent'
        citations:
          description: 此搜索结果的引用设置。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsSearchResultCitations'
    BetaManagedAgentsFileRubricParams:
      description: 通过文件 API 上传的文件所引用的评分标准。
      type: object
      additionalProperties: false
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - file
          examples:
            - file
        file_id:
          description: rubric 文件的 ID。
          type: string
          examples:
            - file_011CNha8iCJcU1wXNR6q4V8w
      example:
        type: file
        file_id: file_011CNha8iCJcU1wXNR6q4V8w
    BetaManagedAgentsTextRubricParams:
      description: 以文本形式内联提供的评分标准内容。
      type: object
      additionalProperties: false
      required:
        - type
        - content
      properties:
        type:
          type: string
          enum:
            - text
          examples:
            - text
        content:
          description: 评分标准内容。纯文本或 markdown —— grader 将其视为自由格式文本。最多 262144 个字符。
          type: string
          maxLength: 262144
          examples:
            - 必须涵盖全部五个部分，并在正文中引用来源。
      example:
        type: text
        content: 必须涵盖全部五个部分，并在正文中引用来源。
    BetaManagedAgentsFileRubric:
      description: 通过文件 API 上传的文件所引用的评分标准。
      type: object
      additionalProperties: false
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - file
        file_id:
          description: rubric 文件的 ID。
          type: string
    BetaManagedAgentsTextRubric:
      description: 以文本形式内联提供的评分标准内容。
      type: object
      additionalProperties: false
      required:
        - type
        - content
      properties:
        type:
          type: string
          enum:
            - text
        content:
          description: 评分标准内容。纯文本或 markdown — 评分器将其视为自由格式文本。
          type: string
    BetaManagedAgentsImageSource:
      description: 图片来源变体的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          base64:
            $ref: '#/components/schemas/BetaManagedAgentsBase64ImageSource'
          url:
            $ref: '#/components/schemas/BetaManagedAgentsURLImageSource'
          file:
            $ref: '#/components/schemas/BetaManagedAgentsFileImageSource'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsBase64ImageSource'
        - $ref: '#/components/schemas/BetaManagedAgentsURLImageSource'
        - $ref: '#/components/schemas/BetaManagedAgentsFileImageSource'
    BetaManagedAgentsDocumentSource:
      description: 文档来源变体的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          base64:
            $ref: '#/components/schemas/BetaManagedAgentsBase64DocumentSource'
          text:
            $ref: '#/components/schemas/BetaManagedAgentsPlainTextDocumentSource'
          url:
            $ref: '#/components/schemas/BetaManagedAgentsURLDocumentSource'
          file:
            $ref: '#/components/schemas/BetaManagedAgentsFileDocumentSource'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsBase64DocumentSource'
        - $ref: '#/components/schemas/BetaManagedAgentsPlainTextDocumentSource'
        - $ref: '#/components/schemas/BetaManagedAgentsURLDocumentSource'
        - $ref: '#/components/schemas/BetaManagedAgentsFileDocumentSource'
    BetaManagedAgentsSearchResultContent:
      description: 搜索结果中的文本内容。
      type: object
      additionalProperties: false
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
        text:
          description: 文本内容。
          type: string
          minLength: 1
    BetaManagedAgentsSearchResultCitations:
      description: 搜索结果的引用设置。
      type: object
      additionalProperties: false
      required:
        - enabled
      properties:
        enabled:
          description: 此搜索结果是否启用了引用。
          type: boolean
    BetaManagedAgentsBase64ImageSource:
      description: Base64 编码的图像数据。
      type: object
      additionalProperties: false
      required:
        - type
        - media_type
        - data
      properties:
        type:
          type: string
          enum:
            - base64
        media_type:
          description: 图片的 MIME 类型（例如 "image/png"、"image/jpeg"、"image/gif"、"image/webp"）。
          type: string
          minLength: 1
        data:
          description: Base64 编码的图像数据。
          type: string
          minLength: 1
    BetaManagedAgentsURLImageSource:
      description: 通过 URL 引用的图片。
      type: object
      additionalProperties: false
      required:
        - type
        - url
      properties:
        type:
          type: string
          enum:
            - url
        url:
          description: 要获取的图像 URL。
          type: string
          minLength: 1
    BetaManagedAgentsFileImageSource:
      description: 通过文件 ID 引用的图像。
      type: object
      additionalProperties: false
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - file
        file_id:
          description: 先前上传文件的 ID。
          type: string
          minLength: 1
    BetaManagedAgentsBase64DocumentSource:
      description: Base64 编码的文档数据。
      type: object
      additionalProperties: false
      required:
        - type
        - media_type
        - data
      properties:
        type:
          type: string
          enum:
            - base64
        media_type:
          description: 文档的 MIME 类型（例如 "application/pdf"）。
          type: string
          minLength: 1
        data:
          description: Base64 编码的文档数据。
          type: string
          minLength: 1
    BetaManagedAgentsPlainTextDocumentSource:
      description: 纯文本文档内容。
      type: object
      additionalProperties: false
      required:
        - type
        - media_type
        - data
      properties:
        type:
          type: string
          enum:
            - text
        media_type:
          description: 文本内容的 MIME 类型。必须为 "text/plain"。
          type: string
          enum:
            - text/plain
        data:
          description: 纯文本内容。
          type: string
          minLength: 1
    BetaManagedAgentsURLDocumentSource:
      description: 通过 URL 引用的文档。
      type: object
      additionalProperties: false
      required:
        - type
        - url
      properties:
        type:
          type: string
          enum:
            - url
        url:
          description: 要获取的文档 URL。
          type: string
          minLength: 1
    BetaManagedAgentsFileDocumentSource:
      description: 按文件 ID 引用的文档。
      type: object
      additionalProperties: false
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - file
        file_id:
          description: 先前上传文件的 ID。
          type: string
          minLength: 1
  securitySchemes:
    omaApiKey:
      type: apiKey
      in: header
      name: X-Api-Key
      description: OMA 工作区 API 密钥。
      x-default: sk-ant-local-default
    omaBearer:
      type: http
      scheme: bearer
      description: 以 Bearer 令牌形式发送的 OMA 工作区 API 密钥。

````