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

# Genai Traces Chat



## OpenAPI

````yaml /weave/reference/service-api/openapi.json post /agents/traces/chat
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers: []
security: []
paths:
  /agents/traces/chat:
    post:
      tags:
        - Agents
      summary: Genai Traces Chat
      operationId: genai_traces_chat_agents_traces_chat_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentTraceChatReq'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentTraceChatRes'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AgentTraceChatReq:
      properties:
        project_id:
          type: string
          title: Project Id
        trace_id:
          type: string
          title: Trace Id
        include_feedback:
          type: boolean
          title: Include Feedback
          default: false
      type: object
      required:
        - project_id
        - trace_id
      title: AgentTraceChatReq
      description: Request to get the structured chat / trajectory view for a trace.
    AgentTraceChatRes:
      properties:
        trace_id:
          type: string
          title: Trace Id
        root_span_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Span Name
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        status_code:
          anyOf:
            - type: string
              enum:
                - UNSET
                - OK
                - ERROR
            - type: 'null'
          title: Status Code
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
        total_duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Duration Ms
          description: >-
            Wall-clock duration of the trace root span in milliseconds. This is
            not a sum of child span durations.
        total_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost Usd
        messages:
          items:
            $ref: '#/components/schemas/AgentChatMessage'
          type: array
          title: Messages
        feedback:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Feedback
      type: object
      required:
        - trace_id
      title: AgentTraceChatRes
      description: |-
        Structured chat view: a linear sequence of messages representing
        the agent trajectory for a single trace.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentChatMessage:
      properties:
        type:
          type: string
          enum:
            - user_message
            - assistant_message
            - tool_call
            - agent_handoff
            - agent_start
            - context_compacted
          title: Type
        span_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Span Id
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        status_code:
          anyOf:
            - type: string
              enum:
                - UNSET
                - OK
                - ERROR
            - type: 'null'
          title: Status Code
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        user_message:
          anyOf:
            - $ref: '#/components/schemas/AgentChatUserMessage'
            - type: 'null'
        assistant_message:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAssistantMessage'
            - type: 'null'
        tool_call:
          anyOf:
            - $ref: '#/components/schemas/AgentChatToolCall'
            - type: 'null'
        agent_start:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAgentStart'
            - type: 'null'
        agent_handoff:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAgentHandoff'
            - type: 'null'
        context_compacted:
          anyOf:
            - $ref: '#/components/schemas/AgentChatContextCompacted'
            - type: 'null'
        feedback:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Feedback
      type: object
      required:
        - type
      title: AgentChatMessage
      description: >-
        A single element in the structured agent trajectory / chat view.


        Common event fields live at the top level. Type-specific fields are

        grouped under the payload matching `type`, and exactly one payload must
        be

        set. This keeps subtype nullability explicit while preserving a single

        ordered timeline model for callers.
    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
    AgentChatUserMessage:
      properties:
        text:
          type: string
          title: Text
        content_refs:
          items:
            type: string
          type: array
          title: Content Refs
      type: object
      required:
        - text
      title: AgentChatUserMessage
      description: Payload for a user prompt in the chat timeline.
    AgentChatAssistantMessage:
      properties:
        text:
          type: string
          title: Text
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        reasoning_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning Content
        reasoning_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reasoning Tokens
        input_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Input Tokens
        output_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Output Tokens
        input_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Input Cost Usd
        output_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Output Cost Usd
        total_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost Usd
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        status:
          anyOf:
            - type: string
              enum:
                - UNSET
                - OK
                - ERROR
            - type: 'null'
          title: Status
        content_refs:
          items:
            type: string
          type: array
          title: Content Refs
      type: object
      required:
        - text
      title: AgentChatAssistantMessage
      description: Payload for assistant text emitted by an agent or LLM span.
    AgentChatToolCall:
      properties:
        tool_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Name
        tool_arguments:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Arguments
        tool_result:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Result
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        status:
          anyOf:
            - type: string
              enum:
                - UNSET
                - OK
                - ERROR
            - type: 'null'
          title: Status
        content_refs:
          items:
            type: string
          type: array
          title: Content Refs
      type: object
      title: AgentChatToolCall
      description: Payload for a tool call timeline event.
    AgentChatAgentStart:
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        system_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: System Instructions
        tool_definitions:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Definitions
        status:
          anyOf:
            - type: string
              enum:
                - UNSET
                - OK
                - ERROR
            - type: 'null'
          title: Status
      type: object
      title: AgentChatAgentStart
      description: Payload for an agent lifecycle boundary.
    AgentChatAgentHandoff:
      properties: {}
      type: object
      title: AgentChatAgentHandoff
      description: Payload for a future agent-to-agent handoff event.
    AgentChatContextCompacted:
      properties:
        compaction_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Compaction Summary
        compaction_items_before:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compaction Items Before
        compaction_items_after:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compaction Items After
      type: object
      title: AgentChatContextCompacted
      description: Payload for a context-window compaction event.

````