> ## 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`、`anthropic-version: 2023-06-01` 与 `anthropic-beta: managed-agents-2026-04-01`。</Info>


## OpenAPI

````yaml /openapi/oma.zh.json get /v1/deployment_runs/{deployment_run_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/deployment_runs/{deployment_run_id}:
    get:
      summary: 获取部署运行
      operationId: BetaGetDeploymentRun
      parameters:
        - name: beta
          in: query
          required: true
          description: 为此接口启用 Beta API 合同，必须为 `true`。
          schema:
            type: boolean
            enum:
              - true
        - name: anthropic-version
          in: header
          required: true
          schema:
            type: string
            x-default: '2023-06-01'
        - name: anthropic-beta
          in: header
          required: true
          schema:
            type: string
            items:
              type: string
            x-stainless-override-schema:
              x-stainless-param: betas
              x-stainless-extend-default: true
              type: array
              description: 用于指定一个或多个 Beta 版本的可选请求头。
              items:
                $ref: '#/components/schemas/AnthropicBeta'
            x-default: managed-agents-2026-04-01
        - name: deployment_run_id
          in: path
          required: true
          schema:
            type: string
          description: 部署运行标识符。
      responses:
        '200':
          description: 请求成功。
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BetaManagedAgentsDeploymentRun'
        '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:
    BetaManagedAgentsDeploymentRun:
      description: 单次部署执行的持久化、仅追加记录。记录会话创建的成功或失败——不跟踪会话生命周期。
      type: object
      additionalProperties: false
      required:
        - type
        - id
        - deployment_id
        - trigger_context
        - session_id
        - error
        - agent
        - created_at
      properties:
        type:
          type: string
          enum:
            - deployment_run
        id:
          description: 本次 run 的唯一标识符（`drun_...`）。
          type: string
        deployment_id:
          description: 产生本次 run 的部署 ID。
          type: string
        trigger_context:
          description: 触发此次运行的原因以及触发器特定的元数据。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsTriggerContext'
        session_id:
          description: 成功时填充。创建失败时为 Null。session_id 与 error 中恰好有一个非 null。
          type: string
          nullable: true
        error:
          description: 创建失败时填充。成功时为 Null。session_id 与 error 中恰好有一个非 null。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsRunError'
          nullable: true
        agent:
          description: 触发时刻该智能体的快照。始终为完全解析状态 —— 部署固定了智能体 + 版本。
          allOf:
            - $ref: '#/components/schemas/BetaManagedAgentsAgentReference'
        created_at:
          description: 此运行记录的持久化时间。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
    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
    BetaManagedAgentsTriggerContext:
      description: 描述触发部署运行的原因，并附带该触发方式特定的元数据。
      type: object
      discriminator:
        propertyName: type
        mapping:
          schedule:
            $ref: '#/components/schemas/BetaManagedAgentsScheduleTriggerContext'
          manual:
            $ref: '#/components/schemas/BetaManagedAgentsManualTriggerContext'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsScheduleTriggerContext'
        - $ref: '#/components/schemas/BetaManagedAgentsManualTriggerContext'
    BetaManagedAgentsRunError:
      description: 该 run 创建会话失败的原因。type 标识失败类型；message 为人类可读的详细信息。
      type: object
      discriminator:
        propertyName: type
        mapping:
          environment_archived_error:
            $ref: '#/components/schemas/BetaManagedAgentsEnvironmentArchivedRunError'
          agent_archived_error:
            $ref: '#/components/schemas/BetaManagedAgentsAgentArchivedRunError'
          environment_not_found_error:
            $ref: '#/components/schemas/BetaManagedAgentsEnvironmentNotFoundRunError'
          vault_not_found_error:
            $ref: '#/components/schemas/BetaManagedAgentsVaultNotFoundRunError'
          vault_archived_error:
            $ref: '#/components/schemas/BetaManagedAgentsVaultArchivedRunError'
          file_not_found_error:
            $ref: '#/components/schemas/BetaManagedAgentsFileNotFoundRunError'
          memory_store_archived_error:
            $ref: '#/components/schemas/BetaManagedAgentsMemoryStoreArchivedRunError'
          skill_not_found_error:
            $ref: '#/components/schemas/BetaManagedAgentsSkillNotFoundRunError'
          session_resource_not_found_error:
            $ref: >-
              #/components/schemas/BetaManagedAgentsSessionResourceNotFoundRunError
          workspace_archived_error:
            $ref: '#/components/schemas/BetaManagedAgentsWorkspaceArchivedRunError'
          organization_disabled_error:
            $ref: '#/components/schemas/BetaManagedAgentsOrganizationDisabledRunError'
          session_rate_limited_error:
            $ref: '#/components/schemas/BetaManagedAgentsSessionRateLimitedRunError'
          session_creation_rejected_error:
            $ref: >-
              #/components/schemas/BetaManagedAgentsSessionCreationRejectedRunError
          unknown_error:
            $ref: '#/components/schemas/BetaManagedAgentsUnknownRunError'
          self_hosted_resources_unsupported_error:
            $ref: >-
              #/components/schemas/BetaManagedAgentsSelfHostedResourcesUnsupportedRunError
          mcp_egress_blocked_error:
            $ref: '#/components/schemas/BetaManagedAgentsMcpEgressBlockedRunError'
      oneOf:
        - $ref: '#/components/schemas/BetaManagedAgentsEnvironmentArchivedRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsAgentArchivedRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsEnvironmentNotFoundRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsVaultNotFoundRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsVaultArchivedRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsFileNotFoundRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsMemoryStoreArchivedRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsSkillNotFoundRunError'
        - $ref: >-
            #/components/schemas/BetaManagedAgentsSessionResourceNotFoundRunError
        - $ref: '#/components/schemas/BetaManagedAgentsWorkspaceArchivedRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsOrganizationDisabledRunError'
        - $ref: '#/components/schemas/BetaManagedAgentsSessionRateLimitedRunError'
        - $ref: >-
            #/components/schemas/BetaManagedAgentsSessionCreationRejectedRunError
        - $ref: '#/components/schemas/BetaManagedAgentsUnknownRunError'
        - $ref: >-
            #/components/schemas/BetaManagedAgentsSelfHostedResourcesUnsupportedRunError
        - $ref: '#/components/schemas/BetaManagedAgentsMcpEgressBlockedRunError'
    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
    BetaTimestamp:
      description: RFC 3339 格式的时间戳
      type: string
      format: date-time
    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
    BetaManagedAgentsScheduleTriggerContext:
      description: 该运行由部署的 cron 计划触发。
      type: object
      additionalProperties: false
      required:
        - type
        - scheduled_at
      properties:
        type:
          type: string
          enum:
            - schedule
        scheduled_at:
          description: >-
            cron 表达式在配置的时区中匹配的时刻（UTC），在应用抖动之前。每个 (deployment_id, scheduled_at)
            组合最多记录一次运行。
          allOf:
            - $ref: '#/components/schemas/BetaTimestamp'
    BetaManagedAgentsManualTriggerContext:
      description: 该运行通过直接针对部署创建会话而手动启动。
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          type: string
          enum:
            - manual
    BetaManagedAgentsEnvironmentArchivedRunError:
      description: 该部署的环境已归档。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - environment_archived_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsAgentArchivedRunError:
      description: 该部署的智能体已被归档。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - agent_archived_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsEnvironmentNotFoundRunError:
      description: 该部署的环境已不存在。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - environment_not_found_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsVaultNotFoundRunError:
      description: 部署所引用的密钥库已不存在。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - vault_not_found_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsVaultArchivedRunError:
      description: 该部署引用的一个密钥库已被归档。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - vault_archived_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsFileNotFoundRunError:
      description: 部署引用的某个文件资源已不存在。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - file_not_found_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsMemoryStoreArchivedRunError:
      description: 部署所引用的记忆存储已被归档。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - memory_store_archived_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsSkillNotFoundRunError:
      description: 部署的智能体引用的某个技能已不存在。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - skill_not_found_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsSessionResourceNotFoundRunError:
      description: 某个被引用的资源已不存在，且未报告其类型。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - session_resource_not_found_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsWorkspaceArchivedRunError:
      description: 该部署的工作区已归档。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - workspace_archived_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsOrganizationDisabledRunError:
      description: 该部署的组织已被禁用。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - organization_disabled_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsSessionRateLimitedRunError:
      description: 会话创建因限流被拒绝。调度计划将继续触发；后续的 run 可能会成功。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - session_rate_limited_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsSessionCreationRejectedRunError:
      description: 会话创建请求因不可重试的校验错误而被拒绝。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - session_creation_rejected_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsUnknownRunError:
      description: 未知或意外的错误导致运行失败。这是一个兜底变体；无法识别新错误类型的客户端可以仅根据 message 进行匹配。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - unknown_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsSelfHostedResourcesUnsupportedRunError:
      description: 该部署配置了资源，但其环境为自托管，无法挂载这些资源。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - self_hosted_resources_unsupported_error
        message:
          description: 人类可读的错误描述。
          type: string
    BetaManagedAgentsMcpEgressBlockedRunError:
      description: 该部署的智能体所使用的某个 MCP 服务器主机被环境的网络策略阻止。
      type: object
      additionalProperties: false
      required:
        - type
        - message
      properties:
        type:
          type: string
          enum:
            - mcp_egress_blocked_error
        message:
          description: 人类可读的错误描述。
          type: string
  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 密钥。

````