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

# Get a run trace

> Retrieve conversation turns and timing spans for an agent run.

Use the numeric agent and run IDs. Both must match a run in the requested workspace; otherwise the operation returns `404`.

The response contains a turn and span waterfall. Empty turns or spans can mean the run predates trace collection or is still in progress; an empty trace is not proof that the run failed. This operation does not start or replay the run.


## OpenAPI

````yaml GET /api/v1/workflow/{workflow_id}/runs/{run_id}/trace
openapi: 3.1.0
info:
  title: Bandwidth Agent Builder API
  version: v1
  description: >-
    Manage agents, place calls, and retrieve conversation results in your
    workspace.
servers:
  - url: https://agents.labs.bandwidth.com
    description: Workspace API
security: []
paths:
  /api/v1/workflow/{workflow_id}/runs/{run_id}/trace:
    get:
      tags:
        - agents
      summary: Get a run trace
      description: >-
        **Authorization:** Accepts a Labs OAuth bearer token or a Labs API key.
        Workspace-scoped resources require membership in the requested
        workspace.


        Retrieve conversation turns and timing spans for an agent run.
      operationId: >-
        get_workflow_run_trace_api_v1_workflow__workflow_id__runs__run_id__trace_get
      parameters:
        - in: path
          name: workflow_id
          required: true
          schema:
            title: Workflow Id
            type: integer
        - in: path
          name: run_id
          required: true
          schema:
            title: Run Id
            type: integer
        - description: >-
            Required with X-BW-LABS-AGENTS-API-KEY: the positive local workspace
            ID to access. The key owner must be a current member. Missing or
            invalid IDs return 400; non-member workspaces return 403. Not
            required for bearer authentication, which uses the user's selected
            workspace.
          in: header
          name: X-VOAI-ORGANIZATION-ID
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Required with X-BW-LABS-AGENTS-API-KEY: the positive local
              workspace ID to access. The key owner must be a current member.
              Missing or invalid IDs return 400; non-member workspaces return
              403. Not required for bearer authentication, which uses the user's
              selected workspace.
            title: X-Voai-Organization-Id
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RunTraceResponseSchema'
          description: Successful Response
        '400':
          description: Invalid request or missing/invalid workspace header with an API key.
        '401':
          description: Missing, invalid, or expired credential.
        '403':
          description: >-
            The account lacks access to the workspace, resource, or required
            role.
        '404':
          description: Not found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - LabsAuth: []
        - LabsApiKey: []
components:
  schemas:
    RunTraceResponseSchema:
      properties:
        other_spans:
          items:
            $ref: '#/components/schemas/RunTraceSpanSchema'
          title: Other Spans
          type: array
        run_id:
          title: Run Id
          type: integer
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        summary:
          $ref: '#/components/schemas/RunTraceSummarySchema'
        total_duration_ms:
          title: Total Duration Ms
          type: number
        trace_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Trace Id
        turns:
          items:
            $ref: '#/components/schemas/RunTraceTurnSchema'
          title: Turns
          type: array
      required:
        - run_id
        - total_duration_ms
        - turns
        - other_spans
        - summary
      title: RunTraceResponseSchema
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    RunTraceSpanSchema:
      properties:
        attributes:
          additionalProperties: true
          title: Attributes
          type: object
        component:
          title: Component
          type: string
        duration_ms:
          title: Duration Ms
          type: number
        name:
          title: Name
          type: string
        parent_span_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Parent Span Id
        span_id:
          title: Span Id
          type: string
        start_ms:
          title: Start Ms
          type: number
        status:
          title: Status
          type: string
        ttfb_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: Ttfb Ms
      required:
        - span_id
        - name
        - component
        - start_ms
        - duration_ms
        - status
        - attributes
      title: RunTraceSpanSchema
      type: object
    RunTraceSummarySchema:
      properties:
        avg_ttfb_ms_by_component:
          additionalProperties:
            type: number
          title: Avg Ttfb Ms By Component
          type: object
        avg_user_bot_latency_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: Avg User Bot Latency Ms
        error_count:
          title: Error Count
          type: integer
        max_user_bot_latency_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: Max User Bot Latency Ms
        turn_count:
          title: Turn Count
          type: integer
      required:
        - turn_count
        - error_count
        - avg_ttfb_ms_by_component
      title: RunTraceSummarySchema
      type: object
    RunTraceTurnSchema:
      properties:
        duration_ms:
          title: Duration Ms
          type: number
        spans:
          items:
            $ref: '#/components/schemas/RunTraceSpanSchema'
          title: Spans
          type: array
        start_ms:
          title: Start Ms
          type: number
        status:
          title: Status
          type: string
        turn_number:
          title: Turn Number
          type: integer
        user_bot_latency_ms:
          anyOf:
            - type: number
            - type: 'null'
          title: User Bot Latency Ms
        was_interrupted:
          default: false
          title: Was Interrupted
          type: boolean
      required:
        - turn_number
        - start_ms
        - duration_ms
        - status
        - spans
      title: RunTraceTurnSchema
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    LabsAuth:
      description: >-
        Bandwidth Labs OAuth access token. Uses the user's selected workspace;
        the workspace header is not required. Do not also send an API key.
        Bearer-only operations may additionally require the Labs `super_user`
        role.
      scheme: bearer
      type: http
    LabsApiKey:
      description: >-
        Bandwidth Labs API key. Also send `X-VOAI-ORGANIZATION-ID` with a
        positive local workspace ID belonging to the key owner. Access follows
        the owner's current workspace role. Do not also send a bearer token. API
        keys cannot access bearer-only or Labs `super_user` operations.
      in: header
      name: X-BW-LABS-AGENTS-API-KEY
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.