---
title: "Genai Traces Chat"
method: POST
path: "/agents/traces/chat"
tags: ["Agents"]
---

# Genai Traces Chat

`POST /agents/traces/chat`

## Request body

- AgentTraceChatReq — Request to get the structured chat / trajectory view for a trace.
  - `project_id` string, required
  - `trace_id` string, required
  - `include_feedback` boolean

## Response `200`

Successful Response

- AgentTraceChatRes — Structured chat view: a linear sequence of messages representing the agent trajectory for a single trace.
  - `trace_id` string, required
  - `root_span_name` string, nullable
  - `agent_name` string, nullable
  - `agent_version` string, nullable
  - `status_code` 'UNSET' | 'OK' | 'ERROR', nullable
  - `provider` string, nullable
  - `total_duration_ms` integer, nullable — Wall-clock duration of the trace root span in milliseconds. This is not a sum of child span durations.
  - `total_cost_usd` number, nullable
  - `messages` AgentChatMessage[]
    - `type` 'user_message' | 'assistant_message' | 'tool_call' | 'agent_handoff' | 'agent_start' | 'context_compacted', required
    - `span_id` string, nullable
    - `agent_name` string, nullable
    - `agent_version` string, nullable
    - `status_code` 'UNSET' | 'OK' | 'ERROR', nullable
    - `started_at` string, date-time, nullable
    - `user_message` AgentChatUserMessage — Payload for a user prompt in the chat timeline.
      - `text` string, required
      - `content_refs` string[]
    - `assistant_message` AgentChatAssistantMessage — Payload for assistant text emitted by an agent or LLM span.
      - `text` string, required
      - `model` string, nullable
      - `reasoning_content` string, nullable
      - `reasoning_tokens` integer, nullable
      - `input_tokens` integer, nullable
      - `output_tokens` integer, nullable
      - `input_cost_usd` number, nullable
      - `output_cost_usd` number, nullable
      - `total_cost_usd` number, nullable
      - `duration_ms` integer, nullable
      - `status` 'UNSET' | 'OK' | 'ERROR', nullable
      - `content_refs` string[]
    - `tool_call` AgentChatToolCall — Payload for a tool call timeline event.
      - `tool_name` string, nullable
      - `tool_arguments` string, nullable
      - `tool_result` string, nullable
      - `duration_ms` integer, nullable
      - `status` 'UNSET' | 'OK' | 'ERROR', nullable
      - `content_refs` string[]
    - `agent_start` AgentChatAgentStart — Payload for an agent lifecycle boundary.
      - `model` string, nullable
      - `system_instructions` string, nullable
      - `tool_definitions` string, nullable
      - `status` 'UNSET' | 'OK' | 'ERROR', nullable
    - `agent_handoff` AgentChatAgentHandoff — Payload for a future agent-to-agent handoff event.
    - `context_compacted` AgentChatContextCompacted — Payload for a context-window compaction event.
      - `compaction_summary` string, nullable
      - `compaction_items_before` integer, nullable
      - `compaction_items_after` integer, nullable
    - `feedback` object[], nullable
  - `feedback` object[], nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/wandb/apis/serverless-training.md) · [All operations](https://skmtc.net/wandb/apis/serverless-training/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/wandb/serverless-training/revisions/8d8d96fc0fd3/schema)
