Step 1: Record trajectories and read what an agent leaves behind
The system under test is agent.py, a finished tool-using agent for
Northwind's operations desk: order lookup, a calculator, a unit converter,
shipping quotes and a guarded refund tool, driven by a hosted 70B model.
cases.jsonl is its golden set: ten questions, each with what a correct run
looks like. record.py runs the agent over the cases and writes one
trajectory per case: the final answer, the number of completions, every
tool call with its arguments and result, token usage, and whether a budget
stopped the run.
A single-turn model is graded on its answer. An agent is graded on its answer and on the path: a right number reached without the lookup is a guess that will be wrong next week, and a right path ending in a wrong number is a prompt problem. Everything in this lab reads from the trajectory, so the first job is reducing a recorded run to the fields the graders need.
do this
1. Run. The live recording covers three cases so it stays quick. Then
harness.py summarize prints the shipped baseline recording,
trajectories-baseline.jsonl, which was made the same way over all ten
cases. Read it closely. On convert-two the model wrote its tool call out
as text and never called anything, so the answer is a JSON blob. That is a
real failure in the baseline, kept on purpose.
2. Implement summarize_trajectory(traj) in harness.py. From one
trajectory dict return {"id", "tools", "args", "errors", "steps", "tokens", "stopped_by", "answer"}: tools is the tool names in call
order, args holds json.loads of each call's arguments (or None when
the arguments are not a JSON object), errors counts tool results that
contain "error", and answer is the answer text or "".
3. Run again. The summary shows each case's tool path, error count and
answer. Compare trajectories-live.jsonl with the baseline for the same
three cases: same model, same prompt, and the paths may already differ.
That variance is why the rest of the lab scores paths with tolerance and
gates on per-case flips rather than single runs.
Why this matters in practice
Every evaluation framework for agents starts from this reduction. The trajectory is the ground truth; the graders are functions of it; the report is a table of those functions over a fixed set.
provided for you:agent.pycases.jsonlfake_client.pyorders.jsonrecord.pytools.pytrajectories-baseline.jsonl