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

# Result of one subprocess, reconstructed from its events

> Returns an `InstanceResult` for `spid` — the same shape as the
parent operation's `metadata.result` — folded from the
subprocess's event log (spawn / stdout / stderr / exit).
Works for running and terminal operations alike.  While the
process is still running, `state.exit_code` and `state.signal`
are `-1` (unknown) and `resources` holds sentinel defaults;
once the exit event lands they carry the real values.

`stdout` / `stderr` are consolidated and capped at the spec's
`truncate_output_at`.  The raw event stream stays available at
`GET /operations/{operationId}/events?spid={spid}`.




## OpenAPI

````yaml https://eu-north.nebius.computer/static/api.yaml get /operations/{operationId}/subprocesses/{spid}
openapi: 3.0.0
info:
  title: Contree API
  description: >
    Contree is a container management system combining virtual machine isolation
    with container operational efficiency. 

    Designed for security-sensitive workloads requiring hardware-enforced
    boundaries while maintaining

    container workflow compatibility.
  version: 1.0.0
servers:
  - url: '{baseUrl}/v1'
    description: |
      Nebius IAM-fronted endpoint (use `IAMBearerAuth` + `IAMProjectHeader`).
      Override `baseUrl` to point at a different deployment.
    variables:
      baseUrl:
        default: https://api.tokenfactory.nebius.com/sandboxes
        description: |
          Base URL of the contree service. Defaults to the public Nebius
          IAM-fronted endpoint; set to your self-hosted contree origin
          (e.g. `https://contree.example.com`) when running elsewhere.
security:
  - IAMBearerAuth: []
    IAMProjectHeader: []
tags:
  - name: images
    description: Operations related to container images
  - name: files
    description: Operations related to file uploads
  - name: instances
    description: Operations related to container instances
  - name: inspect
    description: Operations related to inspecting container images
  - name: operations
    description: Operations related to long-running operations
  - name: auth
    description: Authentication and token introspection
paths:
  /operations/{operationId}/subprocesses/{spid}:
    get:
      tags:
        - operation
      summary: Result of one subprocess, reconstructed from its events
      description: |
        Returns an `InstanceResult` for `spid` — the same shape as the
        parent operation's `metadata.result` — folded from the
        subprocess's event log (spawn / stdout / stderr / exit).
        Works for running and terminal operations alike.  While the
        process is still running, `state.exit_code` and `state.signal`
        are `-1` (unknown) and `resources` holds sentinel defaults;
        once the exit event lands they carry the real values.

        `stdout` / `stderr` are consolidated and capped at the spec's
        `truncate_output_at`.  The raw event stream stays available at
        `GET /operations/{operationId}/events?spid={spid}`.
      operationId: operationSubprocess
      parameters:
        - name: operationId
          in: path
          required: true
          description: The ID of the operation
          schema:
            $ref: '#/components/schemas/UUIDSchema'
        - in: path
          name: spid
          required: true
          schema:
            type: integer
            minimum: 1
          description: Spawn id (1 = main process; ≥2 = exec'd children).
      responses:
        '200':
          description: Result of the requested subprocess.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstanceResult'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: |
            Not Found — the operation does not exist, its event log has
            no `spawn` event for that spid, or the operation was
            CANCELLED (events are dropped for cancelled operations).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '425':
          description: |
            Too Early — the event source is not reachable yet (no
            worker holds the operation, or events.gz is not uploaded).
            Retry after `Retry-After`.
          headers:
            Retry-After:
              schema:
                type: integer
components:
  schemas:
    UUIDSchema:
      type: string
      format: uuid
      description: A UUID string
      example: 12345678-9abc-baba-deda-0123456789ab
    InstanceResult:
      type: object
      description: Result of an instance execution
      properties:
        resources:
          type: object
          properties:
            block_input:
              type: integer
              description: Block input operations
            block_output:
              type: integer
              description: Block output operations
            cost:
              type: number
              format: float
              description: Operation cost
            elapsed_time:
              type: number
              description: Elapsed wall time
            involuntary_switches:
              type: integer
              description: Number of involuntary context switches
            max_rss:
              type: integer
              description: Maximum resident set size in KB
            monotonic_time:
              type: number
              format: float
              description: Monotonic time measurement
            page_faults:
              type: integer
              description: Number of page faults
            page_faults_io:
              type: integer
              description: Number of page faults requiring I/O
            shared_memory:
              type: integer
              description: Shared memory size
            signals:
              type: integer
              description: Number of signals received
            swaps:
              type: integer
              description: Number of swaps
            system_cpu_time:
              type: number
              format: float
              description: System CPU time used
            unshared_memory:
              type: integer
              description: Unshared memory size
            user_cpu_time:
              type: number
              format: float
              description: User CPU time used
            voluntary_switches:
              type: integer
              description: Number of voluntary context switches
        state:
          type: object
          properties:
            continued:
              type: boolean
              description: Whether the process was continued from a stop
            core_dump:
              type: boolean
              description: Whether a core dump was generated
            exit_code:
              type: integer
              description: Process exit code
            pid:
              type: integer
              description: Process ID
            signal:
              type: integer
              description: Signal that caused termination, if any
            stopped:
              type: boolean
              description: Whether the process was stopped
            timed_out:
              type: boolean
              description: >-
                Whether process had been killed because operation timeout was
                reached
        stdout:
          $ref: '#/components/schemas/StreamRepr'
        stderr:
          $ref: '#/components/schemas/StreamRepr'
    Error:
      type: object
      required:
        - error
      properties:
        error:
          oneOf:
            - type: string
            - type: object
            - type: array
              items:
                type: object
          description: Error message or structured validation errors
          example: Some error occurred, this is an example of error message
        status:
          type: integer
          description: HTTP status code
          example: 500
        traceback:
          type: array
          items:
            type: string
    StreamRepr:
      type: object
      required:
        - value
        - encoding
      properties:
        value:
          type: string
          description: Content of the stream
          example: Y29tbWFuZCBvdXRwdXQK
        encoding:
          type: string
          enum:
            - ascii
            - base64
          description: Encoding of the content
          example: base64
        truncated:
          type: boolean
          description: Whether the output was truncated
          example: false
  responses:
    BadRequest:
      description: Bad Request - Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: |
        Unauthorized - Invalid or missing authentication credentials.
        Either the `Authorization` bearer token is missing or invalid, or
        the `Project` header is missing.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden - Token does not have sufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    IAMBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: IAM
      description: |
        IAM bearer token issued by the Nebius IAM service. Sent as
        `Authorization: Bearer <iam-token>`. Must be combined with the
        `Project` header (see `IAMProjectHeader`).

        This is the recommended authentication scheme for new clients.
    IAMProjectHeader:
      type: apiKey
      in: header
      name: Project
      description: |
        Nebius project ID associated with the IAM token. Required together
        with `IAMBearerAuth`. Identifies the project context the request is
        scoped to.

````