> ## 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.

# Chat des traces Genai



## OpenAPI

````yaml /fr/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: Chat des traces Genai
      operationId: genai_traces_chat_agents_traces_chat_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentTraceChatReq'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentTraceChatRes'
          description: Réponse réussie
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Erreur de validation
components:
  schemas:
    AgentTraceChatReq:
      description: >-
        Requête permettant d'obtenir la vue structurée de chat / trajectoire
        pour une trace.
      properties:
        include_feedback:
          default: false
          title: Include Feedback
          type: boolean
        project_id:
          title: Project Id
          type: string
        trace_id:
          title: Trace Id
          type: string
      required:
        - project_id
        - trace_id
      title: AgentTraceChatReq
      type: object
    AgentTraceChatRes:
      description: "Vue de chat structurée\_: une séquence linéaire de messages représentant la trajectoire de l'agent pour une seule trace."
      properties:
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        feedback:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Feedback
        messages:
          items:
            $ref: '#/components/schemas/AgentChatMessage'
          title: Messages
          type: array
        provider:
          anyOf:
            - type: string
            - type: 'null'
          title: Provider
        root_span_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Root Span Name
        status_code:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status Code
        total_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost Usd
        total_duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            Durée réelle du span racine de la trace, en millisecondes. Il ne
            s'agit pas d'une somme des durées des spans enfants.
          title: Total Duration Ms
        trace_id:
          title: Trace Id
          type: string
      required:
        - trace_id
      title: AgentTraceChatRes
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    AgentChatMessage:
      description: >-
        Un élément unique de la trajectoire structurée de l’agent / vue de chat.


        Les champs d’événement communs se trouvent au niveau supérieur. Les
        champs propres au type sont

        groupés sous la charge utile correspondant à `type`, et une seule charge
        utile doit être

        définie. Cela permet de rendre explicite la nullabilité des sous-types
        tout en conservant un

        modèle unique de chronologie ordonnée pour les appelants.
      properties:
        agent_handoff:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAgentHandoff'
            - type: 'null'
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_start:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAgentStart'
            - type: 'null'
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        assistant_message:
          anyOf:
            - $ref: '#/components/schemas/AgentChatAssistantMessage'
            - type: 'null'
        context_compacted:
          anyOf:
            - $ref: '#/components/schemas/AgentChatContextCompacted'
            - type: 'null'
        feedback:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Feedback
        span_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Span Id
        started_at:
          anyOf:
            - format: date-time
              type: string
            - type: 'null'
          title: Started At
        status_code:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status Code
        tool_call:
          anyOf:
            - $ref: '#/components/schemas/AgentChatToolCall'
            - type: 'null'
        type:
          enum:
            - user_message
            - assistant_message
            - tool_call
            - agent_handoff
            - agent_start
            - context_compacted
          title: Type
          type: string
        user_message:
          anyOf:
            - $ref: '#/components/schemas/AgentChatUserMessage'
            - type: 'null'
      required:
        - type
      title: AgentChatMessage
      type: object
    ValidationError:
      properties:
        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
    AgentChatAgentHandoff:
      description: Charge utile pour un futur événement de transfert d’agent à agent.
      properties: {}
      title: AgentChatAgentHandoff
      type: object
    AgentChatAgentStart:
      description: Charge utile pour une limite du cycle de vie d’un agent.
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        status:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status
        system_instructions:
          anyOf:
            - type: string
            - type: 'null'
          title: System Instructions
        tool_definitions:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Definitions
      title: AgentChatAgentStart
      type: object
    AgentChatAssistantMessage:
      description: Charge utile pour du texte d’assistant émis par un agent ou un span LLM.
      properties:
        content_refs:
          items:
            type: string
          title: Content Refs
          type: array
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        input_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Input Cost Usd
        input_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Input Tokens
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
        output_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Output Cost Usd
        output_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Output Tokens
        reasoning_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Reasoning Content
        reasoning_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Reasoning Tokens
        status:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status
        text:
          title: Text
          type: string
        total_cost_usd:
          anyOf:
            - type: number
            - type: 'null'
          title: Total Cost Usd
      required:
        - text
      title: AgentChatAssistantMessage
      type: object
    AgentChatContextCompacted:
      description: Charge utile pour un événement de compactage de la fenêtre de contexte.
      properties:
        compaction_items_after:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compaction Items After
        compaction_items_before:
          anyOf:
            - type: integer
            - type: 'null'
          title: Compaction Items Before
        compaction_summary:
          anyOf:
            - type: string
            - type: 'null'
          title: Compaction Summary
      title: AgentChatContextCompacted
      type: object
    AgentChatToolCall:
      description: Charge utile pour un événement de chronologie d’appel d’outil.
      properties:
        content_refs:
          items:
            type: string
          title: Content Refs
          type: array
        duration_ms:
          anyOf:
            - type: integer
            - type: 'null'
          title: Duration Ms
        status:
          anyOf:
            - enum:
                - UNSET
                - OK
                - ERROR
              type: string
            - type: 'null'
          title: Status
        tool_arguments:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Arguments
        tool_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Name
        tool_result:
          anyOf:
            - type: string
            - type: 'null'
          title: Tool Result
      title: AgentChatToolCall
      type: object
    AgentChatUserMessage:
      description: Charge utile pour un prompt utilisateur dans la chronologie du chat.
      properties:
        content_refs:
          items:
            type: string
          title: Content Refs
          type: array
        text:
          title: Text
          type: string
      required:
        - text
      title: AgentChatUserMessage
      type: object

````