Skip to content
mentoor

Topic 1 of 5 · 4 min read

Reading agent transcripts step by step

Goal: Find the first step in a transcript where an agent run went wrong and explain why the later errors follow from it.

When an agent run fails, read the transcript from the top and find the first step that was wrong. The error you see at the end is usually a symptom of that earlier step.

Check yourself · 1 of 3

An agent's final step fails with a validation error. Where should you start reading the transcript?

Choose one answer

Why it matters

An agent run is a chain. Each model turn sees everything before it. If step 3 reads the wrong file, step 4 edits it, step 5 runs tests that fail, and step 6 "fixes" the tests. The failing test at step 5 is where you notice the problem. It is not where the problem started. Fixing step 6 or step 5 leaves the cause in place.

How to do it

  1. Get the full transcript. You need the system prompt, every user and assistant message, every tool call with its exact arguments, and every tool result. A final answer alone tells you almost nothing. If your logs cut tool results short, fix that first.
  2. Write down what a correct run would have done. Three or four steps, in plain words: find the order, check its status, refund it, confirm to the user.
  3. Walk forward and compare. At each step ask three questions. Was the tool call the right one, with the right arguments? Did the result say what the model then claimed it said? Did the model act on information it never actually received?
  4. Mark the first deviation. It may be a bad argument, a result the model misread, a tool that returned an error the model ignored, or a step that was skipped.
  5. Check that the later errors follow. If the failure does not follow from your marked step, you have found a second problem, not the first.

Look closely at the gaps between steps. Models often say "the file exists" after a tool returned an empty list, or "the tests passed" after a timeout. Compare each claim with the tool result just above it.

Before and after

Weak: "The agent refunded the wrong order, so the refund tool is buggy." The reader looked only at the last call.

Better: "At step 2 the search tool returned two orders for this email. The agent picked the first without asking which one. Step 4 refunded it. The refund tool worked as designed. The failure is at step 2."

What goes wrong

  • Blaming the last step. The visible error is the end of the chain, so fixes aimed at it only hide the cause.
  • Trusting the model's own summary of what a tool returned. Read the raw result. Summaries drop details, and sometimes invent them.
  • Reading only one run. A single transcript may show a one-off slip. Read two or three failures before deciding what the pattern is.
  • Missing silent failures. A tool that returns an empty result, or a truncated one, does not look like an error but changes everything after it.

Examples

The wrong order refunded

A support agent refunds order 4471 instead of 4417. The error is visible at the last step, but the transcript shows:

[2] tool search_orders(email="j@example.com") -> [4417, 4471]
[3] assistant: Found the order. Refunding 4471.
[4] tool refund(order_id=4471) -> ok

The first wrong step is 3: two matches came back and the agent chose one without checking. Fix: tell the agent to ask when a search returns more than one match.

The test that never ran

An agent reports "all tests pass". The transcript shows the test command returned Error: command timed out after 30s, and the next assistant message says "Tests look good." The first wrong step is the claim, not the code change. The later report is wrong because the agent acted on a result it never got.

Key points

  • Read the whole transcript, including raw tool arguments and results, not only the final answer.
  • Write down what a correct run would have done, then compare step by step to find the first deviation.
  • The first wrong step is the cause; later failures are usually its consequences.
  • Check each model claim against the tool result directly above it, since models misreport and sometimes invent results.
  • Empty, truncated or ignored tool results are silent failures that change every later step.

Common mistakes

  • Starting at the last error and working backwards instead of forward from the first step.
  • Reading the agent's narration of a tool result instead of the raw result.
  • Drawing conclusions from one failed run without checking whether other failures share the same first step.
  • Using logs that truncate tool results, so the evidence for the first wrong step is missing.

Check yourself · 2 of 3

A tool returned an empty list, and the next assistant message says "I checked and no files match, so I will create one." What is the most useful check?

Choose one answer

Check yourself · 3 of 3

Which log gives you enough to find the first wrong step in an agent run?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic