> ## Documentation Index
> Fetch the complete documentation index at: https://docs.labelbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run and verify the environment's setup script

> Requires Idempotency-Key because this operation provisions billable compute. Provisions fresh compute for the environment, runs its setup script exactly as a session would (same image, resources, variables, and secrets; no session credentials), records every line of output, profiles the compute, releases it, and writes the verdict to the environment's setup_verification. Returns 202 with the queued run; poll getEnvironmentSetupRun with wait_seconds until status is succeeded, failed, or cancelled. On failure read hint, failed_line, and stderr_tail first, then the log. One run at a time per environment: a second request while one is in flight is a 409 naming the run to poll. Repeating the exact request with the same Idempotency-Key replays the original 202 response without starting another run. 400 when the environment has no setup script. This spends compute.



## OpenAPI

````yaml /managed-agents/openapi.yaml post /managed-agents/v1/environments/{environment_id}/setup-runs
openapi: 3.1.0
info:
  title: Managed Agents API
  version: 0.14.0
  description: >-
    The Recursion Managed Agents REST API. Authenticate with a Recursion API key
    as a bearer token. An organization-scoped key acts in its own organization
    and needs nothing else; a tenant-scoped key must also send
    `x-organization-id` with an organization id or `default`. Field names follow
    each operation's published schema.
servers:
  - url: https://api.recursion.labelbox.com
security:
  - bearerAuth: []
paths:
  /managed-agents/v1/environments/{environment_id}/setup-runs:
    post:
      tags:
        - Environments
      summary: Run and verify the environment's setup script
      description: >-
        Requires Idempotency-Key because this operation provisions billable
        compute. Provisions fresh compute for the environment, runs its setup
        script exactly as a session would (same image, resources, variables, and
        secrets; no session credentials), records every line of output, profiles
        the compute, releases it, and writes the verdict to the environment's
        setup_verification. Returns 202 with the queued run; poll
        getEnvironmentSetupRun with wait_seconds until status is succeeded,
        failed, or cancelled. On failure read hint, failed_line, and stderr_tail
        first, then the log. One run at a time per environment: a second request
        while one is in flight is a 409 naming the run to poll. Repeating the
        exact request with the same Idempotency-Key replays the original 202
        response without starting another run. 400 when the environment has no
        setup script. This spends compute.
      operationId: managedAgentsCreateEnvironmentSetupRun
      parameters:
        - description: >-
            Environment id (UUID) as returned by createEnvironment or
            listEnvironments.
          in: path
          name: environment_id
          required: true
          schema:
            description: >-
              Environment id (UUID) as returned by createEnvironment or
              listEnvironments.
            format: uuid
            type: string
        - description: >-
            Replay-protection key in an organization-wide namespace shared by
            keyed mutations. It must contain 1 to 256 visible ASCII characters
            and be sent as exactly one header value. Request identity is the
            exact HTTP method, escaped path, raw query, and raw body bytes. For
            the legacy automation-run route only, the historical fingerprint
            ignores top-level JSON formatting and object-key order and removes
            the retired top-level idempotency_key field. The same request
            replays the original successful response; any different request
            returns 409 idempotency_conflict, and an active matching request
            returns 409 idempotency_in_progress. Completed receipts are retained
            for approximately 24 hours, pending claims may be reclaimed after
            approximately 1 hour, and no deduplication is guaranteed after
            expiry.
          in: header
          name: Idempotency-Key
          required: true
          schema:
            description: >-
              Replay-protection key in an organization-wide namespace shared by
              keyed mutations. It must contain 1 to 256 visible ASCII characters
              and be sent as exactly one header value. Request identity is the
              exact HTTP method, escaped path, raw query, and raw body bytes.
              For the legacy automation-run route only, the historical
              fingerprint ignores top-level JSON formatting and object-key order
              and removes the retired top-level idempotency_key field. The same
              request replays the original successful response; any different
              request returns 409 idempotency_conflict, and an active matching
              request returns 409 idempotency_in_progress. Completed receipts
              are retained for approximately 24 hours, pending claims may be
              reclaimed after approximately 1 hour, and no deduplication is
              guaranteed after expiry.
            maxLength: 256
            minLength: 1
            pattern: ^[!-~]+$
            type: string
      responses:
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsEnvironmentSetupRun'
          description: >-
            One execution of an environment's setup script on fresh compute:
            provision, GPU check, script, profile, image capture, cleanup. Read
            status until terminal, then hint, failed_line, and stderr_tail; the
            full log is a separate call.
          headers:
            Idempotency-Replayed:
              description: True when this response replays an earlier completed request.
              schema:
                type: boolean
              style: simple
        '400':
          description: The request was rejected by schema or semantic validation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorInvalidRequest'
        '401':
          description: The caller is unauthenticated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorUnauthorized'
        '403':
          description: The caller lacks a required permission or capability.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorForbidden'
        '404':
          description: No such resource is reachable for this caller.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorNotFound'
        '409':
          headers:
            Retry-After:
              description: >-
                When present, delay in seconds or an HTTP-date after which the
                caller may retry; absence supplies no retry advice.
              schema:
                type: string
              style: simple
          description: >-
            The request conflicts with the resource state, or with an in-flight
            idempotent replay.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorIdempotencyConflict
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorIdempotencyInProgress
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorSetupRunInProgress
                discriminator:
                  propertyName: code
                  mapping:
                    idempotency_conflict:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorIdempotencyConflict
                    idempotency_in_progress:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorIdempotencyInProgress
                    setup_run_in_progress:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorSetupRunInProgress
        '413':
          description: The request exceeds a size or transaction budget.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorPayloadTooLarge'
        '422':
          description: The request is well formed but failed semantic validation.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ManagedAgentsApiErrorSandboxProviderDisabled
        '429':
          headers:
            Retry-After:
              description: >-
                When present, delay in seconds or an HTTP-date after which the
                caller may retry; absence supplies no retry advice.
              schema:
                type: string
              style: simple
          description: A rate limit is exhausted. Honor `Retry-After`.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorRateLimitExceeded
                  - $ref: '#/components/schemas/ManagedAgentsApiErrorSetupRunLimit'
                discriminator:
                  propertyName: code
                  mapping:
                    rate_limit_exceeded:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorRateLimitExceeded
                    setup_run_limit:
                      $ref: '#/components/schemas/ManagedAgentsApiErrorSetupRunLimit'
        '500':
          description: An unexpected server-side failure.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ManagedAgentsApiErrorInternalError'
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorInvariantViolation
                discriminator:
                  propertyName: code
                  mapping:
                    internal_error:
                      $ref: '#/components/schemas/ManagedAgentsApiErrorInternalError'
                    invariant_violation:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorInvariantViolation
        '502':
          description: The service returned an invalid response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorBadGateway'
        '503':
          description: >-
            A dependency is unavailable. Consult details.retryable and
            Retry-After when present before retrying.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorIdempotencyUnavailable
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorManagedAgentsUnavailable
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorServiceUnavailable
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorSetupRunNotStarted
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorSetupRunsUnavailable
                discriminator:
                  propertyName: code
                  mapping:
                    idempotency_unavailable:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorIdempotencyUnavailable
                    managed_agents_unavailable:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorManagedAgentsUnavailable
                    service_unavailable:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorServiceUnavailable
                    setup_run_not_started:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorSetupRunNotStarted
                    setup_runs_unavailable:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorSetupRunsUnavailable
        '504':
          description: The service did not respond before the timeout.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorGatewayTimeout'
