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

# Get Trace

> ViewSet for Trace operations.

IMPORTANT — Memory safety:
Traces can have hundreds of spans, each with metadata containing base64
screenshots (1MB+). Never use TraceSerializer or prefetch_related("spans")
here — that eagerly loads ALL span data and WILL OOM on 2GB instances.

Safe patterns:
- list: TraceListSerializer (no spans, just trace metadata + annotated count)
- retrieve: SpanTreeSerializer with .only() (minimal columns, no metadata)
- create/end: TraceDetailSerializer (no spans at all)
- Individual span detail: fetched separately via SpanViewSet



## OpenAPI

````yaml GET /api/tracing/traces/{trace_id}/
openapi: 3.0.3
info:
  title: Bedrock API
  version: 1.0.0
  description: API for managing agent templates, agents, organizations, and adapter state
servers: []
security: []
paths:
  /api/tracing/traces/{trace_id}/:
    get:
      tags:
        - tracing
      description: >-
        ViewSet for Trace operations.


        IMPORTANT — Memory safety:

        Traces can have hundreds of spans, each with metadata containing base64

        screenshots (1MB+). Never use TraceSerializer or
        prefetch_related("spans")

        here — that eagerly loads ALL span data and WILL OOM on 2GB instances.


        Safe patterns:

        - list: TraceListSerializer (no spans, just trace metadata + annotated
        count)

        - retrieve: SpanTreeSerializer with .only() (minimal columns, no
        metadata)

        - create/end: TraceDetailSerializer (no spans at all)

        - Individual span detail: fetched separately via SpanViewSet
      operationId: tracing_traces_retrieve
      parameters:
        - in: path
          name: trace_id
          schema:
            type: string
            format: uuid
          required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TraceDetailResponse'
          description: ''
      security:
        - tokenAuth: []
        - APIKeyAuth: []
        - ApiKeyAuth: []
components:
  schemas:
    TraceDetailResponse:
      type: object
      description: |-
        Response serializer for trace detail with tree-optimized spans.

        Spans use SpanTreeSerializer (minimal fields) for fast initial load.
        Fetch individual span details via GET /api/tracing/spans/{id}/.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
        agent:
          type: string
          format: uuid
          nullable: true
        started_at:
          type: string
          format: date-time
          readOnly: true
        ended_at:
          type: string
          format: date-time
          nullable: true
        error:
          type: string
          nullable: true
        metadata: {}
        spans:
          type: array
          items:
            $ref: '#/components/schemas/SpanTree'
        total_spans:
          type: integer
      required:
        - agent
        - ended_at
        - id
        - name
        - spans
        - started_at
        - total_spans
    SpanTree:
      type: object
      description: |-
        Ultra-light span serializer for tree rendering only.

        Excludes input_text, output_text, audio fields, and metadata
        to minimize payload size. Use GET /api/tracing/spans/{id}/ to
        fetch full span details when needed.
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        trace:
          type: string
          format: uuid
        parent:
          type: string
          format: uuid
          nullable: true
        name:
          type: string
          maxLength: 255
        span_type:
          $ref: '#/components/schemas/SpanTypeEnum'
        started_at:
          type: string
          format: date-time
          readOnly: true
        ended_at:
          type: string
          format: date-time
          nullable: true
        duration_ms:
          type: integer
          nullable: true
          description: Calculate span duration in milliseconds.
          readOnly: true
        has_error:
          type: boolean
          readOnly: true
      required:
        - duration_ms
        - has_error
        - id
        - name
        - started_at
        - trace
    SpanTypeEnum:
      enum:
        - text
        - audio
        - tool
        - function
        - llm
        - checkpoint
      type: string
      description: |-
        * `text` - Text
        * `audio` - Audio
        * `tool` - Tool
        * `function` - Function
        * `llm` - LLM
        * `checkpoint` - Checkpoint
  securitySchemes:
    tokenAuth:
      type: apiKey
      in: header
      name: Authorization
      description: Token-based authentication with required prefix "Token"
    APIKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````