Chris Collins

Tools · ai

Agent trace viewer

Open agent traces — Claude Messages API and OpenAI Chat Completions or Responses logs, OpenTelemetry GenAI spans, Claude Code session JSONL — and see every turn, model call and tool call on a timeline and in a tree, with latency, tokens split into cache reads and writes, cost per step, failed tool calls and retries, and full-text search; nothing leaves the browser.

Added

How to use it

An agent run is a pile of JSON: requests, responses, tool calls and their results, maybe spans from a tracing SDK. This page reads the common formats into one picture — which model call asked for which tool, how long each took, where the tokens and the money went, what failed and what was tried again — so you can debug an agent without writing a script first. The trace is read in this browser tab; it is not uploaded and not saved.

How to use it

Load. Drop one or more files on the page, open them, or paste JSON or JSON Lines. The format is recognised by itself:

Format What is read

Claude Code session

~/.claude/projects/<project>/<session>.jsonl: one line per event (type user / assistant / system / summary, uuid → parentUuid). An assistant reply written as several lines (one per content block, same message.id) is one model call and its usage is counted once. Subagents — lines with isSidechain: true, or their own agent-*.jsonl dropped together with the session — appear under the Task / Agent tool call that started them. API errors (isApiErrorMessage) are failed model calls. The file format is Claude Code’s internal one and may change between versions.

Claude Messages API

A request (model, system, messages), responses (type: "message"), or a log of {request, response, start, end} (or duration_ms) records, as a JSON array or JSONL. tool_use blocks are matched with tool_result blocks by id; is_error marks a failed tool call. Usage: input_tokens (uncached), cache_creation_input_tokens split into 5-minute and 1-hour writes by cache_creation, cache_read_input_tokens, output_tokens.

OpenAI Chat Completions

Messages with tool_calls and role: "tool" results (tool_call_id), responses (object: "chat.completion"), or a request/response log. prompt_tokens includes the cached tokens (prompt_tokens_details.cached_tokens), which are shown as cache reads; reasoning tokens are part of completion_tokens.

OpenAI Responses API

input / output items: message, reasoning, function_call and function_call_output (call_id), built-in tool calls; requests chained with previous_response_id.

OpenTelemetry GenAI

OTLP JSON (resourceSpans → scopeSpans → spans) or a list of spans with the GenAI semantic conventions: gen_ai.operation.name chat / invoke_agent / execute_tool, gen_ai.request.model, gen_ai.usage.input_tokens / output_tokens / cache_read.input_tokens / cache_creation.input_tokens, gen_ai.tool.name, gen_ai.tool.call.id / arguments / result, gen_ai.agent.name; status ERROR or error.type marks a failure. Spans nest by parentSpanId; events and attributes are listed in the details.

In a request/response log the time between a response that asked for tools and the next request is the time the tools took. Traces without timestamps are drawn with evenly spaced steps.

Search and filter (top of the page) apply to every view: the text is matched against step names, models, message text, tool inputs and results and span attributes. Show narrows to the turns, the model calls, the tool calls, or only errors, retries and tool calls without a result.

Timeline. One row per step, indented by nesting, with a bar from its start to its end — agents, model calls (with tokens), tool calls, user and system messages. ✕ marks an error, ↻ a retry, a striped bar a tool call with no result in the file. Tap a row for its details: times, model, tokens and cost, the text and thinking, the tool input and result, and the raw JSON (copyable). Drag across the time axis to zoom into a stretch of the run; Zoom timeline here fits the view to one step (its subagent, say), and Show the whole trace zooms out again. Full screen gives the timeline the whole screen (Panels hides the details beside it).

Tree. The same steps as an outline: agents, their turns, each model call with the tool calls it made, and subagents under the tool call that started them, with time, tokens and cost summed under every node.