components:
  schemas:
    ManagedAgentsEnvironmentSetupRun:
      description: >-
        One execution of an environment's setup script on fresh compute:
        provision, GPU check, script, profile, image capture, cleanup. Read
        status until terminal, then hint, failed_line, and stderr_tail; the full
        log is a separate call.
      properties:
        compute_id:
          description: Provider id of the compute the run used. Released when the run ends.
          type: string
        compute_profile:
          additionalProperties: {}
          description: >-
            What the compute turned out to be: vCPUs, memory, GPUs, Docker
            state, image tools. Recorded after setup passed.
          type: object
        created_at:
          description: When the run was requested.
          format: date-time
          type: string
        duration_ms:
          description: Wall-clock duration in milliseconds, provisioning included.
          format: int64
          type: integer
        environment_id:
          description: Environment whose setup ran.
          type: string
        exit_code:
          description: >-
            Exit code of the setup script when it ran. 124 means the timeout
            elapsed.
          type: integer
        failed_command:
          description: The failing line's command as written, unexpanded.
          type: string
        failed_line:
          description: >-
            1-based line in the setup script whose command exited non-zero. 0
            when unknown.
          format: int64
          type: integer
        failure_code:
          description: >-
            Machine-readable failure class when the run did not succeed:
            environment_setup_failed, sandbox_capacity_unavailable,
            sandbox_gpu_not_ready, sandbox_provision_timeout, and so on. Same
            vocabulary as session failures.
          type: string
        fingerprint:
          description: Hash of the environment configuration the run executed.
          type: string
        finished_at:
          description: When the run reached a terminal status.
          format: date-time
          type: string
        gpu_readiness:
          additionalProperties: {}
          description: GPU readiness report for accelerator environments.
          type: object
        hint:
          description: Likely fix when the failure cause is recognised.
          type: string
        hint_code:
          description: Stable identifier of the recognised failure cause.
          type: string
        image:
          description: Runner image the compute booted.
          type: string
        imageCapture:
          $ref: '#/components/schemas/ManagedAgentsEnvironmentSetupImageCapture'
          description: Capture failure recorded without changing the setup script verdict.
        imageId:
          description: Agent Service image id being captured.
          type: string
        kind:
          description: >-
            manual (requested through the API to verify the environment) or
            session (performed while provisioning a session).
          type: string
        log_bytes:
          description: Bytes of log persisted for the run.
          format: int64
          type: integer
        log_lines:
          description: >-
            Lines of log persisted for the run. The last line's seq equals this;
            pass it as after to tail.
          format: int64
          type: integer
        log_truncated:
          description: >-
            True when the script produced more output than the run keeps (4
            MiB); the head and the stderr tail are retained.
          type: boolean
        message:
          description: One-sentence description of the outcome.
          type: string
        next_action:
          $ref: '#/components/schemas/ManagedAgentsNextAction'
          description: >-
            The call that acts on this result: re-run setup after fixing the
            script, or fetch the log.
        organization_id:
          description: Organization that owns the environment.
          type: string
        phase:
          description: >-
            Current or final phase: provision, gpu_check, setup, profile,
            commit, cleanup.
          type: string
        providerEventCursor:
          description: >-
            Last Agent Service setup event sequence persisted into this run's
            log.
          format: int64
          type: integer
        providerRunId:
          description: Durable Agent Service run id executing the setup script.
          type: string
        requested_by_user_id:
          description: User who requested a manual run.
          type: string
        session_id:
          description: Session the run provisioned, for kind session.
          type: string
        setup_run_id:
          description: Server-assigned id of the run.
          type: string
        setupImage:
          $ref: '#/components/schemas/ManagedAgentsEnvironmentSetupImage'
          description: Immutable image published by this run when capture succeeded.
        started_at:
          description: When provisioning began.
          format: date-time
          type: string
        status:
          description: >-
            queued, provisioning, running, succeeded, failed, or cancelled. Poll
            until one of the last three; getEnvironmentSetupRun accepts
            wait_seconds to do that server-side.
          type: string
        stderr_tail:
          description: Last lines of stderr, redacted and bounded to 2 KiB.
          type: string
      required:
        - organization_id
        - environment_id
        - setup_run_id
        - kind
        - status
        - created_at
      type: object
      example:
        compute_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        compute_profile:
          key: example
        created_at: '2026-02-18T09:30:00.000Z'
        duration_ms: 1
        environment_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        exit_code: 1
        failed_command: example
        failed_line: 1
        failure_code: example
        fingerprint: example
        finished_at: '2026-02-18T09:30:00.000Z'
        gpu_readiness:
          key: example
        hint: example
        hint_code: example
        image: example
        imageCapture:
          at: '2026-02-18T09:30:00.000Z'
          message: example
          reason: example
          setupRunId: example
          status: failed
        imageId: example
        kind: example
        log_bytes: 1
        log_lines: 1
        log_truncated: true
        message: example
        next_action:
          method: example
          operation_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
          path: example
        organization_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        phase: example
        providerEventCursor: 1
        providerRunId: example
        requested_by_user_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        session_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        setupImage:
          baseImageDigest: example
          capturedAt: '2026-02-18T09:30:00.000Z'
          computeId: example
          fingerprint: example
          generation: 1
          image: example
          imageId: example
          runnerImage: example
          setupRunId: example
          sizeBytes: 1
          usable: true
          warmup: example
          warmupMessage: example
        setup_run_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        started_at: '2026-02-18T09:30:00.000Z'
        status: example
        stderr_tail: example
    ManagedAgentsApiErrorInvalidRequest:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - invalid_request
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorUnauthorized:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - unauthorized
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorForbidden:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - forbidden
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorNotFound:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - not_found
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorIdempotencyConflict:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - idempotency_conflict
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorIdempotencyInProgress:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - idempotency_in_progress
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorSetupRunInProgress:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - setup_run_in_progress
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorPayloadTooLarge:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - payload_too_large
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorSandboxProviderDisabled:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - sandbox_provider_disabled
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorRateLimitExceeded:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - rate_limit_exceeded
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorSetupRunLimit:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - setup_run_limit
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorInternalError:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - internal_error
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorInvariantViolation:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - invariant_violation
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorBadGateway:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - bad_gateway
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorIdempotencyUnavailable:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - idempotency_unavailable
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorManagedAgentsUnavailable:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - managed_agents_unavailable
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorServiceUnavailable:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - service_unavailable
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorSetupRunNotStarted:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - setup_run_not_started
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorSetupRunsUnavailable:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - setup_runs_unavailable
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsApiErrorGatewayTimeout:
      type: object
      properties:
        code:
          type: string
          minLength: 1
          description: Stable machine-readable error code.
          enum:
            - gateway_timeout
        message:
          type: string
          minLength: 1
          description: Human-readable error message.
        details:
          $ref: '#/components/schemas/ManagedAgentsApiErrorDetails'
          description: >-
            Optional structured error details. Reserved transport fields are
            typed; code-specific fields remain forward compatible.
      required:
        - code
        - message
      additionalProperties: false
      description: Standard flat error response.
    ManagedAgentsEnvironmentSetupImageCapture:
      description: Why a verified setup run published no new reusable image.
      properties:
        at:
          description: When the capture failure was recorded.
          format: date-time
          type: string
        message:
          description: Sanitized bounded explanation.
          type: string
        reason:
          description: Stable Agent Service capture failure reason.
          type: string
        setupRunId:
          description: Setup run whose capture failed.
          type: string
        status:
          description: Always failed; successful capture is represented by image.
          enum:
            - failed
          type: string
      required:
        - status
        - setupRunId
        - at
      type: object
      example:
        at: '2026-02-18T09:30:00.000Z'
        message: example
        reason: example
        setupRunId: example
        status: failed
    ManagedAgentsNextAction:
      description: >-
        The literal next API call to make. Included on errors and results whose
        resolution is one known call, so a caller need not infer it.
      properties:
        method:
          description: HTTP method of that call.
          type: string
        operation_id:
          description: >-
            OpenAPI operation id of the call to make next, e.g.
            createEnvironmentSetupRun.
          type: string
        path:
          description: Path of that call with path parameters already filled in.
          type: string
      required:
        - operation_id
        - method
        - path
      type: object
      example:
        method: example
        operation_id: 9f8b1c2d-3e4f-5a6b-7c8d-9e0f1a2b3c4d
        path: example
    ManagedAgentsEnvironmentSetupImage:
      description: >-
        An immutable setup image published after a manual setup run passes.
        Identity includes the environment fingerprint, configured runner,
        observed base digest, and capture generation.
      properties:
        baseImageDigest:
          description: Immutable base image reference observed by Agent Service.
          type: string
        capturedAt:
          description: When Agent Service reported the image ready.
          format: date-time
          type: string
        computeId:
          description: Agent Service compute whose filesystem was captured.
          type: string
        fingerprint:
          description: Environment configuration fingerprint this image was produced for.
          type: string
        generation:
          description: Capture and boot contract generation.
          format: int64
          type: integer
        image:
          description: Immutable digest-pinned image reference.
          type: string
        imageId:
          description: Agent Service image id.
          type: string
        runnerImage:
          description: Exact configured runner reference selected for the captured compute.
          type: string
        setupRunId:
          description: Manual setup run that produced this image.
          type: string
        sizeBytes:
          description: Captured filesystem layer size.
          format: int64
          type: integer
        usable:
          description: >-
            Registry-free read-time projection for the active verified
            environment and configured runner. A moving tag may have changed
            since this projection; session admission resolves its exact digest
            before choosing the captured image or per-session setup.
          type: boolean
        warmup:
          description: >-
            Agent Service warmup state: pulling, verifying, ready, failed, or
            unavailable.
          type: string
        warmupMessage:
          description: Bounded Agent Service explanation of the warmup state.
          type: string
      required:
        - imageId
        - computeId
        - setupRunId
        - image
        - baseImageDigest
        - fingerprint
        - runnerImage
        - generation
        - sizeBytes
        - capturedAt
      type: object
      example:
        baseImageDigest: example
        capturedAt: '2026-02-18T09:30:00.000Z'
        computeId: example
        fingerprint: example
        generation: 1
        image: example
        imageId: example
        runnerImage: example
        setupRunId: example
        sizeBytes: 1
        usable: true
        warmup: example
        warmupMessage: example
    ManagedAgentsApiErrorDetails:
      type: object
      properties:
        field:
          description: >-
            Request field or header responsible for the error, when one can be
            identified.
          type: string
        issues:
          description: >-
            Boundary-validation failures as path-prefixed human-readable
            messages.
          type: array
          items:
            type: string
        requestId:
          description: Request correlation identifier for support and log lookup.
          type: string
        retryable:
          description: >-
            Server advice about failure transience. `true` means transient,
            `false` means non-transient, and absence gives no advice. Automatic
            replay is allowed only when this field is not `false` and the
            operation-specific retry and idempotency contract permits replay.
          type: boolean
      additionalProperties: {}
      description: >-
        Optional structured error details. Reserved transport fields are typed;
        code-specific fields remain forward compatible.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A Recursion API key, created in the console under API keys.

````