Agent trajectory evaluation: what to log and how humans review it

For agent builders4 min read

A reviewer reading a long log on a laptop with a highlighter and printed sheets, at a kitchen table in a Dar es Salaam apartment, warm lamp light.

An agent trajectory is the full record of one run: the messages, the tool calls, the tool results and the final state. Agent trajectory evaluation means reading that record, by script and by person, to find why a run passed or failed. This post gives a simple log format, a script that catches repeated calls, and a review routine.

Agent trajectory evaluation starts with what a trajectory holds

Anthropic's agent eval guide uses the words transcript, trace and trajectory for the same thing: the complete record of a trial, with outputs, tool calls, reasoning and intermediate results. The outcome, the final state of the environment, is kept separately. A good log stores both, because the path explains the result.

Source: Demystifying evals for AI agents(opens in a new tab)

A log format that stays readable

There is no single standard that every team follows, so keep yours plain. One JSON object per run, one line per file, makes it easy to grep, load into a notebook or print for a reviewer. This layout is an example, not a standard.

JSON
{"run_id": "r-0192", "task": "rename-report", "model": "model-a", "steps": [  {"i": 1, "tool": "ls", "args": {}, "result": "report_draft.txt"},  {"i": 2, "tool": "mv",   "args": {"src": "report_draft.txt", "dst": "report_final.txt"},   "result": "ok"},  {"i": 3, "tool": "done", "args": {}, "result": "finished"}], "outcome": {"files": ["report_final.txt"]}, "grade": {"passed": true, "grader": "code-v2"}}

Store the tool name and the arguments as data, not as text inside a message. Then you can count calls, find the most used tool and compare arguments across runs. Add the model name and the prompt version so you can tell which change caused which behavior.

Let a script flag the obvious first

People should not spend their time spotting a loop. A short script can mark runs that repeat the same call, call tools after a failure, or run long. Humans then read the flagged ones.

Python
import jsonfrom collections import Counter def flags(run, max_steps=12):    out = []    calls = [(s["tool"], json.dumps(s["args"], sort_keys=True))             for s in run["steps"]]    repeats = [c for c, n in Counter(calls).items() if n >= 3]    if repeats:        out.append(f"repeated call: {repeats[0][0]}")    if len(run["steps"]) > max_steps:        out.append("too many steps")    if run["steps"] and run["steps"][-1]["tool"] != "done":        out.append("never called done")    return out run = {"steps": [{"tool": "ls", "args": {}, "result": "x"}] * 4}print(flags(run))

A review routine for people

  1. Read the task first, then the outcome, then the grade. Decide for yourself whether the outcome meets the task.
  2. Read the steps in order. For each tool call ask: was it needed, and were the arguments right?
  3. Mark the first step where the run went wrong, not just the last one. That is the step to fix.
  4. Label the cause with a small fixed set: wrong tool, bad arguments, misread result, gave up early, task unclear, grader wrong.
  5. If the grade and your judgment disagree, write why. Those notes are how checkers improve.

Using a fixed set of causes lets you count them. After fifty runs you can say that most failures came from bad arguments, and you know where to work.

How many runs to read

You do not need to read everything. A workable habit is to read every flagged run, plus a handful of random passes and failures after each change. When the same cause label keeps coming up, stop reading and fix it. When you hit runs you cannot classify, the task or the log format is usually missing something, and that is worth fixing too.

Judge both the result and the path

The guide advises grading what the agent produced rather than the exact sequence of steps, since valid routes vary. Keep path checks for things that matter regardless of the result, such as reading a file the agent should not touch or skipping a required confirmation.

CheckLooks atExample
OutcomeFinal stateFile exists with correct content
Path ruleSpecific stepsNever calls delete without a confirm step
EfficiencyStep count and costFinishes within 10 steps

Review what the grader missed

Keep logs long enough to be useful, but remove secrets before you store them. Tool arguments often contain tokens, email addresses or customer details. Redact those fields when the log is written, not afterwards, so reviewers and downstream tools never see them.

Sample some passing runs as well as failing ones. A run can pass a weak checker by accident or by exploiting it, and only a person reading the steps will notice. If you find a pass that should have failed, fix the grader and re-score the old runs.