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

# Log Spans



## OpenAPI

````yaml https://api.galileo.ai/public/v2/openapi.json post /v2/projects/{project_id}/spans
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.galileo.ai
    description: Galileo Public APIs - galileo-v2
security: []
paths:
  /v2/projects/{project_id}/spans:
    post:
      tags:
        - trace
      summary: Log Spans
      operationId: log_spans_v2_projects__project_id__spans_post
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            format: uuid4
            title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LogSpansIngestRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogSpansIngestResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - OAuth2PasswordBearer: []
        - HTTPBasic: []
components:
  schemas:
    LogSpansIngestRequest:
      properties:
        log_stream_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Log Stream Id
          description: Log stream id associated with the traces.
        experiment_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Experiment Id
          description: Experiment id associated with the traces.
        metrics_testing_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Metrics Testing Id
          description: Metrics testing id associated with the traces.
        logging_method:
          $ref: '#/components/schemas/LoggingMethod'
          default: api_direct
        client_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Client Version
        reliable:
          type: boolean
          title: Reliable
          description: >-
            Whether or not to use reliable logging.  If set to False, the method
            will respond immediately before verifying that the traces have been
            successfully ingested, and no error message will be returned if
            ingestion fails.  If set to True, the method will wait for the
            traces to be successfully ingested or return an error message if
            there is an ingestion failure.
          default: true
        spans:
          items:
            oneOf:
              - $ref: '#/components/schemas/AgentSpan'
              - $ref: '#/components/schemas/WorkflowSpan'
              - $ref: '#/components/schemas/LlmSpan'
              - $ref: '#/components/schemas/RetrieverSpan'
              - $ref: '#/components/schemas/ToolSpan'
              - $ref: '#/components/schemas/ControlSpan'
            discriminator:
              propertyName: type
              mapping:
                agent:
                  $ref: '#/components/schemas/AgentSpan'
                control:
                  $ref: '#/components/schemas/ControlSpan'
                llm:
                  $ref: '#/components/schemas/LlmSpan'
                retriever:
                  $ref: '#/components/schemas/RetrieverSpan'
                tool:
                  $ref: '#/components/schemas/ToolSpan'
                workflow:
                  $ref: '#/components/schemas/WorkflowSpan'
          type: array
          minItems: 1
          title: Spans
          description: List of spans to log.
        trace_id:
          type: string
          format: uuid4
          title: Trace Id
          description: Trace id associated with the spans.
        parent_id:
          type: string
          format: uuid4
          title: Parent Id
          description: Parent trace or span id.
      type: object
      required:
        - spans
        - trace_id
        - parent_id
      title: LogSpansIngestRequest
      description: Request model for ingesting spans.
      examples:
        - log_stream_id: 00000000-0000-0000-0000-000000000000
          parent_id: 11000011-0000-0000-0000-110000110000
          spans:
            - created_at: '2026-05-06T01:09:45.842551Z'
              dataset_metadata: {}
              input: who is a smart LLM?
              metrics: {}
              name: ''
              output: I am!
              spans:
                - created_at: '2026-05-06T01:09:45.826387Z'
                  dataset_metadata: {}
                  id: 22222222-2222-4222-a222-222222222222
                  input:
                    - content: 'Question: who is a smart LLM?'
                      role: user
                  metrics: {}
                  name: ''
                  output:
                    content: I am!
                    role: user
                  tags: []
                  type: llm
                  user_metadata: {}
              tags: []
              type: workflow
              user_metadata: {}
          trace_id: 11000011-0000-0000-0000-110000110000
    LogSpansIngestResponse:
      properties:
        log_stream_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Log Stream Id
          description: Log stream id associated with the traces.
        experiment_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Experiment Id
          description: Experiment id associated with the traces.
        metrics_testing_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Metrics Testing Id
          description: Metrics testing id associated with the traces.
        project_id:
          type: string
          format: uuid4
          title: Project Id
          description: Project id associated with the traces.
        project_name:
          type: string
          title: Project Name
          description: Project name associated with the traces.
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session Id
          description: Session id associated with the traces.
        records_count:
          type: integer
          title: Records Count
          description: Total number of records ingested
        trace_id:
          type: string
          format: uuid4
          title: Trace Id
          description: Trace id associated with the spans.
        parent_id:
          type: string
          format: uuid4
          title: Parent Id
          description: Parent trace or span id.
      type: object
      required:
        - project_id
        - project_name
        - records_count
        - trace_id
        - parent_id
      title: LogSpansIngestResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    LoggingMethod:
      type: string
      enum:
        - playground
        - python_client
        - typescript_client
        - api_direct
      title: LoggingMethod
    AgentSpan:
      properties:
        type:
          type: string
          const: agent
          title: Type
          description: Type of the trace, span or session.
          default: agent
        input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
          title: Input
          description: Input to the trace or span.
          default: ''
        redacted_input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - type: 'null'
          title: Redacted Input
          description: Redacted input of the trace or span.
        output:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/Message'
            - items:
                $ref: '#/components/schemas/Document-Input'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          title: Output
          description: Output of the trace or span.
        redacted_output:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/Message'
            - items:
                $ref: '#/components/schemas/Document-Input'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          title: Redacted Output
          description: Redacted output of the trace or span.
        name:
          type: string
          title: Name
          description: Name of the trace, span or session.
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created
          description: Timestamp of the trace or span's creation.
        user_metadata:
          additionalProperties:
            type: string
          type: object
          title: User Metadata
          description: Metadata associated with this trace or span.
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags associated with this trace or span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: >-
            Status code of the trace or span. Used for logging failure or error
            states.
        metrics:
          $ref: '#/components/schemas/Metrics'
          description: Metrics associated with this trace or span.
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: A user-provided session, trace or span ID.
        dataset_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Input
          description: Input to the dataset associated with this trace
        dataset_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Output
          description: Output from the dataset associated with this trace
        dataset_metadata:
          additionalProperties:
            type: string
          type: object
          title: Dataset Metadata
          description: Metadata from the dataset associated with this trace
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: ID
          description: Galileo ID of the session, trace or span
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session ID
          description: Galileo ID of the session containing the trace or span or session
        trace_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trace ID
          description: >-
            Galileo ID of the trace containing the span (or the same value as id
            for a trace)
        step_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Number
          description: Topological step number of the span.
        parent_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parent ID
          description: Galileo ID of the parent of this span
        spans:
          items:
            oneOf:
              - $ref: '#/components/schemas/AgentSpan'
              - $ref: '#/components/schemas/WorkflowSpan'
              - $ref: '#/components/schemas/LlmSpan'
              - $ref: '#/components/schemas/RetrieverSpan'
              - $ref: '#/components/schemas/ToolSpan'
              - $ref: '#/components/schemas/ControlSpan'
            discriminator:
              propertyName: type
              mapping:
                agent:
                  $ref: '#/components/schemas/AgentSpan'
                control:
                  $ref: '#/components/schemas/ControlSpan'
                llm:
                  $ref: '#/components/schemas/LlmSpan'
                retriever:
                  $ref: '#/components/schemas/RetrieverSpan'
                tool:
                  $ref: '#/components/schemas/ToolSpan'
                workflow:
                  $ref: '#/components/schemas/WorkflowSpan'
          type: array
          title: Spans
          description: Child spans.
        agent_type:
          $ref: '#/components/schemas/AgentType'
          description: Agent type.
          default: default
      type: object
      title: AgentSpan
    WorkflowSpan:
      properties:
        type:
          type: string
          const: workflow
          title: Type
          description: Type of the trace, span or session.
          default: workflow
        input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
          title: Input
          description: Input to the trace or span.
          default: ''
        redacted_input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - type: 'null'
          title: Redacted Input
          description: Redacted input of the trace or span.
        output:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/Message'
            - items:
                $ref: '#/components/schemas/Document-Input'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          title: Output
          description: Output of the trace or span.
        redacted_output:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/Message'
            - items:
                $ref: '#/components/schemas/Document-Input'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          title: Redacted Output
          description: Redacted output of the trace or span.
        name:
          type: string
          title: Name
          description: Name of the trace, span or session.
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created
          description: Timestamp of the trace or span's creation.
        user_metadata:
          additionalProperties:
            type: string
          type: object
          title: User Metadata
          description: Metadata associated with this trace or span.
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags associated with this trace or span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: >-
            Status code of the trace or span. Used for logging failure or error
            states.
        metrics:
          $ref: '#/components/schemas/Metrics'
          description: Metrics associated with this trace or span.
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: A user-provided session, trace or span ID.
        dataset_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Input
          description: Input to the dataset associated with this trace
        dataset_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Output
          description: Output from the dataset associated with this trace
        dataset_metadata:
          additionalProperties:
            type: string
          type: object
          title: Dataset Metadata
          description: Metadata from the dataset associated with this trace
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: ID
          description: Galileo ID of the session, trace or span
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session ID
          description: Galileo ID of the session containing the trace or span or session
        trace_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trace ID
          description: >-
            Galileo ID of the trace containing the span (or the same value as id
            for a trace)
        step_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Number
          description: Topological step number of the span.
        parent_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parent ID
          description: Galileo ID of the parent of this span
        spans:
          items:
            oneOf:
              - $ref: '#/components/schemas/AgentSpan'
              - $ref: '#/components/schemas/WorkflowSpan'
              - $ref: '#/components/schemas/LlmSpan'
              - $ref: '#/components/schemas/RetrieverSpan'
              - $ref: '#/components/schemas/ToolSpan'
              - $ref: '#/components/schemas/ControlSpan'
            discriminator:
              propertyName: type
              mapping:
                agent:
                  $ref: '#/components/schemas/AgentSpan'
                control:
                  $ref: '#/components/schemas/ControlSpan'
                llm:
                  $ref: '#/components/schemas/LlmSpan'
                retriever:
                  $ref: '#/components/schemas/RetrieverSpan'
                tool:
                  $ref: '#/components/schemas/ToolSpan'
                workflow:
                  $ref: '#/components/schemas/WorkflowSpan'
          type: array
          title: Spans
          description: Child spans.
      type: object
      title: WorkflowSpan
    LlmSpan:
      properties:
        type:
          type: string
          const: llm
          title: Type
          description: Type of the trace, span or session.
          default: llm
        input:
          items:
            $ref: '#/components/schemas/Message'
          type: array
          title: Input
          description: Input to the trace or span.
        redacted_input:
          anyOf:
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - type: 'null'
          title: Redacted Input
          description: Redacted input of the trace or span.
        output:
          $ref: '#/components/schemas/Message'
          description: Output of the trace or span.
        redacted_output:
          anyOf:
            - $ref: '#/components/schemas/Message'
            - type: 'null'
          description: Redacted output of the trace or span.
        name:
          type: string
          title: Name
          description: Name of the trace, span or session.
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created
          description: Timestamp of the trace or span's creation.
        user_metadata:
          additionalProperties:
            type: string
          type: object
          title: User Metadata
          description: Metadata associated with this trace or span.
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags associated with this trace or span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: >-
            Status code of the trace or span. Used for logging failure or error
            states.
        metrics:
          $ref: '#/components/schemas/LlmMetrics'
          description: Metrics associated with this trace or span.
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: A user-provided session, trace or span ID.
        dataset_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Input
          description: Input to the dataset associated with this trace
        dataset_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Output
          description: Output from the dataset associated with this trace
        dataset_metadata:
          additionalProperties:
            type: string
          type: object
          title: Dataset Metadata
          description: Metadata from the dataset associated with this trace
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: ID
          description: Galileo ID of the session, trace or span
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session ID
          description: Galileo ID of the session containing the trace or span or session
        trace_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trace ID
          description: >-
            Galileo ID of the trace containing the span (or the same value as id
            for a trace)
        step_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Number
          description: Topological step number of the span.
        parent_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parent ID
          description: Galileo ID of the parent of this span
        tools:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tools
          description: List of available tools passed to the LLM on invocation.
        events:
          anyOf:
            - items:
                oneOf:
                  - $ref: '#/components/schemas/MessageEvent'
                  - $ref: '#/components/schemas/ReasoningEvent'
                  - $ref: '#/components/schemas/InternalToolCall'
                  - $ref: '#/components/schemas/WebSearchCallEvent'
                  - $ref: '#/components/schemas/ImageGenerationEvent'
                  - $ref: '#/components/schemas/MCPCallEvent'
                  - $ref: '#/components/schemas/MCPListToolsEvent'
                  - $ref: '#/components/schemas/MCPApprovalRequestEvent'
                discriminator:
                  propertyName: type
                  mapping:
                    image_generation:
                      $ref: '#/components/schemas/ImageGenerationEvent'
                    internal_tool_call:
                      $ref: '#/components/schemas/InternalToolCall'
                    mcp_approval_request:
                      $ref: '#/components/schemas/MCPApprovalRequestEvent'
                    mcp_call:
                      $ref: '#/components/schemas/MCPCallEvent'
                    mcp_list_tools:
                      $ref: '#/components/schemas/MCPListToolsEvent'
                    message:
                      $ref: '#/components/schemas/MessageEvent'
                    reasoning:
                      $ref: '#/components/schemas/ReasoningEvent'
                    web_search_call:
                      $ref: '#/components/schemas/WebSearchCallEvent'
              type: array
            - type: 'null'
          title: Events
          description: >-
            List of reasoning, internal tool call, or MCP events that occurred
            during the LLM span.
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Model used for this span.
        temperature:
          anyOf:
            - type: number
            - type: 'null'
          title: Temperature
          description: Temperature used for generation.
        finish_reason:
          anyOf:
            - type: string
            - type: 'null'
          title: Finish Reason
          description: Reason for finishing.
      type: object
      title: LlmSpan
    RetrieverSpan:
      properties:
        type:
          type: string
          const: retriever
          title: Type
          description: Type of the trace, span or session.
          default: retriever
        input:
          type: string
          title: Input
          description: Input to the trace or span.
          default: ''
        redacted_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Redacted Input
          description: Redacted input of the trace or span.
        output:
          items:
            $ref: '#/components/schemas/Document-Input'
          type: array
          title: Output
          description: Output of the trace or span.
        redacted_output:
          anyOf:
            - items:
                $ref: '#/components/schemas/Document-Input'
              type: array
            - type: 'null'
          title: Redacted Output
          description: Redacted output of the trace or span.
        name:
          type: string
          title: Name
          description: Name of the trace, span or session.
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created
          description: Timestamp of the trace or span's creation.
        user_metadata:
          additionalProperties:
            type: string
          type: object
          title: User Metadata
          description: Metadata associated with this trace or span.
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags associated with this trace or span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: >-
            Status code of the trace or span. Used for logging failure or error
            states.
        metrics:
          $ref: '#/components/schemas/Metrics'
          description: Metrics associated with this trace or span.
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: A user-provided session, trace or span ID.
        dataset_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Input
          description: Input to the dataset associated with this trace
        dataset_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Output
          description: Output from the dataset associated with this trace
        dataset_metadata:
          additionalProperties:
            type: string
          type: object
          title: Dataset Metadata
          description: Metadata from the dataset associated with this trace
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: ID
          description: Galileo ID of the session, trace or span
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session ID
          description: Galileo ID of the session containing the trace or span or session
        trace_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trace ID
          description: >-
            Galileo ID of the trace containing the span (or the same value as id
            for a trace)
        step_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Number
          description: Topological step number of the span.
        parent_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parent ID
          description: Galileo ID of the parent of this span
        spans:
          items:
            oneOf:
              - $ref: '#/components/schemas/AgentSpan'
              - $ref: '#/components/schemas/WorkflowSpan'
              - $ref: '#/components/schemas/LlmSpan'
              - $ref: '#/components/schemas/RetrieverSpan'
              - $ref: '#/components/schemas/ToolSpan'
              - $ref: '#/components/schemas/ControlSpan'
            discriminator:
              propertyName: type
              mapping:
                agent:
                  $ref: '#/components/schemas/AgentSpan'
                control:
                  $ref: '#/components/schemas/ControlSpan'
                llm:
                  $ref: '#/components/schemas/LlmSpan'
                retriever:
                  $ref: '#/components/schemas/RetrieverSpan'
                tool:
                  $ref: '#/components/schemas/ToolSpan'
                workflow:
                  $ref: '#/components/schemas/WorkflowSpan'
          type: array
          title: Spans
          description: Child spans.
      type: object
      title: RetrieverSpan
    ToolSpan:
      properties:
        type:
          type: string
          const: tool
          title: Type
          description: Type of the trace, span or session.
          default: tool
        input:
          type: string
          title: Input
          description: Input to the trace or span.
          default: ''
        redacted_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Redacted Input
          description: Redacted input of the trace or span.
        output:
          anyOf:
            - type: string
            - type: 'null'
          title: Output
          description: Output of the trace or span.
        redacted_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Redacted Output
          description: Redacted output of the trace or span.
        name:
          type: string
          title: Name
          description: Name of the trace, span or session.
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created
          description: Timestamp of the trace or span's creation.
        user_metadata:
          additionalProperties:
            type: string
          type: object
          title: User Metadata
          description: Metadata associated with this trace or span.
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags associated with this trace or span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: >-
            Status code of the trace or span. Used for logging failure or error
            states.
        metrics:
          $ref: '#/components/schemas/Metrics'
          description: Metrics associated with this trace or span.
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: A user-provided session, trace or span ID.
        dataset_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Input
          description: Input to the dataset associated with this trace
        dataset_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Output
          description: Output from the dataset associated with this trace
        dataset_metadata:
          additionalProperties:
            type: string
          type: object
          title: Dataset Metadata
          description: Metadata from the dataset associated with this trace
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: ID
          description: Galileo ID of the session, trace or span
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session ID
          description: Galileo ID of the session containing the trace or span or session
        trace_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trace ID
          description: >-
            Galileo ID of the trace containing the span (or the same value as id
            for a trace)
        step_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Number
          description: Topological step number of the span.
        parent_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parent ID
          description: Galileo ID of the parent of this span
        spans:
          items:
            oneOf:
              - $ref: '#/components/schemas/AgentSpan'
              - $ref: '#/components/schemas/WorkflowSpan'
              - $ref: '#/components/schemas/LlmSpan'
              - $ref: '#/components/schemas/RetrieverSpan'
              - $ref: '#/components/schemas/ToolSpan'
              - $ref: '#/components/schemas/ControlSpan'
            discriminator:
              propertyName: type
              mapping:
                agent:
                  $ref: '#/components/schemas/AgentSpan'
                control:
                  $ref: '#/components/schemas/ControlSpan'
                llm:
                  $ref: '#/components/schemas/LlmSpan'
                retriever:
                  $ref: '#/components/schemas/RetrieverSpan'
                tool:
                  $ref: '#/components/schemas/ToolSpan'
                workflow:
                  $ref: '#/components/schemas/WorkflowSpan'
          type: array
          title: Spans
          description: Child spans.
        tool_call_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Call Id
          description: ID of the tool call.
      type: object
      title: ToolSpan
    ControlSpan:
      properties:
        type:
          type: string
          const: control
          title: Type
          description: Type of the trace, span or session.
          default: control
        input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
          title: Input
          description: Input to the trace or span.
          default: ''
        redacted_input:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
            - type: 'null'
          title: Redacted Input
          description: Redacted input of the trace or span.
        output:
          anyOf:
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          description: Output of the trace or span.
        redacted_output:
          anyOf:
            - $ref: '#/components/schemas/ControlResult'
            - type: 'null'
          description: Redacted output of the trace or span.
        name:
          type: string
          title: Name
          description: Name of the trace, span or session.
          default: ''
        created_at:
          type: string
          format: date-time
          title: Created
          description: Timestamp of the trace or span's creation.
        user_metadata:
          additionalProperties:
            type: string
          type: object
          title: User Metadata
          description: Metadata associated with this trace or span.
        tags:
          items:
            type: string
          type: array
          title: Tags
          description: Tags associated with this trace or span.
        status_code:
          anyOf:
            - type: integer
            - type: 'null'
          title: Status Code
          description: >-
            Status code of the trace or span. Used for logging failure or error
            states.
        metrics:
          $ref: '#/components/schemas/Metrics'
          description: Metrics associated with this trace or span.
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: A user-provided session, trace or span ID.
        dataset_input:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Input
          description: Input to the dataset associated with this trace
        dataset_output:
          anyOf:
            - type: string
            - type: 'null'
          title: Dataset Output
          description: Output from the dataset associated with this trace
        dataset_metadata:
          additionalProperties:
            type: string
          type: object
          title: Dataset Metadata
          description: Metadata from the dataset associated with this trace
        id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: ID
          description: Galileo ID of the session, trace or span
        session_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Session ID
          description: Galileo ID of the session containing the trace or span or session
        trace_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Trace ID
          description: >-
            Galileo ID of the trace containing the span (or the same value as id
            for a trace)
        step_number:
          anyOf:
            - type: integer
            - type: 'null'
          title: Step Number
          description: Topological step number of the span.
        parent_id:
          anyOf:
            - type: string
              format: uuid4
            - type: 'null'
          title: Parent ID
          description: Galileo ID of the parent of this span
        control_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Control Id
          description: Identifier of the control definition that produced this span.
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
          description: Normalized agent name associated with this control execution.
        check_stage:
          anyOf:
            - $ref: '#/components/schemas/ControlCheckStage'
            - type: 'null'
          description: Execution stage where the control ran, typically 'pre' or 'post'.
        applies_to:
          anyOf:
            - $ref: '#/components/schemas/ControlAppliesTo'
            - type: 'null'
          description: >-
            Parent execution type the control applied to, for example 'llm_call'
            or 'tool_call'.
        evaluator_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Evaluator Name
          description: >-
            Representative evaluator name for this control span. For composite
            controls, this is the primary evaluator chosen for observability
            identity.
        selector_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Selector Path
          description: >-
            Representative selector path for this control span. For composite
            controls, this is the primary selector path chosen for observability
            identity.
      type: object
      title: ControlSpan
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    Message:
      properties:
        content:
          anyOf:
            - type: string
            - items:
                oneOf:
                  - $ref: '#/components/schemas/TextContentPart'
                  - $ref: '#/components/schemas/FileContentPart'
                discriminator:
                  propertyName: type
                  mapping:
                    file:
                      $ref: '#/components/schemas/FileContentPart'
                    text:
                      $ref: '#/components/schemas/TextContentPart'
              type: array
          title: Content
        role:
          $ref: '#/components/schemas/MessageRole'
        tool_call_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Call Id
        tool_calls:
          anyOf:
            - items:
                $ref: '#/components/schemas/ToolCall'
              type: array
            - type: 'null'
          title: Tool Calls
      type: object
      required:
        - content
        - role
      title: Message
    TextContentPart:
      properties:
        type:
          type: string
          const: text
          title: Type
          default: text
        text:
          type: string
          title: Text
      type: object
      required:
        - text
      title: TextContentPart
      description: A text segment within a message.
    FileContentPart:
      properties:
        type:
          type: string
          const: file
          title: Type
          default: file
        file_id:
          type: string
          format: uuid4
          title: File Id
      type: object
      required:
        - file_id
      title: FileContentPart
      description: |-
        Reference to a file associated with this message.

        The file_id can be resolved via the ``files`` dict returned on
        trace/span detail responses, which contains metadata such as
        modality, MIME type, and a presigned download URL.
    Document-Input:
      properties:
        page_content:
          type: string
          title: Page Content
          description: Content of the document.
        metadata:
          additionalProperties:
            anyOf:
              - type: boolean
              - type: string
              - type: integer
              - type: number
          type: object
          title: Metadata
      additionalProperties: false
      type: object
      required:
        - page_content
      title: Document
    ControlResult:
      properties:
        action:
          $ref: '#/components/schemas/ControlAction'
          description: Decision/action produced by the control.
        matched:
          type: boolean
          title: Matched
          description: >-
            Whether the control matched. False covers both non-match and error
            cases; use error_message to distinguish errors.
        confidence:
          anyOf:
            - type: number
            - type: 'null'
          title: Confidence
          description: Confidence score reported by the control evaluation result.
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: >-
            Error text when control evaluation failed. This should be null for
            normal matches and non-matches.
      type: object
      required:
        - action
        - matched
      title: ControlResult
    Metrics:
      properties:
        duration_ns:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ns
          description: >-
            Duration of the trace or span in nanoseconds.  Displayed as
            'Latency' in Galileo.
      additionalProperties: true
      type: object
      title: Metrics
    AgentType:
      type: string
      enum:
        - default
        - planner
        - react
        - reflection
        - router
        - classifier
        - supervisor
        - judge
      title: AgentType
    LlmMetrics:
      properties:
        duration_ns:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ns
          description: >-
            Duration of the trace or span in nanoseconds.  Displayed as
            'Latency' in Galileo.
        num_input_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Input Tokens
          description: Number of input tokens.
        num_output_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Output Tokens
          description: Number of output tokens.
        num_total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Num Total Tokens
          description: Total number of tokens.
        time_to_first_token_ns:
          anyOf:
            - type: integer
            - type: 'null'
          title: Time To First Token Ns
          description: Time until the first token was generated in nanoseconds.
      additionalProperties: true
      type: object
      title: LlmMetrics
    MessageEvent:
      properties:
        type:
          type: string
          const: message
          title: Type
          default: message
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        role:
          $ref: '#/components/schemas/MessageRole'
          description: Role of the message sender
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: Text content of the message
        content_parts:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Content Parts
          description: Structured content items (text, audio, images, etc.)
      type: object
      required:
        - role
      title: MessageEvent
      description: An output message from the model.
    ReasoningEvent:
      properties:
        type:
          type: string
          const: reasoning
          title: Type
          default: reasoning
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: The reasoning/thinking content
        summary:
          anyOf:
            - type: string
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Summary
          description: Summary of the reasoning
      type: object
      title: ReasoningEvent
      description: >-
        Internal reasoning/thinking from the model (e.g., OpenAI o1/o3 reasoning
        tokens).
    InternalToolCall:
      properties:
        type:
          type: string
          const: internal_tool_call
          title: Type
          default: internal_tool_call
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        name:
          type: string
          title: Name
          description: >-
            Name of the internal tool (e.g., 'web_search', 'code_interpreter',
            'file_search')
        input:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Input
          description: Input/arguments to the tool call
        output:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Output
          description: Output/results from the tool call
      type: object
      required:
        - name
      title: InternalToolCall
      description: >-
        A tool call executed internally by the model during reasoning.


        This represents internal tools like web search, code execution, file
        search, etc.

        that the model invokes (not user-defined functions or MCP tools).
    WebSearchCallEvent:
      properties:
        type:
          type: string
          const: web_search_call
          title: Type
          default: web_search_call
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        action:
          $ref: '#/components/schemas/WebSearchAction'
          description: Web search action payload
      type: object
      required:
        - action
      title: WebSearchCallEvent
      description: An OpenAI-style web search call event.
    ImageGenerationEvent:
      properties:
        type:
          type: string
          const: image_generation
          title: Type
          default: image_generation
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Prompt
          description: The prompt used for image generation
        images:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Images
          description: Generated images with URLs or base64 data
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Image generation model used
      type: object
      title: ImageGenerationEvent
      description: An image generation event from the model.
    MCPCallEvent:
      properties:
        type:
          type: string
          const: mcp_call
          title: Type
          default: mcp_call
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        tool_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Name
          description: Name of the MCP tool being called
        server_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Server Name
          description: Name of the MCP server
        arguments:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Arguments
          description: Arguments for the MCP tool call
        result:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Result
          description: Result from the MCP tool call
      type: object
      title: MCPCallEvent
      description: >-
        A Model Context Protocol (MCP) tool call.


        MCP is a protocol for connecting LLMs to external tools/data sources.

        This is distinct from internal tools because it involves external
        integrations.
    MCPListToolsEvent:
      properties:
        type:
          type: string
          const: mcp_list_tools
          title: Type
          default: mcp_list_tools
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        server_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Server Name
          description: Name of the MCP server
        tools:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Tools
          description: List of available MCP tools
      type: object
      title: MCPListToolsEvent
      description: MCP list tools event - when the model queries available MCP tools.
    MCPApprovalRequestEvent:
      properties:
        type:
          type: string
          const: mcp_approval_request
          title: Type
          default: mcp_approval_request
        id:
          anyOf:
            - type: string
            - type: 'null'
          title: Id
          description: Unique identifier for the event
        status:
          anyOf:
            - $ref: '#/components/schemas/EventStatus'
            - type: 'null'
          description: Status of the event
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Provider-specific metadata and additional fields
        error_message:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Message
          description: Error message if the event failed
        tool_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Name
          description: Name of the MCP tool requiring approval
        tool_invocation:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Tool Invocation
          description: Details of the tool invocation requiring approval
        approved:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Approved
          description: Whether the request was approved
      type: object
      title: MCPApprovalRequestEvent
      description: >-
        MCP approval request - when human approval is needed for an MCP tool
        call.
    ControlCheckStage:
      type: string
      enum:
        - pre
        - post
      title: ControlCheckStage
    ControlAppliesTo:
      type: string
      enum:
        - llm_call
        - tool_call
      title: ControlAppliesTo
    MessageRole:
      type: string
      enum:
        - agent
        - assistant
        - developer
        - function
        - system
        - tool
        - user
      title: MessageRole
    ToolCall:
      properties:
        id:
          type: string
          title: Id
        function:
          $ref: '#/components/schemas/ToolCallFunction'
      type: object
      required:
        - id
        - function
      title: ToolCall
    ControlAction:
      type: string
      enum:
        - deny
        - steer
        - observe
      title: ControlAction
    EventStatus:
      type: string
      enum:
        - in_progress
        - completed
        - failed
        - cancelled
        - incomplete
      title: EventStatus
      description: Common status values for events.
    WebSearchAction:
      properties:
        type:
          type: string
          const: search
          title: Type
          description: Type of web search action
        query:
          anyOf:
            - type: string
            - type: 'null'
          title: Query
          description: Search query string
        sources:
          anyOf:
            - {}
            - type: 'null'
          title: Sources
          description: Optional provider-specific sources
      type: object
      required:
        - type
      title: WebSearchAction
      description: Action payload for a web search call event.
    ToolCallFunction:
      properties:
        name:
          type: string
          title: Name
        arguments:
          type: string
          title: Arguments
      type: object
      required:
        - name
        - arguments
      title: ToolCallFunction
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Galileo-API-Key
    OAuth2PasswordBearer:
      type: oauth2
      flows:
        password:
          scopes: {}
          tokenUrl: https://api.galileo.ai/login
    HTTPBasic:
      type: http
      scheme: basic

````