> ## 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.

# Read or tail a setup run's log

> Returns the run's output after a cursor: stdout and stderr as the script produced them, marker lines naming each script line before it runs, and system lines for the setup phases around the script (provision, gpu_check, profile, cleanup). Secrets are redacted before storage. To tail a live run, loop with after=next_after and wait_seconds=0, sleeping two seconds client-side, until status is terminal and a page comes back empty.



## OpenAPI

````yaml /managed-agents/openapi.yaml get /managed-agents/v1/environments/{environment_id}/setup-runs/{setup_run_id}/log
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/{setup_run_id}/log:
    get:
      tags:
        - Environments
      summary: Read or tail a setup run's log
      description: >-
        Returns the run's output after a cursor: stdout and stderr as the script
        produced them, marker lines naming each script line before it runs, and
        system lines for the setup phases around the script (provision,
        gpu_check, profile, cleanup). Secrets are redacted before storage. To
        tail a live run, loop with after=next_after and wait_seconds=0, sleeping
        two seconds client-side, until status is terminal and a page comes back
        empty.
      operationId: managedAgentsGetEnvironmentSetupRunLog
      parameters:
        - description: >-
            Return lines with seq greater than this. Pass the previous
            response's next_after to continue a tail; 0 (the default) starts
            from the beginning.
          in: query
          name: after
          schema:
            description: >-
              Return lines with seq greater than this. Pass the previous
              response's next_after to continue a tail; 0 (the default) starts
              from the beginning.
            format: int64
            minimum: 0
            type: integer
        - description: Maximum lines to return. Defaults to 500.
          in: query
          name: limit
          schema:
            description: Maximum lines to return. Defaults to 500.
            maximum: 2000
            minimum: 1
            type: integer
        - description: >-
            When no new lines exist and the run is still going, block up to this
            many seconds for more before responding. The server caps the wait at
            5 seconds; larger values are accepted and clamped. Through the
            public API, prefer wait_seconds=0, sleep two seconds client-side,
            and loop with after=next_after until status is terminal.
          in: query
          name: wait_seconds
          schema:
            description: >-
              When no new lines exist and the run is still going, block up to
              this many seconds for more before responding. The server caps the
              wait at 5 seconds; larger values are accepted and clamped. Through
              the public API, prefer wait_seconds=0, sleep two seconds
              client-side, and loop with after=next_after until status is
              terminal.
            maximum: 60
            minimum: 0
            type: integer
        - description: Environment id (UUID).
          in: path
          name: environment_id
          required: true
          schema:
            description: Environment id (UUID).
            format: uuid
            type: string
        - description: Setup run id.
          in: path
          name: setup_run_id
          required: true
          schema:
            description: Setup run id.
            format: uuid
            type: string
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ManagedAgentsEnvironmentSetupRunLogResponse
          description: >-
            A page of a setup run's log with the cursor for the next page.
            stdout, stderr, marker (the script line about to run), and system
            (setup phase notes) are interleaved in capture order.
        '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'
        '429':
          headers:
            Retry-After:
              description: When to retry, as delay seconds or an HTTP date.
              schema:
                type: string
          description: A rate limit is exhausted. Honor `Retry-After`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAgentsApiErrorRateLimitExceeded'
        '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/ManagedAgentsApiErrorManagedAgentsUnavailable
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorServiceUnavailable
                  - $ref: >-
                      #/components/schemas/ManagedAgentsApiErrorSetupRunsUnavailable
                discriminator:
                  propertyName: code
                  mapping:
                    managed_agents_unavailable:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorManagedAgentsUnavailable
                    service_unavailable:
                      $ref: >-
                        #/components/schemas/ManagedAgentsApiErrorServiceUnavailable
                    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:
    ManagedAgentsEnvironmentSetupRunLogResponse:
      description: >-
        A page of a setup run's log with the cursor for the next page. stdout,
        stderr, marker (the script line about to run), and system (setup phase
        notes) are interleaved in capture order.
      properties:
        lines:
          description: >-
            Log lines after the requested cursor, in order. Empty when the run
            has produced nothing new within the wait.
          items:
            $ref: '#/components/schemas/ManagedAgentsEnvironmentSetupRunLogChunk'
          type: array
        next_after:
          description: >-
            Cursor to pass as after on the next call. Equal to the request's
            after when no new lines were returned.
          format: int64
          type: integer
        status:
          description: >-
            The run's status when the page was read. Stop tailing once it is
            succeeded, failed, or cancelled and the page is empty.
          type: string
        truncated:
          description: >-
            True when the run produced more output than is kept (4 MiB). The
            head is retained; the stderr tail is on the run.
          type: boolean
      required:
        - lines
        - next_after
        - status
      type: object
      example:
        lines:
          - at: '2026-02-18T09:30:00.000Z'
            line: 1
            seq: 1
            stream: example
            text: example
        next_after: 1
        status: example
        truncated: true
    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.
    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.
    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.
    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.
    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.
    ManagedAgentsEnvironmentSetupRunLogChunk:
      description: >-
        One line of a setup run's log with its stream and, when known, the
        script line that produced it.
      properties:
        at:
          description: When the line was captured.
          format: date-time
          type: string
        line:
          description: >-
            1-based setup script line this output belongs to, when known from
            the preceding marker.
          format: int64
          type: integer
        seq:
          description: >-
            Monotonic position of the line within the run. Pass the last seen
            seq as after to continue tailing.
          format: int64
          type: integer
        stream:
          description: >-
            stdout, stderr, marker (a step boundary: the script line about to
            run), or system (setup phase notes).
          type: string
        text:
          description: The line, redacted, without its trailing newline.
          type: string
      required:
        - seq
        - stream
        - at
        - text
      type: object
      example:
        at: '2026-02-18T09:30:00.000Z'
        line: 1
        seq: 1
        stream: example
        text: 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.

````