Tokens & cost. Totals (uncached input, cache writes, cache reads, output, the share of input served from the cache), a chart of the tokens of every model call with the cumulative cost, a table per model and per call, and the price table. Prices are US$ per million tokens; edit any row or add a model (a fine-tune, a self-hosted model at your own rate) — edits are kept in this browser.

Tool calls. Per tool: calls, errors, retries, calls without a result, total, median and longest time; and every call with its input, duration and status.

A retry is a tool call that follows a failed call of the same tool by the same agent (“after error”), or one that repeats an earlier call with exactly the same input (“identical”), and a model call that follows a failed model call in the same agent (“after API error”). This is a rule of thumb: a test run repeated after a fix is counted too.

How cost is worked out, per model call: uncached input × input price + 5-minute cache writes × 1.25 × input price + 1-hour cache writes × 2 × input price + cache reads × the model’s cache-read price + output × output price (Anthropic’s published multipliers). For example 1,000 uncached input, 2,000 cache-write, 10,000 cache-read and 500 output tokens on Claude Opus 5.5 ($4 input, $5 5-minute write, $0.20 read, $20 output per million) cost 0.004 + 0.010 + 0.002 + 0.010 = $0.026.

Limits

  • Prices are list prices as of the date in the table (Anthropic, from its pricing page) or published in 2025 (OpenAI) and may be out of date; batch, priority, fast-mode, long-context and regional prices and tool fees (web search) are not included. Cost is an estimate from the token counts in the file.

  • OpenTelemetry instrumentations differ in how they count input tokens. The semantic conventions ask for gen_ai.usage.input_tokens to include cached tokens, so cache reads and writes are subtracted from it when they fit; an instrumentation that reports uncached tokens only is then under-counted.

  • A Messages API or Chat Completions request on its own has no usage or timing for the earlier turns in its history; only responses carry tokens.

  • Claude Code’s session format is undocumented and changes; lines it does not recognise are skipped. Thinking is often stored empty (only a signature), which is shown as “thinking omitted”.

  • Files up to a few tens of MB stay responsive (big files are parsed in a background worker); the timeline draws the first 400 matching steps with a button for more, and tables show the first 1,000 rows — use the search to narrow.

  • Streaming event logs (server-sent events) are not read; save the final message instead.

Sources: Anthropic, Messages API and prompt caching (usage fields, cache-write multipliers), pricing; OpenAI, Chat Completions and Responses API references, pricing; OpenTelemetry, semantic conventions for generative AI (spans, agent spans, attribute names) and the OTLP JSON encoding.

Related: Tokenizer explorer (why token counts differ between models), LLM serving (latency and throughput of the model calls themselves), AI economics, Model evaluation and JSON workbench for digging into one record.

Linking to an example

A link opens the tool with an example and a filter: /tools/agent-trace/?<parameters>#<tab>, where the tab is load, timeline, tree, tokens or tools. Share link (top right) builds one from the current settings. Your own trace never goes into a link — only the example name, the search text, the filter and edited prices do.

Parameter Meaning Example

example

a built-in synthetic trace (list below)

claude-code

q

search text

Edit

show

all, turns, llm (model calls), tool, issues (errors, retries, no result)

issues

Name Tab Shows

claude-code

timeline

A Claude Code session: a failing test, an Edit that fails and is retried, an overloaded API error and its retry, and a subagent started with Task (open)

claude-api

timeline

A Messages API log: two tool calls in parallel, a calendar timeout retried, a 1-hour cache write read back on later turns (open)

openai-chat

tools

A Chat Completions JSONL log: parallel open_page calls, a 429 and the retried request (open)

openai-responses

tokens

The Responses API with reasoning tokens and previous_response_id (open)

otel-genai

tree

OTLP JSON GenAI spans: an agent, a sub-agent, a tool that times out and is retried (open)

For example, ?example=claude-code&show=issues#timeline shows only what went wrong in the Claude Code session.

Runs entirely in your browser; nothing you type leaves this page.