Chat sessions

Read a chat session's execution trace

Per-turn execution spans: per-tool-call latency, token usage, and indices into the transcript. Same span shape as the eval iteration trace.

Incremental by default — returns the LATEST turn, not the whole session, because a session's spans are the largest thing this API emits and the turn you just took is the one you are debugging. Reach older turns with turnId or afterPromptIndex; use includeSpans=false for cheap per-turn summaries.

A turn whose spans could not be read reports spansUnavailable: true rather than an empty spans array: "made no calls" and "could not fetch" are opposite conclusions.

get/chat-sessions/{sessionId}/trace

Path parameters

sessionIdstring required

The chat session's id — the same id POST /chat-sessions/messages returns and GET /chat-sessions lists.

Query parameters

projectIdstring

Optional project scope. When set, a session in another project answers 404 — the same answer as absence, so this is never an existence oracle.

turnIdstring

Return exactly this turn. Mutually exclusive with afterPromptIndex.

afterPromptIndexinteger

Page forward from this turn index. Mutually exclusive with turnId.

limitinteger

Turns to return, 1–20. Defaults to 1 (the latest).

includeSpansboolean

Set false for per-turn summaries without span payloads.

Response

The selected turns, ascending by promptIndex.

sessionIdstring required
originstring nullable required
traceVersion1 required
turnCountinteger required

Turns the session has in total, so a caller can tell whether the window is the whole story.

latestPromptIndexinteger