Agent Trace Viewer: Read a Failed Run

An agent trace viewer shows each model call and tool step as a span. Read one failed run end to end: waterfall, first error, and model vs tool latency.

Ephraim Duncan

An agent trace viewer shows one agent run as a tree of timed spans, one per model call or tool step, so you can see which step failed first and which step was slow. You don't read it top to bottom. You read it in a fixed order: waterfall shape, first error, slowest bar.

This post is a troubleshooting walkthrough, not a reference page. We take one synthetic failed run and read its trace the way you would at 2 a.m., with a user waiting and a run that either crawled or died. We use telemetry.dev's trace view for the screens. If you want the full column list and keyboard shortcuts, the traces reference docs cover that. Here we only teach the reading.

telemetry.dev is LLM observability for AI apps and agents, built on OpenTelemetry. It records model calls, tool steps and retrievals as spans, with latency, tokens, cost and errors attached, so you can find the slow step and inspect the failed call.

What an agent trace viewer shows, and what it can't

A trace viewer shows spans: one timed record per instrumented operation, nested under the run that caused it. For an agent, that means model calls, tool steps and retrievals, each with a start time, a duration and a status. In telemetry.dev, trace records track duration, tokens, cost, and errors per run.

It cannot show what nobody instrumented. If a function never emitted a span, it does not appear. Time spent there shows up as a gap, not a bar. That one fact drives most of the reading below.

The name "agent trace viewer" also covers a different kind of tool. Some are local, single-file viewers for coding-agent session logs. ZenML's agent-trace-viewer is a client-side page that runs in your browser and opens session traces from coding agents. Hugging Face's Hub can open Claude Code, Codex and other agent sessions in its trace viewer after you upload the JSONL files. Those are good for replaying a coding session you already have on disk.

This post is about the other case: an agent you built in TypeScript or Python, running in production, emitting spans as it works. There the question is not "what did the session say" but "which span do I open first."

Local session viewers Production trace viewer (telemetry.dev)
Input Session files from a coding agent Spans sent from your running app
Typical use Replay one session Find the slow or failed step across runs
What you see Session transcript and tool calls Nested spans with latency, tokens, cost, errors

What does an agent trace viewer tool actually do?

An agent trace viewer takes the recorded steps of one agent run, such as model calls and tool steps, and lays them out as a nested, timed list so you can see what ran, in what order, how long each step took and where an error appeared. telemetry.dev's trace view does this for instrumented spans, built on OpenTelemetry. This walkthrough teaches you to read one failed run; the reference docs at https://telemetry.dev/docs/platform/traces/ cover every field.

The synthetic failed run we'll read

Here is the run. It is invented for this walkthrough, not a customer's data.

A support agent, written in Python, gets a user message: "Where is order 4471?" It is meant to call a model, look up the order with a tool, call the model again to write the answer, and return. The user waited 41 seconds and got a generic error message.

The trace has six spans:

  • agent.run (root, 41.2 s, status error)

  • llm.call plan step (1.4 s, ok)

  • tool.lookup_order (30.0 s, status error, timeout)

  • llm.call answer step (0.6 s, status error)

  • tool.lookup_order retry (6.1 s, status error)

  • agent.run finalize (0.1 s, status error)

Four spans are red. One of them caused the other three. Finding which one is the whole job.

Open the trace to view the span tree. Don't click any span yet. Don't click any span yet. Look at the shape first.

Read the waterfall: nesting, order and gaps

The waterfall tells you where time went before any span tells you what happened. Read three things in order: nesting, order, gaps.

Nesting shows who called whom. Everything indented under agent.run happened because of the run. If a tool span sits under a model span, the model asked for it. If it sits directly under the root, your code called it.

Order shows sequence. Bars that start one after another ran sequentially. Bars that start together and overlap ran in parallel. In our run the two lookup_order spans are sequential, with the second starting right after the answer-step model call failed. That is a retry loop, and you can see it without reading a log line. If you suspect parallel work is the issue, Parallel Tool Calls: Trace Slow Agent Fan-Out covers how overlap reads.

Gaps are white space inside a parent where no child bar sits. The root spans 41.2 s. Add the child durations: 1.4 + 30.0 + 0.6 + 6.1 + 0.1 is 38.2 s. About three seconds of the run belongs to no child. That is either uninstrumented work or queueing before the first span started. Note it and move on. We come back to gaps in the instrumentation section.

At this point you already know three things: the run is dominated by one long bar near the top, there is a retry, and something is unaccounted for. You have not opened a single span.

How do you read an agent trace?

Read an agent trace top to bottom as a waterfall: the root span is the whole run, indented child spans are the model calls and tool steps inside it, and each bar's length is its duration. Check the order first, then look for gaps between bars, then find any span marked as an error. The same method works in any trace view, including telemetry.dev's. The next sections apply it to our synthetic run, one skill at a time.

