> ## 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
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:
    post:
      summary: 创建会话
      operationId: BetaCreateSession
      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
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BetaManagedAgentsCreateSessionParams'
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsSession'
        '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:
    BetaManagedAgentsCreateSessionParams:
      description: 创建 `session` 的请求参数。
      type: object
      additionalProperties: false
      required:
        - agent
        - environment_id
      properties:
        agent:
          description: >-
            智能体标识符。可传入 `agent` ID 字符串（将为会话固定最新版本），或同时指定 ID 和 version 的 `agent`
            对象。
          allOf:
            - $ref: >-
                #/components/schemas/BetaManagedAgentsCreateSessionAgentUnionParams
          examples:
            - agent_011CZkYpogX7uDKUyvBTophP
        environment_id:
          description: 为该会话定义容器配置的 `environment` 的 ID。
          type: string
          minLength: 1
          maxLength: 128
          examples:
            - env_011CZkZ9X2dpNyB7HsEFoRfW
        title:
          description: 人类可读的会话标题。
          type: string
          maxLength: 500
          nullable: true
          examples:
            - '订单 #1234 咨询'
        metadata:
          description: 附加到会话的任意键值元数据。最多 16 对，键最长 64 个字符，值最长 512 个字符。
          type: object
          additionalProperties:
            type: string
        resources:
          description: 要挂载到会话容器中的资源（例如仓库、文件）。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSessionResourceParams'
        vault_ids:
          description: 智能体可在会话期间使用的已存储凭据的密钥库 ID 列表。
          type: array
          items:
            type: string
        initial_events:
          description: >-
            创建 `session` 时要发送的初始事件，按顺序处理。支持 `user.message` 和
            `user.define_outcome` 事件。最多 50 个事件。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSessionInitialEventParams'
        budget:
          description: >-
            为该会话强制执行的花费上限。省略则创建不设上限的会话。该会话可运行的每个模型——智能体自身的模型以及每个可调用智能体的模型——都必须有公开的目录价格，否则请求会以原因
            `model_not_budgetable` 被拒绝。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsBudget'
      example:
        agent: agent_011CZkYpogX7uDKUyvBTophP
        environment_id: env_011CZkZ9X2dpNyB7HsEFoRfW
        title: '订单 #1234 咨询'
    BetaManagedAgentsSession:
      description: 托管智能体的 `session`。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - status
        - created_at
        - updated_at
        - environment_id
        - title
        - metadata
        - agent
        - resources
        - vault_ids
        - outcome_evaluations
        - usage
        - stats
        - archived_at
        - budget
      properties:
        type:
          type: string
          enum:
            - session
          examples:
            - session
        id:
          type: string
          examples:
            - sesn_011CZkZAtmR3yMPDzynEDxu7
        status:
          $ref: '#/components/schemas/BetaManagedAgentsSessionStatus'
          examples:
            - idle
        created_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        updated_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        environment_id:
          type: string
          examples:
            - env_011CZkZ9X2dpNyB7HsEFoRfW
        title:
          type: string
          nullable: true
          examples:
            - '订单 #1234 咨询'
        metadata:
          type: object
          additionalProperties:
            type: string
          examples:
            - key: value
        agent:
          $ref: '#/components/schemas/BetaManagedAgentsSessionAgent'
          examples:
            - type: agent
              id: agent_011CZkYpogX7uDKUyvBTophP
              version: 1
              name: 我的第一个智能体
              description: 通用入门智能体。
              model:
                id: claude-sonnet-4-6
                speed: standard
              system: 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
              tools:
                - type: agent_toolset_20260401
                  default_config:
                    enabled: true
                    permission_policy:
                      type: always_ask
                  configs: []
              mcp_servers:
                - type: url
                  name: example-mcp
                  url: https://example-server.modelcontextprotocol.io/sse
              skills:
                - type: anthropic
                  skill_id: xlsx
                  version: '1'
                - type: custom
                  skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
                  version: '2'
              multiagent: null
        resources:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSessionResource'
          examples:
            - - type: file
                id: sesrsc_011CZkZBJq5dWxk9fVLNcPht
                file_id: file_011CNha8iCJcU1wXNR6q4V8w
                mount_path: /uploads/receipt.pdf
                created_at: '2026-03-15T10:00:00Z'
                updated_at: '2026-03-15T10:00:00Z'
              - type: github_repository
                id: sesrsc_011CZkZCKr6eXyl0gWMOdQiu
                url: https://github.com/example-org/example-repo
                mount_path: /workspace/example-repo
                checkout:
                  type: branch
                  name: main
                created_at: '2026-03-15T10:00:00Z'
                updated_at: '2026-03-15T10:00:00Z'
        vault_ids:
          description: 创建时附加到会话的密钥库 ID 列表。未提供密钥库时为空。
          type: array
          items:
            type: string
          examples:
            - - vlt_011CZkZDLs7fYzm1hXNPeRjv
        outcome_evaluations:
          description: 按结果划分的评估状态。发送给会话的每个 define_outcome 事件对应一个条目。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsOutcomeEvaluationResource'
          examples:
            - - type: outcome_evaluation
                outcome_id: outc_011CZkZRSw2kEfs6ncTVljxP
                description: 生成一份 2 页的摘要并保存为 summary.md
                result: satisfied
                iteration: 0
                completed_at: '2026-03-15T10:02:31Z'
                explanation: 五个部分均已完成，并包含行内引用。
        usage:
          description: 会话的累计令牌用量。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsSessionUsage'
          examples:
            - input_tokens: 0
              output_tokens: 0
              cache_read_input_tokens: 0
        stats:
          description: 该会话的计时统计信息。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsSessionStats'
          examples:
            - duration_seconds: 0
              active_seconds: 0
        archived_at:
          description: 会话的归档时间。未归档时为 null。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
          examples:
            - null
        deployment_id:
          description: 当会话由部署引用创建时对应的部署 ID。否则为 Null。
          type: string
          nullable: true
        budget:
          description: 会话强制执行的花费上限；未设置预算时为 null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsBudget'
          nullable: true
          examples:
            - null
      example:
        type: session
        id: sesn_011CZkZAtmR3yMPDzynEDxu7
        status: idle
        created_at: '2026-03-15T10:00:00Z'
        updated_at: '2026-03-15T10:00:00Z'
        archived_at: null
        budget: null
        environment_id: env_011CZkZ9X2dpNyB7HsEFoRfW
        title: '订单 #1234 咨询'
        metadata: {}
        agent:
          type: agent
          id: agent_011CZkYpogX7uDKUyvBTophP
          version: 1
          name: 我的第一个智能体
          description: 通用入门智能体。
          model:
            id: claude-sonnet-4-6
            speed: standard
          system: 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
          tools:
            - type: agent_toolset_20260401
              default_config:
                enabled: true
                permission_policy:
                  type: always_ask
              configs: []
          mcp_servers:
            - type: url
              name: example-mcp
              url: https://example-server.modelcontextprotocol.io/sse
          skills:
            - type: anthropic
              skill_id: xlsx
              version: '1'
            - type: custom
              skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
              version: '2'
          multiagent: null
        resources:
          - type: file
            id: sesrsc_011CZkZBJq5dWxk9fVLNcPht
            file_id: file_011CNha8iCJcU1wXNR6q4V8w
            mount_path: /uploads/receipt.pdf
            created_at: '2026-03-15T10:00:00Z'
            updated_at: '2026-03-15T10:00:00Z'
          - type: github_repository
            id: sesrsc_011CZkZCKr6eXyl0gWMOdQiu
            url: https://github.com/example-org/example-repo
            mount_path: /workspace/example-repo
            checkout:
              type: branch
              name: main
            created_at: '2026-03-15T10:00:00Z'
            updated_at: '2026-03-15T10:00:00Z'
        vault_ids:
          - vlt_011CZkZDLs7fYzm1hXNPeRjv
        usage:
          input_tokens: 0
          output_tokens: 0
          cache_read_input_tokens: 0
        stats:
          duration_seconds: 0
          active_seconds: 0
        outcome_evaluations:
          - type: outcome_evaluation
            outcome_id: outc_011CZkZRSw2kEfs6ncTVljxP
            description: 生成一份 2 页的摘要并保存为 summary.md
            result: satisfied
            iteration: 0
            completed_at: '2026-03-15T10:02:31Z'
            explanation: 五个部分均已完成，并包含行内引用。
    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
    BetaManagedAgentsCreateSessionAgentUnionParams:
      oneOf:
        - type: string
        - oneOf:
            - $ref: '#/components/schemas/BetaManagedAgentsAgentParams'
            - $ref: '#/components/schemas/BetaManagedAgentsAgentWithOverridesParams'
          discriminator:
            propertyName: type
            mapping:
              agent:
                $ref: '#/components/schemas/BetaManagedAgentsAgentParams'
              agent_with_overrides:
                $ref: '#/components/schemas/BetaManagedAgentsAgentWithOverridesParams'
    BetaManagedAgentsSessionResourceParams:
      description: 可挂载到会话的资源的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          github_repository:
            $ref: >-
              #/components/schemas/BetaManagedAgentsGitHubRepositoryResourceParams
          file:
            $ref: '#/components/schemas/BetaManagedAgentsFileResourceParams'
          memory_store:
            $ref: '#/components/schemas/BetaManagedAgentsMemoryStoreResourceParam'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsGitHubRepositoryResourceParams'
        - $ref: '#/components/schemas/BetaManagedAgentsFileResourceParams'
        - $ref: '#/components/schemas/BetaManagedAgentsMemoryStoreResourceParam'
      example:
        type: file
        file_id: file_011CNha8iCJcU1wXNR6q4V8w
        mount_path: /uploads/receipt.pdf
    BetaManagedAgentsSessionInitialEventParams:
      description: >-
        在 `session` 创建后立即发送给该 `session` 的事件。支持 `user.message` 和
        `user.define_outcome`。
      type: object
      discriminator:
        propertyName: type
        mapping:
          user.message:
            $ref: '#/components/schemas/BetaManagedAgentsUserMessageEventParams'
          user.define_outcome:
            $ref: '#/components/schemas/BetaManagedAgentsUserDefineOutcomeEventParams'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsUserMessageEventParams'
        - $ref: '#/components/schemas/BetaManagedAgentsUserDefineOutcomeEventParams'
    BetaManagedAgentsBudget:
      description: 对会话强制执行的消费上限。按 `type` 区分；`limit` 是目前唯一支持的类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          limit:
            $ref: '#/components/schemas/BetaManagedAgentsBudgetLimit'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsBudgetLimit'
    BetaManagedAgentsSessionStatus:
      type: string
      description: 会话状态枚举
      enum:
        - rescheduling
        - running
        - idle
        - terminated
    BetaTimestamp:
      description: RFC 3339 格式的时间戳
      type: string
      format: date-time
    BetaManagedAgentsSessionAgent:
      description: 已解析的 `session` 所用 `agent` 定义。`session` 创建时该 `agent` 的快照。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - version
        - name
        - description
        - model
        - system
        - tools
        - mcp_servers
        - skills
        - multiagent
      properties:
        type:
          type: string
          enum:
            - agent
          examples:
            - agent
        id:
          type: string
          examples:
            - agent_011CZkYpogX7uDKUyvBTophP
        version:
          type: integer
          format: int32
          examples:
            - 1
        name:
          type: string
          examples:
            - 我的第一个智能体
        description:
          type: string
          nullable: true
          examples:
            - 一个通用入门智能体。
        model:
          $ref: '#/components/schemas/BetaManagedAgentsModelConfig'
          examples:
            - id: claude-sonnet-4-6
              speed: standard
        system:
          type: string
          nullable: true
          examples:
            - 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
        tools:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentTool'
          examples:
            - - type: agent_toolset_20260401
                default_config:
                  enabled: true
                  permission_policy:
                    type: always_ask
                configs: []
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServer'
          examples:
            - - type: url
                name: example-mcp
                url: https://example-server.modelcontextprotocol.io/sse
        skills:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSkill'
          examples:
            - - type: anthropic
                skill_id: xlsx
                version: '1'
              - type: custom
                skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
                version: '2'
        multiagent:
          description: 已解析的多智能体编排配置。当智能体为单线程时为 Null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsSessionMultiagent'
          nullable: true
          examples:
            - null
      example:
        type: agent
        id: agent_011CZkYpogX7uDKUyvBTophP
        version: 1
        name: 我的第一个智能体
        description: 通用入门智能体。
        model:
          id: claude-sonnet-4-6
          speed: standard
        system: 你是一个通用智能体，可以研究问题、编写代码、运行命令并使用已连接的工具，端到端地完成用户任务。
        tools:
          - type: agent_toolset_20260401
            default_config:
              enabled: true
              permission_policy:
                type: always_ask
            configs: []
        mcp_servers:
          - type: url
            name: example-mcp
            url: https://example-server.modelcontextprotocol.io/sse
        skills:
          - type: anthropic
            skill_id: xlsx
            version: '1'
          - type: custom
            skill_id: skill_011CZkZFNu9hAbo3jZPRgTlx
            version: '2'
        multiagent: null
    BetaManagedAgentsSessionResource:
      type: object
      discriminator:
        propertyName: type
        mapping:
          github_repository:
            $ref: '#/components/schemas/BetaManagedAgentsGitHubRepositoryResource'
          file:
            $ref: '#/components/schemas/BetaManagedAgentsFileResource'
          memory_store:
            $ref: '#/components/schemas/BetaManagedAgentsMemoryStoreResource'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsGitHubRepositoryResource'
        - $ref: '#/components/schemas/BetaManagedAgentsFileResource'
        - $ref: '#/components/schemas/BetaManagedAgentsMemoryStoreResource'
    BetaManagedAgentsOutcomeEvaluationResource:
      description: 通过 define_outcome 事件定义的单个结果的评估状态。
      type: object
      additionalProperties: false
      required:
        - type
        - outcome_id
        - description
        - result
        - iteration
        - completed_at
        - explanation
      properties:
        type:
          type: string
          enum:
            - outcome_evaluation
          examples:
            - outcome_evaluation
        outcome_id:
          description: 服务器为此结果生成的 outc_ ID。
          type: string
          examples:
            - outc_011CZkZRSw2kEfs6ncTVljxP
        description:
          description: 智能体应产出的内容。
          type: string
          examples:
            - 生成一份两页的摘要并保存为 summary.md
        result:
          description: >-
            当前评估状态。智能体开始工作前为 `pending`；生成或修订期间为 `running`；grader 评分期间为
            `evaluating`；`satisfied`/`max_iterations_reached`/`failed`/`interrupted`
            为终态。
          type: string
          examples:
            - satisfied
        iteration:
          description: 结果当前所处的修订周期（编号从 0 开始）。
          type: integer
          format: int32
          examples:
            - 0
        completed_at:
          description: 结果到达终态结果的时间。在 `pending`、`running` 和 `evaluating` 期间为 null。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
          nullable: true
          examples:
            - '2026-03-15T10:02:31Z'
        explanation:
          description: >-
            来自最近一次评估的 grader 结论文本。对于 satisfied，说明标准为何已满足；对于
            needs_revision（中间状态），说明缺少什么；对于 failed，说明为何无法恢复。
          type: string
          nullable: true
          examples:
            - 五个部分均已完成，并包含行内引用。
      example:
        type: outcome_evaluation
        outcome_id: outc_011CZkZRSw2kEfs6ncTVljxP
        description: 生成一份 2 页的摘要并保存为 summary.md
        result: satisfied
        iteration: 0
        completed_at: '2026-03-15T10:02:31Z'
        explanation: 五个部分均已完成，并包含行内引用。
    BetaManagedAgentsSessionUsage:
      description: 会话在所有轮次中的累计令牌用量。
      type: object
      additionalProperties: false
      properties:
        input_tokens:
          description: 所有轮次消耗的输入令牌总数。
          type: integer
          format: int32
        output_tokens:
          description: 所有轮次生成的输出令牌总数。
          type: integer
          format: int32
        cache_read_input_tokens:
          description: 从提示缓存读取的令牌总数。
          type: integer
          format: int32
        cache_creation:
          description: 用于创建提示缓存条目的令牌数量，按缓存 TTL 细分。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsCacheCreationUsage'
        list_cost:
          description: 该会话所有轮次的累计列表价成本，按公开列表价计价。在该会话支持成本跟踪之前，该字段不存在。
          allOf:
            - $ref: '#/components/schemas/BetaMonetaryAmount'
          nullable: true
        server_tool_use:
          description: 跨所有轮次的服务器端执行工具累计使用量。在该会话支持服务器端工具跟踪之前，该字段不存在。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsServerToolUsage'
          nullable: true
        active_seconds:
          description: >-
            该会话至少有一个线程处于 running 状态的累计时间（秒）。并发线程重叠的活动只计一次，这与
            `stats.active_seconds` 不同，后者会累加每个线程各自的活动时间。此时长是会话运行时费用的计价依据。
          type: number
          format: double
    BetaManagedAgentsSessionStats:
      description: 会话的计时统计信息。
      type: object
      additionalProperties: false
      properties:
        duration_seconds:
          description: 自会话创建以来经过的时长（以秒为单位）。对于已终止的会话，冻结在最后一次更新时刻。
          type: number
          format: double
        active_seconds:
          description: 会话处于 running 状态的累计时间（秒）。不包含空闲时间。
          type: number
          format: double
    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
    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
    BetaManagedAgentsAgentWithOverridesParams:
      description: 对 `agent` 的引用以及可选的配置覆盖项。所提供的每个字段都会在调用方的本次使用中替换该智能体的对应值；智能体资源本身保持不变。
      type: object
      additionalProperties: false
      required:
        - type
        - id
      properties:
        type:
          type: string
          enum:
            - agent_with_overrides
        id:
          description: '`agent` 的 ID。'
          type: string
          minLength: 1
          maxLength: 128
        version:
          description: 要使用的特定 `agent` 版本。省略则使用最新版本。
          type: integer
          format: int32
        model:
          description: >-
            替换用的模型。接受模型字符串（例如 `claude-opus-4-6`）或 `model_config`
            对象。省略则使用该智能体的模型。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsModelParams'
        system:
          description: 替换用的系统提示词。最多 100,000 个字符。设为 null 可清除该智能体的系统提示词；省略则保留原值。
          type: string
          maxLength: 100000
          nullable: true
        tools:
          description: 替换用的工具列表。整体替换：所提供的数组将成为工具配置。传入空数组以清空；省略则保留智能体的工具。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentToolParams'
        mcp_servers:
          description: 替换用的 MCP 服务器列表。整体替换：所提供的数组将成为全部 MCP 服务器。传入空数组以清空；省略则保留智能体的服务器。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServerParams'
        skills:
          description: 替换用的技能列表。整体替换：所提供的数组将成为全部技能。传入空数组以清空；省略则保留智能体的技能。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSkillParams'
    BetaManagedAgentsGitHubRepositoryResourceParams:
      description: 将 GitHub 仓库挂载到会话的容器中。
      type: object
      additionalProperties: false
      required:
        - type
        - url
        - authorization_token
      properties:
        type:
          type: string
          enum:
            - github_repository
          examples:
            - github_repository
        url:
          description: GitHub 仓库地址
          type: string
          minLength: 1
          maxLength: 2048
          examples:
            - https://github.com/example-org/example-repo
        authorization_token:
          description: 用于克隆仓库的 GitHub 授权令牌。
          type: string
          minLength: 1
          maxLength: 4096
          examples:
            - ghp_exampletoken
        mount_path:
          description: 容器内的挂载路径。默认为 `/workspace/<repo-name>`。
          type: string
          minLength: 1
          maxLength: 4096
          nullable: true
        checkout:
          description: 要检出的分支或提交。默认为仓库的默认分支。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRepositoryCheckout'
          nullable: true
      example:
        type: github_repository
        url: https://github.com/example-org/example-repo
        authorization_token: ghp_exampletoken
    BetaManagedAgentsFileResourceParams:
      description: 将通过文件 API 上传的文件挂载到会话中。
      type: object
      additionalProperties: false
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - file
          examples:
            - file
        file_id:
          description: 先前上传文件的 ID。
          type: string
          minLength: 1
          maxLength: 128
          examples:
            - file_011CNha8iCJcU1wXNR6q4V8w
        mount_path:
          description: 容器内的挂载路径。默认为 `/mnt/session/uploads/<file_id>`。
          type: string
          minLength: 1
          maxLength: 4096
          nullable: true
          examples:
            - /uploads/receipt.pdf
      example:
        type: file
        file_id: file_011CNha8iCJcU1wXNR6q4V8w
        mount_path: /uploads/receipt.pdf
    BetaManagedAgentsMemoryStoreResourceParam:
      description: 将记忆存储附加到智能体会话的参数。
      type: object
      additionalProperties: false
      required:
        - type
        - memory_store_id
      properties:
        type:
          type: string
          enum:
            - memory_store
        memory_store_id:
          description: 记忆存储 ID（memstore_...）。必须属于调用方所在的组织和工作区。
          type: string
        access:
          description: 已挂载存储的访问模式。默认为 read_write。read_only 会将该存储挂载为只读文件系统。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsMountMode'
          nullable: true
        instructions:
          description: 每次挂载时为智能体提供的使用此存储的指引。将渲染到系统提示词的记忆部分。最多 4096 个字符。
          type: string
          maxLength: 4096
          nullable: true
    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 到哪里了？'
    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
    BetaManagedAgentsBudgetLimit:
      description: 硬性支出上限。一旦跟踪到的列表价成本达到 `max_list_cost`，会话便停止发起新的模型请求。
      type: object
      additionalProperties: false
      required:
        - type
        - max_list_cost
      properties:
        type:
          type: string
          enum:
            - limit
        max_list_cost:
          description: 会话可累计的最高标价费用。无论是否存在协商折扣，均按标价计算，因此该上限会在实际费用达到之时或之前触发。
          allOf:
            - $ref: '#/components/schemas/BetaMonetaryAmount'
    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
    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'
    BetaManagedAgentsMCPServer:
      description: API 响应中返回的 MCP 服务器连接定义的联合类型。
      type: object
      discriminator:
        propertyName: type
        mapping:
          url:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServerURLDefinition'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsMCPServerURLDefinition'
    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'
    BetaManagedAgentsSessionMultiagent:
      description: 在 `session` 上返回的已解析多智能体编排配置。
      discriminator:
        propertyName: type
        mapping:
          coordinator:
            $ref: '#/components/schemas/BetaManagedAgentsSessionMultiagentCoordinator'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsSessionMultiagentCoordinator'
    BetaManagedAgentsGitHubRepositoryResource:
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - url
        - mount_path
        - created_at
        - updated_at
      properties:
        type:
          type: string
          enum:
            - github_repository
          examples:
            - github_repository
        id:
          type: string
          examples:
            - sesrsc_011CZkZCKr6eXyl0gWMOdQiu
        url:
          type: string
          examples:
            - https://github.com/example-org/example-repo
        mount_path:
          type: string
          examples:
            - /workspace/example-repo
        checkout:
          $ref: '#/components/schemas/BetaManagedAgentsRepositoryCheckout'
          nullable: true
          examples:
            - type: branch
              name: main
        created_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        updated_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
      example:
        type: github_repository
        id: sesrsc_011CZkZCKr6eXyl0gWMOdQiu
        url: https://github.com/example-org/example-repo
        mount_path: /workspace/example-repo
        checkout:
          type: branch
          name: main
        created_at: '2026-03-15T10:00:00Z'
        updated_at: '2026-03-15T10:00:00Z'
    BetaManagedAgentsFileResource:
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - file_id
        - mount_path
        - created_at
        - updated_at
      properties:
        type:
          type: string
          enum:
            - file
          examples:
            - file
        id:
          type: string
          examples:
            - sesrsc_011CZkZBJq5dWxk9fVLNcPht
        file_id:
          type: string
          examples:
            - file_011CNha8iCJcU1wXNR6q4V8w
        mount_path:
          type: string
          examples:
            - /uploads/receipt.pdf
        created_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
        updated_at:
          $ref: '#/components/schemas/BetaTimestamp'
          examples:
            - '2026-03-15T10:00:00Z'
      example:
        type: file
        id: sesrsc_011CZkZBJq5dWxk9fVLNcPht
        file_id: file_011CNha8iCJcU1wXNR6q4V8w
        mount_path: /uploads/receipt.pdf
        created_at: '2026-03-15T10:00:00Z'
        updated_at: '2026-03-15T10:00:00Z'
    BetaManagedAgentsMemoryStoreResource:
      description: 附加到智能体会话的记忆存储。
      type: object
      additionalProperties: false
      required:
        - type
        - memory_store_id
      properties:
        type:
          type: string
          enum:
            - memory_store
        memory_store_id:
          description: 记忆存储 ID（memstore_...）。必须属于调用方所在的组织和工作区。
          type: string
        access:
          description: 已挂载存储的访问模式。默认为 read_write。read_only 会将该存储挂载为只读文件系统。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsMountMode'
          nullable: true
        name:
          description: 记忆存储的显示名称，在挂载时生成快照。之后对该存储名称的修改不会同步到此资源。
          type: string
          nullable: true
        description:
          description: 记忆存储的描述，在挂载时生成快照。会被注入智能体的系统提示词。存储没有描述时为空字符串。
          type: string
        instructions:
          description: 每次挂载时为智能体提供的使用此存储的指引。将渲染到系统提示词的记忆部分。最多 4096 个字符。
          type: string
          maxLength: 4096
          nullable: true
        mount_path:
          description: 该存储在会话容器中挂载的文件系统路径，例如 /mnt/memory/user-preferences。由存储的名称派生。仅输出。
          type: string
          nullable: true
    BetaManagedAgentsCacheCreationUsage:
      description: 按缓存存活时间细分的提示缓存创建令牌用量。
      type: object
      additionalProperties: false
      properties:
        ephemeral_1h_input_tokens:
          description: 用于创建 1 小时期临时缓存条目的令牌。
          type: integer
          format: int32
        ephemeral_5m_input_tokens:
          description: 用于创建 5 分钟期临时缓存条目的令牌。
          type: integer
          format: int32
    BetaMonetaryAmount:
      description: 特定货币的金额。
      type: object
      additionalProperties: false
      required:
        - currency
        - amount
      properties:
        currency:
          description: 大写的 ISO-4217 货币代码。`USD` 是目前唯一支持的货币；可接受的集合是封闭的，仅在为新货币定价时才会扩充。
          allOf:
            - $ref: '#/components/schemas/BetaCurrency'
          examples:
            - USD
        amount:
          description: >-
            以货币最小单位表示的金额，为不带前导零的十进制整数字符串："2500" 表示 $25.00，"50" 表示 50
            美分。使用字符串而非数字，以避免应用任何浮点舍入。
          type: string
          examples:
            - '2500'
      example:
        currency: USD
        amount: '2500'
    BetaManagedAgentsServerToolUsage:
      description: 由服务器执行的工具调用的累计次数，按工具分别统计。
      type: object
      additionalProperties: false
      properties:
        web_search_requests:
          description: 服务器执行的网页搜索请求数。
          type: integer
          format: int32
          examples:
            - 3
        web_fetch_requests:
          description: 服务器执行的网页抓取请求数。
          type: integer
          format: int32
          examples:
            - 0
      example:
        web_search_requests: 3
        web_fetch_requests: 0
    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'
    BetaManagedAgentsRepositoryCheckout:
      type: object
      discriminator:
        propertyName: type
        mapping:
          branch:
            $ref: '#/components/schemas/BetaManagedAgentsBranchCheckout'
          commit:
            $ref: '#/components/schemas/BetaManagedAgentsCommitCheckout'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsBranchCheckout'
        - $ref: '#/components/schemas/BetaManagedAgentsCommitCheckout'
    BetaManagedAgentsMountMode:
      type: string
      description: 已附加记忆存储的访问模式。
      enum:
        - read_write
        - read_only
    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'
    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'
    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
    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
    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
    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
    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'
    BetaManagedAgentsSessionMultiagentCoordinator:
      description: 已解析的协调器拓扑，包含每个名册成员的完整智能体定义。
      type: object
      additionalProperties: false
      required:
        - type
        - agents
      properties:
        type:
          type: string
          enum:
            - coordinator
        agents:
          description: 协调器可能作为会话线程启动的完整 `agent` 定义。
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSessionRosterEntry'
    BetaCurrency:
      type: string
      enum:
        - USD
    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'
    BetaManagedAgentsBranchCheckout:
      type: object
      additionalProperties: false
      required:
        - type
        - name
      properties:
        type:
          type: string
          enum:
            - branch
          examples:
            - branch
        name:
          description: 要检出的分支名称。
          type: string
          minLength: 1
          maxLength: 255
          examples:
            - main
      example:
        type: branch
        name: main
    BetaManagedAgentsCommitCheckout:
      type: object
      additionalProperties: false
      required:
        - type
        - sha
      properties:
        type:
          type: string
          enum:
            - commit
        sha:
          description: 要检出的完整提交 SHA。
          type: string
          minLength: 7
          maxLength: 64
    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
    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: 必须涵盖全部五个部分，并在正文中引用来源。
    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
    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'
    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
    BetaManagedAgentsSessionRosterEntry:
      description: 由会话解析的 multiagent 名册条目。
      discriminator:
        propertyName: type
        mapping:
          agent:
            $ref: '#/components/schemas/BetaManagedAgentsSessionThreadAgent'
          advisor:
            $ref: '#/components/schemas/BetaManagedAgentsAdvisor'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsSessionThreadAgent'
        - $ref: '#/components/schemas/BetaManagedAgentsAdvisor'
    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
    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'
    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'
    BetaManagedAgentsSessionThreadAgent:
      description: >-
        单个 `session_thread` 所解析出的 `agent` 定义，是线程创建时该智能体的快照。多智能体名册不会在此重复；请从
        `Session.agent` 读取。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - version
        - name
        - description
        - model
        - system
        - tools
        - mcp_servers
        - skills
      properties:
        type:
          type: string
          enum:
            - agent
          examples:
            - agent
        id:
          type: string
          examples:
            - agent_011CZkYqphY8vELVzwCUpqiQ
        version:
          type: integer
          format: int32
          examples:
            - 1
        name:
          type: string
          examples:
            - Researcher
        description:
          type: string
          nullable: true
          examples:
            - 一个专注于研究的子智能体。
        model:
          $ref: '#/components/schemas/BetaManagedAgentsModelConfig'
          examples:
            - id: claude-sonnet-4-6
              speed: standard
        system:
          type: string
          nullable: true
          examples:
            - 你是一个研究型子智能体，负责为协调智能体收集并总结资料来源。
        tools:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsAgentTool'
          examples:
            - - type: agent_toolset_20260401
                default_config:
                  enabled: true
                  permission_policy:
                    type: always_ask
                configs: []
        mcp_servers:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsMCPServer'
          examples:
            - []
        skills:
          type: array
          items:
            $ref: '#/components/schemas/BetaManagedAgentsSkill'
          examples:
            - []
      example:
        type: agent
        id: agent_011CZkYqphY8vELVzwCUpqiQ
        version: 1
        name: Researcher
        description: 一个专注的调研子智能体。
        model:
          id: claude-sonnet-4-6
          speed: standard
        system: 你是一个研究型子智能体，负责为协调智能体收集并总结资料来源。
        tools:
          - type: agent_toolset_20260401
            default_config:
              enabled: true
              permission_policy:
                type: always_ask
            configs: []
        mcp_servers: []
        skills: []
    BetaManagedAgentsAdvisor:
      description: 平台顾问名册条目：会话主线程在轮次中可咨询的模型。
      type: object
      additionalProperties: false
      required:
        - model
        - type
      properties:
        model:
          description: 顾问模型 ID。
          type: string
        type:
          type: string
          enum:
            - advisor
    BetaManagedAgentsEffortLevel:
      type: string
      description: 模型在每个回合上的投入程度。更高的级别倾向于推理深度而非延迟。并非所有模型都接受每个级别；无效的组合会在创建时被拒绝。
      enum:
        - low
        - medium
        - high
        - xhigh
        - max
    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
    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 密钥。

````