> ## 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/agents/{agent_id}
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/agents/{agent_id}:
    post:
      summary: 更新智能体
      operationId: BetaUpdateAgent
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
            x-default: true
        - name: anthropic-version
          in: header
          required: false
          schema:
            type: string
            x-default: '2023-06-01'
          description: 要使用的 OMA API 兼容版本。
        - 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
          description: 用于启用托管智能体 API 合同的 Beta 请求头。
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            x-stainless-cli-data-alias: id
          description: 智能体标识符。
          example: agent_011CZkYpogX7uDKUyvBTophP
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BetaManagedAgentsUpdateAgentParams'
            example:
              description: 已更新
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsAgent'
        '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:
    BetaManagedAgentsUpdateAgentParams:
      description: 用于更新 `agent` 的请求参数。省略字段以保留其当前值。
      type: object
      additionalProperties: false
      properties:
        version:
          description: >-
            智能体的当前版本，用于防止并发覆盖。请从创建或获取响应中取得此值。指定时必须至少为
            1。提供时，若与服务端当前版本不匹配则请求失败；省略则无条件应用更新。
          type: integer
          format: int32
          examples:
            - 1
        name:
          description: 人类可读的名称。必须非空。省略则保留。无法清除。
          type: string
          maxLength: 256
        description:
          description: 描述。省略则保持不变；发送空字符串或 null 则清除。
          type: string
          maxLength: 2048
          nullable: true
        model:
          description: >-
            模型标识符。可传入模型字符串（例如 `claude-opus-4-6`），或用于更多配置控制的 `model_config`
            对象。省略则保留。无法清除。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsModelParams'
        system:
          description: 系统提示词。省略则保持不变；发送空字符串或 null 则清除。
          type: string
          maxLength: 100000
          nullable: true
          examples:
            - 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
        tools:
          description: 可供智能体使用的工具配置。整体替换。省略则保留；传入空数组或 null 则清空。所有工具集合计最多允许 128 个工具。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentToolParams'
          nullable: true
        mcp_servers:
          description: >-
            MCP 服务器。全量替换。省略则保留；发送空数组或 `null` 则清空。名称必须唯一。最多 20 个。每个服务器都必须被智能体最终
            `tools` 中的 `mcp_toolset` 引用；未被引用的服务器会被拒绝。详见 MCP 连接器指南。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServerParams'
          nullable: true
        skills:
          description: 技能。全量替换。省略则保留；发送空数组或 null 则清除。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSkillParams'
          nullable: true
        metadata:
          description: >-
            元数据补丁。将某个键设为字符串以插入或更新该键，设为 null 以删除该键。省略该字段则保持不变。存储的元数据集合最多 16
            个键（每个键最多 64 个字符），值最多 512 个字符。
          type: object
          additionalProperties:
            type: string
            nullable: true
          nullable: true
        multiagent:
          description: 多智能体编排配置。全量替换。省略以保留；发送 null 以清除。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsMultiagentParams'
          nullable: true
      example:
        version: 1
        system: 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
    BetaManagedAgentsAgent:
      description: 托管智能体的 `agent`。
      type: object
      additionalProperties: false
      required:
        - id
        - archived_at
        - created_at
        - description
        - mcp_servers
        - metadata
        - model
        - multiagent
        - name
        - skills
        - system
        - tools
        - type
        - updated_at
        - version
      properties:
        id:
          type: string
          examples:
            - agent_011CZkYpogX7uDKUyvBTophP
        archived_at:
          description: 智能体的归档时间。未归档时为 null。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
          examples:
            - null
        created_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        description:
          type: string
          nullable: true
          examples:
            - 一个通用入门智能体。
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServer'
          examples:
            - - type: url
                name: example-mcp
                url: https://example-server.modelcontextprotocol.io/sse
        metadata:
          type: object
          additionalProperties:
            type: string
          examples:
            - foo: bar
        model:
          $ref: '#/components/schemas/BetaManagedAgentsModelConfig'
          examples:
            - id: claude-sonnet-4-6
              effort:
                type: low
              inference_geo: inference_geo
              speed: standard
        multiagent:
          description: 多智能体编排配置。当智能体为单线程时为 null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsMultiagent'
          nullable: true
          examples:
            - agents:
                - id: agent_011CZkYqphY8vELVzwCUpqiQ
                  type: agent
                  version: 1
              type: coordinator
        name:
          type: string
          examples:
            - 我的第一个智能体
        skills:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSkill'
          examples:
            - - type: anthropic
                skill_id: xlsx
                version: '1'
              - type: custom
                skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
                version: '2'
        system:
          type: string
          nullable: true
          examples:
            - 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
        tools:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentTool'
          examples:
            - - configs:
                  - enabled: true
                    name: bash
                    permission_policy:
                      type: always_allow
                default_config:
                  enabled: true
                  permission_policy:
                    type: always_ask
                type: agent_toolset_20260401
        type:
          type: string
          enum:
            - agent
          examples:
            - agent
        updated_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        version:
          description: 智能体的当前版本。从 1 开始，每次修改智能体时递增。
          type: integer
          format: int32
          examples:
            - 1
      example:
        id: agent_011CZkYpogX7uDKUyvBTophP
        archived_at: null
        created_at: '2026-03-15T10:00:00Z'
        description: 通用入门智能体。
        mcp_servers:
          - name: example-mcp
            type: url
            url: https://example-server.modelcontextprotocol.io/sse
        metadata:
          foo: bar
        model:
          id: claude-sonnet-4-6
          effort:
            type: low
          inference_geo: inference_geo
          speed: standard
        multiagent:
          agents:
            - id: agent_011CZkYqphY8vELVzwCUpqiQ
              type: agent
              version: 1
          type: coordinator
        name: 我的第一个智能体
        skills:
          - skill_id: xlsx
            type: anthropic
            version: '1'
          - skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
            type: custom
            version: '2'
        system: 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
        tools:
          - configs:
              - enabled: true
                name: bash
                permission_policy:
                  type: always_allow
            default_config:
              enabled: true
              permission_policy:
                type: always_ask
            type: agent_toolset_20260401
        type: agent
        updated_at: '2026-03-15T10:00:00Z'
        version: 1
    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
    BetaManagedAgentsModelParams:
      oneOf:
        - title: BetaManagedAgentsModel
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsModel'
          x-stainless-skip:
            - go
            - cli
        - $ref: '#/components/schemas/BetaManagedAgentsModelConfigParams'
    BetaManagedAgentsAgentToolParams:
      description: tools 数组中工具配置的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          agent_toolset_20260401:
            $ref: '#/components/schemas/BetaManagedAgentsAgentToolset20260401Params'
          mcp_toolset:
            $ref: '#/components/schemas/BetaManagedAgentsMCPToolsetParams'
          custom:
            $ref: '#/components/schemas/BetaManagedAgentsCustomToolParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsAgentToolset20260401Params'
        - $ref: '#/components/schemas/BetaManagedAgentsMCPToolsetParams'
        - $ref: '#/components/schemas/BetaManagedAgentsCustomToolParams'
    BetaManagedAgentsMCPServerParams:
      description: MCP 服务器连接定义的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          url:
            $ref: '#/components/schemas/BetaManagedAgentsURLMCPServerParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsURLMCPServerParams'
    BetaManagedAgentsSkillParams:
      description: 要加载到会话容器中的技能。
      discriminator:
        propertyName: type
        mapping:
          anthropic:
            $ref: '#/components/schemas/BetaManagedAgentsAnthropicSkillParams'
          custom:
            $ref: '#/components/schemas/BetaManagedAgentsCustomSkillParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsAnthropicSkillParams'
        - $ref: '#/components/schemas/BetaManagedAgentsCustomSkillParams'
    BetaManagedAgentsMultiagentParams:
      description: 多智能体编排配置。目前支持 `coordinator` 拓扑。
      discriminator:
        propertyName: type
        mapping:
          coordinator:
            $ref: '#/components/schemas/BetaManagedAgentsMultiagentCoordinatorParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsMultiagentCoordinatorParams'
    BetaTimestamp:
      description: RFC 3339 格式的时间戳
      type: string
      format: date-time
    BetaManagedAgentsMCPServer:
      description: API 响应中返回的 MCP 服务器连接定义的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          url:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServerURLDefinition'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsMCPServerURLDefinition'
    BetaManagedAgentsModelConfig:
      description: 模型标识符和配置。
      type: object
      additionalProperties: false
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/BetaManagedAgentsModel'
        effort:
          description: >-
            模型在每次推理调用中的努力程度。取值为 `low`、`medium`、`high`、`xhigh`、`max`
            之一。始终存在；未提供时会在保存时解析为对应模型的默认值。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsEffort'
          examples:
            - type: low
        inference_geo:
          description: 模型推理的地理区域。未设置时，请求将回退到工作区的 default_inference_geo。
          type: string
          examples:
            - inference_geo
        speed:
          description: >-
            推理速度模式。`fast` 以较高价格提供显著更快的输出令牌生成速度。默认为 `standard`。并非所有模型都支持
            `fast`；无效组合会在创建时被拒绝。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsSpeed'
          examples:
            - standard
      example:
        id: claude-sonnet-4-6
        effort:
          type: low
        inference_geo: inference_geo
        speed: standard
    BetaManagedAgentsMultiagent:
      description: API 响应中返回的已解析多智能体编排配置。
      discriminator:
        propertyName: type
        mapping:
          coordinator:
            $ref: '#/components/schemas/BetaManagedAgentsMultiagentCoordinator'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsMultiagentCoordinator'
    BetaManagedAgentsSkill:
      description: API 响应中返回的已解析技能。
      discriminator:
        propertyName: type
        mapping:
          anthropic:
            $ref: '#/components/schemas/BetaManagedAgentsAnthropicSkill'
          custom:
            $ref: '#/components/schemas/BetaManagedAgentsCustomSkill'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsAnthropicSkill'
        - $ref: '#/components/schemas/BetaManagedAgentsCustomSkill'
    BetaManagedAgentsAgentTool:
      description: API 响应中返回的工具配置的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          agent_toolset_20260401:
            $ref: '#/components/schemas/BetaManagedAgentsAgentToolset20260401'
          mcp_toolset:
            $ref: '#/components/schemas/BetaManagedAgentsMCPToolset'
          custom:
            $ref: '#/components/schemas/BetaManagedAgentsCustomTool'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsAgentToolset20260401'
        - $ref: '#/components/schemas/BetaManagedAgentsMCPToolset'
        - $ref: '#/components/schemas/BetaManagedAgentsCustomTool'
    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
    BetaManagedAgentsModel:
      title: BetaManagedAgentsModel
      description: |-
        为你的智能体提供支持的模型。

        更多详情和选项请参阅[模型列表](/docs/zh/api/models/list-models)。
      anyOf:
        - type: string
        - const: claude-sonnet-5
          description: 面向编程与智能体的高性能模型
          x-stainless-nominal: false
        - const: claude-fable-5
          description: 面向最艰难的知识工作与编程问题的下一代智能
          x-stainless-nominal: false
        - const: claude-opus-5
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-8
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-7
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-6
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-sonnet-4-6
          description: 速度与智能的最佳组合
          x-stainless-nominal: false
        - const: claude-haiku-4-5
          description: 具备接近前沿智能的最快模型
          x-stainless-nominal: false
        - const: claude-haiku-4-5-20251001
          description: 具备接近前沿智能的最快模型
          x-stainless-nominal: false
        - const: claude-opus-4-5
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-opus-4-5-20251101
          description: 面向长时间运行智能体和编程的强大智能
          x-stainless-nominal: false
        - const: claude-sonnet-4-5
          description: 面向智能体与编程的高性能模型
          x-stainless-nominal: false
        - const: claude-sonnet-4-5-20250929
          description: 面向智能体与编程的高性能模型
          x-stainless-nominal: false
    BetaManagedAgentsModelConfigParams:
      description: 定义对模型使用的额外配置控制的对象
      type: object
      additionalProperties: false
      required:
        - id
      properties:
        id:
          $ref: '#/components/schemas/BetaManagedAgentsModel'
        effort:
          description: >-
            模型在每次推理调用中的努力程度。接受纯级别字符串（`"high"`）或 `{"type":
            "high"}`。创建时省略会解析为对应模型的默认值；更新时省略则保持已存储的值不变。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsEffortParams'
          nullable: true
        inference_geo:
          description: >-
            模型推理的地理区域。未设置时，请求回退到工作区的 default_inference_geo。更新时，`model`
            为整对象替换——省略 inference_geo 会将其清除。
          type: string
          nullable: true
        speed:
          description: 推理速度模式。默认为 `standard`。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsSpeed'
          nullable: true
      example:
        id: claude-opus-4-8
    BetaManagedAgentsAgentToolset20260401Params:
      description: 内置智能体工具的配置。用于启用或禁用智能体可用的工具组。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - agent_toolset_20260401
        configs:
          description: 各工具的配置覆盖项。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentToolConfigParams'
        default_config:
          description: 应用于该集合中所有工具的默认配置。
          allOf:
            - $ref: >-
                #/components/schemas/BetaManagedAgentsAgentToolsetDefaultConfigParams
          nullable: true
    BetaManagedAgentsMCPToolsetParams:
      description: 在 `mcp_servers` 中定义的 MCP 服务器提供的工具的配置。
      type: object
      additionalProperties: false
      required:
        - mcp_server_name
        - type
      properties:
        mcp_server_name:
          description: MCP 服务器的名称。必须与 mcp_servers 数组中的某个 server 名称匹配。1-255 个字符。
          type: string
          minLength: 1
          maxLength: 255
        type:
          type: string
          enum:
            - mcp_toolset
        configs:
          description: 各工具的配置覆盖项。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPToolConfigParams'
        default_config:
          description: 该服务器所有工具的默认配置。
          allOf:
            - $ref: >-
                #/components/schemas/BetaManagedAgentsMCPToolsetDefaultConfigParams
          nullable: true
    BetaManagedAgentsCustomToolParams:
      description: >-
        由 API 客户端而非智能体执行的自定义工具。当智能体调用此工具时，会发出 `agent.custom_tool_use`
        事件，会话进入空闲状态，等待客户端通过 `user.custom_tool_result` 事件提供结果。
      type: object
      additionalProperties: false
      required:
        - description
        - input_schema
        - name
        - type
      properties:
        description:
          description: 对工具功能的描述，展示给智能体以帮助其决定何时使用该工具。
          type: string
          minLength: 1
        input_schema:
          description: 定义工具预期输入参数的 JSON 架构。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsCustomToolInputSchema'
        name:
          description: 工具的唯一名称。1-128 个字符；字母、数字、下划线和连字符。
          type: string
          minLength: 1
          maxLength: 128
        type:
          type: string
          enum:
            - custom
    BetaManagedAgentsURLMCPServerParams:
      description: 基于 URL 的 MCP 服务器连接。
      type: object
      additionalProperties: false
      required:
        - name
        - type
        - url
      properties:
        name:
          description: 此 server 的唯一名称，供 mcp_toolset 配置引用。1-255 个字符。
          type: string
          minLength: 1
          maxLength: 255
          examples:
            - example-mcp
        type:
          type: string
          enum:
            - url
          examples:
            - url
        url:
          description: MCP 服务器的端点 URL。
          type: string
          maxLength: 2048
          examples:
            - https://example-server.modelcontextprotocol.io/sse
      example:
        type: url
        name: example-mcp
        url: https://example-server.modelcontextprotocol.io/sse
    BetaManagedAgentsAnthropicSkillParams:
      description: OMA 管理的技能。
      type: object
      additionalProperties: false
      required:
        - skill_id
        - type
      properties:
        skill_id:
          description: OMA 技能的标识符（例如 "xlsx"）。
          type: string
          minLength: 1
          maxLength: 64
          examples:
            - xlsx
        type:
          type: string
          enum:
            - anthropic
          examples:
            - anthropic
        version:
          description: 要固定使用的版本。省略时默认为 latest。
          type: string
          minLength: 1
          maxLength: 64
          nullable: true
          examples:
            - '1'
      example:
        type: anthropic
        skill_id: xlsx
        version: '1'
    BetaManagedAgentsCustomSkillParams:
      description: 用户创建的自定义技能。
      type: object
      additionalProperties: false
      required:
        - skill_id
        - type
      properties:
        skill_id:
          description: 自定义技能的带标签 ID（例如 "skill_01XJ5..."）。
          type: string
          minLength: 1
          maxLength: 64
          examples:
            - skill_011CZkZFNu9hAbo3jZPRgTlx
        type:
          type: string
          enum:
            - custom
          examples:
            - custom
        version:
          description: 要固定使用的版本。省略时默认为 latest。
          type: string
          minLength: 1
          maxLength: 64
          nullable: true
          examples:
            - '2'
      example:
        type: custom
        skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
        version: '2'
    BetaManagedAgentsMultiagentCoordinatorParams:
      description: 一种协调者拓扑：会话的主线程通过创建会话线程来编排工作，每个线程运行一个从 `agents` 名册中选出的智能体。
      type: object
      additionalProperties: false
      required:
        - agents
        - type
      properties:
        agents:
          description: >-
            协调器可以作为会话线程启动的智能体。1–20 个条目。每个条目是一个智能体 ID 字符串、带版本的
            `{"type":"agent","id","version"}` 引用，或允许递归自调用的
            `{"type":"self"}`。条目必须引用不同的智能体（在解析 `self` 与字符串形式之后）；最多一个
            `self`。被引用的智能体必须存在、未归档，且自身未设置 `multiagent`（深度限制为 1）。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMultiagentRosterEntryParams'
          examples:
            - - agent_011CZkYqphY8vELVzwCUpqiQ
              - type: self
        type:
          type: string
          enum:
            - coordinator
          examples:
            - coordinator
      example:
        type: coordinator
        agents:
          - agent_011CZkYqphY8vELVzwCUpqiQ
          - type: self
    BetaManagedAgentsMCPServerURLDefinition:
      description: API 响应中返回的基于 URL 的 MCP 服务器连接。
      type: object
      additionalProperties: false
      required:
        - name
        - type
        - url
      properties:
        name:
          type: string
          examples:
            - example-mcp
        type:
          type: string
          enum:
            - url
          examples:
            - url
        url:
          type: string
          examples:
            - https://example-server.modelcontextprotocol.io/sse
      example:
        type: url
        name: example-mcp
        url: https://example-server.modelcontextprotocol.io/sse
    BetaManagedAgentsEffort:
      description: 模型在每轮中的努力程度。为该会话发起的每个 Messages 调用设置 `output_config.effort`。
      type: object
      discriminator:
        propertyName: type
        mapping:
          low:
            $ref: '#/components/schemas/BetaManagedAgentsEffortLow'
          medium:
            $ref: '#/components/schemas/BetaManagedAgentsEffortMedium'
          high:
            $ref: '#/components/schemas/BetaManagedAgentsEffortHigh'
          xhigh:
            $ref: '#/components/schemas/BetaManagedAgentsEffortXhigh'
          max:
            $ref: '#/components/schemas/BetaManagedAgentsEffortMax'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsEffortLow'
        - $ref: '#/components/schemas/BetaManagedAgentsEffortMedium'
        - $ref: '#/components/schemas/BetaManagedAgentsEffortHigh'
        - $ref: '#/components/schemas/BetaManagedAgentsEffortXhigh'
        - $ref: '#/components/schemas/BetaManagedAgentsEffortMax'
    BetaManagedAgentsSpeed:
      type: string
      description: 推理速度模式。`fast` 以较高价格提供显著更快的输出令牌生成速度。并非所有模型都支持 `fast`；无效组合会在创建时被拒绝。
      enum:
        - standard
        - fast
    BetaManagedAgentsMultiagentCoordinator:
      description: 已解析的协调器拓扑，包含具体的智能体列表。
      type: object
      additionalProperties: false
      required:
        - agents
        - type
      properties:
        agents:
          description: 协调器可作为会话线程派生的智能体，每个都已解析为特定版本。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMultiagentRosterEntry'
        type:
          type: string
          enum:
            - coordinator
    BetaManagedAgentsAnthropicSkill:
      description: 已解析的 OMA 托管技能。
      type: object
      additionalProperties: false
      required:
        - skill_id
        - type
        - version
      properties:
        skill_id:
          type: string
          examples:
            - xlsx
        type:
          type: string
          enum:
            - anthropic
          examples:
            - anthropic
        version:
          type: string
          examples:
            - '1'
      example:
        type: anthropic
        skill_id: xlsx
        version: '1'
    BetaManagedAgentsCustomSkill:
      description: 已解析的用户创建的自定义技能。
      type: object
      additionalProperties: false
      required:
        - skill_id
        - type
        - version
      properties:
        skill_id:
          type: string
          examples:
            - skill_011CZkZFNu9hAbo3jZPRgTlx
        type:
          type: string
          enum:
            - custom
          examples:
            - custom
        version:
          type: string
          examples:
            - '2'
      example:
        type: custom
        skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
        version: '2'
    BetaManagedAgentsAgentToolset20260401:
      type: object
      additionalProperties: false
      required:
        - configs
        - default_config
        - type
      properties:
        configs:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentToolConfig'
        default_config:
          $ref: '#/components/schemas/BetaManagedAgentsAgentToolsetDefaultConfig'
        type:
          type: string
          enum:
            - agent_toolset_20260401
    BetaManagedAgentsMCPToolset:
      type: object
      additionalProperties: false
      required:
        - configs
        - default_config
        - mcp_server_name
        - type
      properties:
        configs:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPToolConfig'
        default_config:
          $ref: '#/components/schemas/BetaManagedAgentsMCPToolsetDefaultConfig'
        mcp_server_name:
          type: string
        type:
          type: string
          enum:
            - mcp_toolset
    BetaManagedAgentsCustomTool:
      description: API 响应中返回的自定义工具。
      type: object
      additionalProperties: false
      required:
        - description
        - input_schema
        - name
        - type
      properties:
        description:
          type: string
        input_schema:
          $ref: '#/components/schemas/BetaManagedAgentsCustomToolInputSchema'
        name:
          type: string
        type:
          type: string
          enum:
            - custom
    BetaManagedAgentsEffortParams:
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsEffortLevel'
        - $ref: '#/components/schemas/BetaManagedAgentsEffort'
    BetaManagedAgentsAgentToolConfigParams:
      description: 针对工具集中某个特定工具的配置覆盖。
      type: object
      additionalProperties: false
      required:
        - name
      properties:
        name:
          $ref: '#/components/schemas/BetaManagedAgentsAgentToolName'
        enabled:
          description: 该工具是否启用且对模型可用。覆盖 default_config 的设置。
          type: boolean
          nullable: true
        permission_policy:
          description: 此工具的权限策略。控制工具调用是自动批准还是需要确认。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
          nullable: true
    BetaManagedAgentsAgentToolsetDefaultConfigParams:
      description: 工具集中所有工具的默认配置。
      type: object
      additionalProperties: false
      properties:
        enabled:
          description: 工具是否默认启用且对模型可用。未指定时默认为 true。
          type: boolean
          nullable: true
        permission_policy:
          description: 工具的默认权限策略。控制工具调用是自动批准还是需要确认。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
          nullable: true
    BetaManagedAgentsMCPToolConfigParams:
      description: 针对特定 MCP 工具的配置覆盖。
      type: object
      additionalProperties: false
      required:
        - name
      properties:
        name:
          description: 要配置的 MCP 工具的名称。1-128 个字符。
          type: string
          minLength: 1
          maxLength: 128
        enabled:
          description: 是否启用此工具。覆盖 `default_config` 设置。
          type: boolean
          nullable: true
        permission_policy:
          description: 该工具的权限策略。覆盖 `default_config` 中的设置。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
          nullable: true
    BetaManagedAgentsMCPToolsetDefaultConfigParams:
      description: MCP 服务器所有工具的默认配置。
      type: object
      additionalProperties: false
      properties:
        enabled:
          description: 工具是否默认启用。未指定时默认为 true。
          type: boolean
          nullable: true
        permission_policy:
          description: 该服务器工具的默认权限策略。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
          nullable: true
    BetaManagedAgentsCustomToolInputSchema:
      additionalProperties: true
      description: 自定义工具输入参数的 JSON 架构。
      properties:
        type:
          const: object
          title: 类型
          type: string
        properties:
          anyOf:
            - type: object
              additionalProperties: true
            - type: 'null'
          title: 属性
          x-stainless-skip:
            - terraform
        required:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: 必填字段
      required:
        - type
      type: object
    BetaManagedAgentsMultiagentRosterEntryParams:
      description: 多智能体名册中的条目：智能体 ID 字符串、带版本的智能体引用，或 `self`。
      oneOf:
        - type: string
        - oneOf:
            - $ref: '#/components/schemas/BetaManagedAgentsAgentParams'
            - $ref: '#/components/schemas/BetaManagedAgentsMultiagentSelfParams'
            - $ref: '#/components/schemas/BetaManagedAgentsAdvisorParams'
          discriminator:
            propertyName: type
            mapping:
              agent:
                $ref: '#/components/schemas/BetaManagedAgentsAgentParams'
              self:
                $ref: '#/components/schemas/BetaManagedAgentsMultiagentSelfParams'
              advisor:
                $ref: '#/components/schemas/BetaManagedAgentsAdvisorParams'
    BetaManagedAgentsEffortLow:
      description: 低推理强度。优先考虑延迟而非推理深度。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - low
    BetaManagedAgentsEffortMedium:
      description: 中等努力级别。平衡延迟与推理深度。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - medium
    BetaManagedAgentsEffortHigh:
      description: 高努力级别。偏向推理深度。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - high
    BetaManagedAgentsEffortXhigh:
      description: 超高努力级别。并非所有模型都接受此级别。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - xhigh
    BetaManagedAgentsEffortMax:
      description: 最高努力级别。倾向于推理深度而非延迟。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - max
    BetaManagedAgentsMultiagentRosterEntry:
      description: 已解析的多智能体名册条目。
      discriminator:
        propertyName: type
        mapping:
          agent:
            $ref: '#/components/schemas/BetaManagedAgentsAgentReference'
          advisor:
            $ref: '#/components/schemas/BetaManagedAgentsAdvisor'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsAgentReference'
        - $ref: '#/components/schemas/BetaManagedAgentsAdvisor'
    BetaManagedAgentsAgentToolConfig:
      description: 特定智能体工具的配置。
      type: object
      additionalProperties: false
      required:
        - enabled
        - name
        - permission_policy
      properties:
        enabled:
          type: boolean
        name:
          $ref: '#/components/schemas/BetaManagedAgentsAgentToolName'
        permission_policy:
          $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
    BetaManagedAgentsAgentToolsetDefaultConfig:
      description: 智能体工具的已解析默认配置。
      type: object
      additionalProperties: false
      required:
        - enabled
        - permission_policy
      properties:
        enabled:
          type: boolean
        permission_policy:
          $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
    BetaManagedAgentsMCPToolConfig:
      description: 特定 MCP 工具的已解析配置。
      type: object
      additionalProperties: false
      required:
        - enabled
        - name
        - permission_policy
      properties:
        enabled:
          type: boolean
        name:
          type: string
        permission_policy:
          $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
    BetaManagedAgentsMCPToolsetDefaultConfig:
      description: 已解析的来自 MCP 服务器的所有工具的默认配置。
      type: object
      additionalProperties: false
      required:
        - enabled
        - permission_policy
      properties:
        enabled:
          type: boolean
        permission_policy:
          $ref: '#/components/schemas/BetaManagedAgentsPermissionPolicy'
    BetaManagedAgentsEffortLevel:
      type: string
      description: 模型在每个回合上的投入程度。更高的级别倾向于推理深度而非延迟。并非所有模型都接受每个级别；无效的组合会在创建时被拒绝。
      enum:
        - low
        - medium
        - high
        - xhigh
        - max
    BetaManagedAgentsAgentToolName:
      type: string
      description: 内置智能体工具标识符。
      enum:
        - bash
        - edit
        - read
        - write
        - glob
        - grep
        - web_fetch
        - web_search
    BetaManagedAgentsPermissionPolicy:
      description: 工具执行的权限策略。
      type: object
      discriminator:
        propertyName: type
        mapping:
          always_allow:
            $ref: '#/components/schemas/BetaManagedAgentsAlwaysAllowPolicy'
          always_ask:
            $ref: '#/components/schemas/BetaManagedAgentsAlwaysAskPolicy'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsAlwaysAllowPolicy'
        - $ref: '#/components/schemas/BetaManagedAgentsAlwaysAskPolicy'
    BetaManagedAgentsAgentParams:
      description: 智能体的规格。可指定具体的 `version`，或使用简写形式 `agent="agent_id"` 以使用最新版本
      type: object
      additionalProperties: false
      required:
        - id
        - type
      properties:
        id:
          description: '`agent` 的 ID。'
          type: string
          minLength: 1
          maxLength: 128
        type:
          type: string
          enum:
            - agent
        version:
          description: 要使用的特定 `agent` 版本。省略则使用最新版本。指定时必须至少为 1。
          type: integer
          format: int32
    BetaManagedAgentsMultiagentSelfParams:
      description: 哨兵名册条目，表示"拥有此配置的 agent"。由服务器端解析为具体的智能体引用。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - self
          examples:
            - self
      example:
        type: self
    BetaManagedAgentsAdvisorParams:
      description: 平台顾问名册条目：会话主线程可在回合中途咨询的模型。每个名册最多一个；该条目占用名册名称 `anthropic.advisor`。
      type: object
      additionalProperties: false
      required:
        - model
        - type
      properties:
        model:
          description: 顾问模型 ID。该模型必须获准作为此智能体模型的顾问——参见会话线程顾问规范。
          type: string
          minLength: 1
          maxLength: 256
          examples:
            - claude-fable-5
        type:
          type: string
          enum:
            - advisor
          examples:
            - advisor
      example:
        type: advisor
        model: claude-fable-5
    BetaManagedAgentsAgentReference:
      description: 已解析出具体版本的智能体引用。
      type: object
      additionalProperties: false
      required:
        - id
        - type
        - version
      properties:
        id:
          type: string
          examples:
            - agent_011CZkYqphY8vELVzwCUpqiQ
        type:
          type: string
          enum:
            - agent
          examples:
            - agent
        version:
          type: integer
          format: int32
          examples:
            - 1
      example:
        type: agent
        id: agent_011CZkYqphY8vELVzwCUpqiQ
        version: 1
    BetaManagedAgentsAdvisor:
      description: 平台顾问名册条目：会话主线程在轮次中可咨询的模型。
      type: object
      additionalProperties: false
      required:
        - model
        - type
      properties:
        model:
          description: 顾问模型 ID。
          type: string
        type:
          type: string
          enum:
            - advisor
    BetaManagedAgentsAlwaysAllowPolicy:
      description: 工具调用无需用户确认即自动批准。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - always_allow
    BetaManagedAgentsAlwaysAskPolicy:
      description: 工具调用在执行前需要用户确认。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - always_ask
  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 密钥。

````