Find the first error, not the loudest one

The first error in time is usually the cause. The loudest error is usually a consequence. Open the earliest red span, not the one with the scariest message.

In our run the root agent.run is red, and its message is the one the user saw. It is the loudest, and it tells you nothing. A parent span ends in error when a child's error reaches it. That is a propagated error: the failure passed upward.

Sort the red spans by start time:

  1. tool.lookup_order at 1.4 s, a 30-second timeout. First red span.

  2. llm.call answer step. Red because it received an empty tool result.

  3. tool.lookup_order retry. Red because it hit the same dead dependency.

  4. agent.run root and finalize. Red because their children were.

The first one is the cause. Open it. Select the span and read its panel for the status, duration and the error it recorded. Here it says the call exceeded its deadline. Everything after it is fallout.

A quick test for "first or propagated": ask whether this span would still fail if you fixed the one before it. If the answer is no, it's propagated. The answer-step model call would have succeeded with a real order record. So it is not a model bug, and tuning the prompt would waste your night.

When the cause is a deadline that did not shrink as work moved down the stack, Agent Tool Call Timeout: Trace Deadline Propagation goes deeper. For retries that multiply a failure, see Agent Telemetry: Trace Retries and Tool Failures.

Model latency vs tool latency: which bar is the slow step

The slow step is the longest bar that is not just waiting on a child. Compare model bars and tool bars separately, because they have different fixes.

In our run, the two model calls took 1.4 s and 0.6 s. Together that is 2.0 s of a 41.2 s run, under 5%. The tool spans took 36.1 s, almost all of it in the first timeout. The slow step is a tool, not a model.

That reading changes what you do:

  • A long model bar points at prompt size, output length, model choice or provider latency. Check Tokens on the span. A model call that is slow with a huge token count is a context problem. A model call that is slow with few tokens is a provider or queueing problem.

  • A long tool bar points at your own code or a dependency: a database, an internal API, a third-party service. No prompt change touches it.

telemetry.dev tracks model calls and tool steps alongside duration and tokens, so you can isolate tool spans and find systemic slow steps across runs. If one tool shows up at the top of that sort every time, you've found a systemic slow step, not a one-off.

The trap is reading a parent's duration as its own work. agent.run is 41.2 s long because it contains everything. Subtract its children before you blame it. A parent with a long bar and short children is the case that points to gaps, which is next.

Can I see OpenAI and Anthropic model calls next to tool calls in one trace?

Yes, when both are instrumented. telemetry.dev has provider instrumentation for OpenAI and Anthropic, plus TypeScript and Python SDKs, so model calls and tool steps appear as spans in the same trace. Compare bar lengths to tell a slow model call from a slow tool. If a step is missing, it is usually not instrumented yet, which the next section covers. Setup steps are in https://telemetry.dev/docs/quickstart.

When the trace looks incomplete: check instrumentation first

If the waterfall has gaps, missing children or a run that ends abruptly, assume missing instrumentation before assuming a bug. A trace only contains spans your code emitted.

Back to the three unaccounted seconds in our run. Common causes, in the order to check them:

  1. A step with no span. Pre-processing, a cache lookup or a validation function that you never wrapped. The time is real; the bar is not there.

  2. A tool called through an uninstrumented client. The model call has a span, the HTTP call it triggered does not.

  3. Work before the root started. Queue wait or cold start that happens before agent.run begins.

  4. Spans that never arrived. Check that the export is configured and the key is valid. The quickstart has a short checklist for "the trace doesn't appear," starting with the key and the environment variables.

If missing parent and child links are the problem, async code is the usual suspect: LLM Tracing: Fix Async Parent and Child Span Links shows what a broken link looks like. If whole runs are absent rather than parts, LLM Trace Sampling: Diagnose Missing Runs is the one to read.

The fix for a gap is small: wrap the step in a span. Then rerun. A trace you trust is one where the child durations add up to the parent.

Where to go next: setup and the traces reference docs

You now have a reading order: shape, first error, slowest bar, then gaps. Practice it on a real run, not a synthetic one.

To send traces, follow the quickstart. It sends a trace from TypeScript or Python in about five minutes, and then shows how to replace the hand-written span with an integration for your real model calls.

Use that page as the lookup; use this one as the habit.

Open the first red span, then check whether the bars add up

Most failed agent runs have one real cause and several loud symptoms. The viewer's job is to separate them: the earliest error is the cause, the longest non-parent bar is the slow step, and any gap is an instrumentation question before it is a bug. Send one real run to telemetry.dev with the quickstart, open the first red span, and check whether the child durations add up to the parent.

Share this article

Related posts

Agent Loop Detection: Trace Repeated Tool Calls

Agent loop detection starts in the trace: compare repeated tool-call spans, their arguments and results, to tell a stuck loop from retries, polling or valid repeats.