Evaluating Agents
You cannot improve what you can't measure, and agents are unusually hard to measure: the same task can succeed via a good path or a lucky one, fail via a bad answer or a 30-step slog. Evaluating agents means scoring both the outcome and the trajectory — and building the harness yourself.
Two complementary questions define agent evaluation:
Outcome eval: did the agent achieve the goal? For tasks with a checkable end state — "the order was created," "the correct number was returned," "the file contains X" — this is the ground truth. Prefer programmatic checks (assert the end state) over asking a model "did it succeed?", which is softer and gameable.
Trajectory eval: how did it get there? Two agents can both succeed while one used 3 steps and the other 18, one stayed on-budget and the other made 5 redundant calls. Outcome-only eval hides these — you ship an agent that works but costs 6× what it should, and you don't find out until the bill.
The metrics that matter
- Task success rate — % of tasks with the correct end state. The headline number.
- Steps per task — efficiency; a proxy for cost and latency (Ch. 1).
- Cost per task — total tokens × price; the number finance cares about.
- Failure taxonomy — why failures happen: wrong tool, bad args, gave up, wrong final answer. This is what tells you what to fix.
An agent that's 90% successful at 15 steps/task can be strictly worse than one that's 88% successful at 4 steps/task — 4× cheaper and faster for two points of success you may not need. Always report success with steps and cost. A single number is a number you'll optimize into a corner.
Build a fixed task set — your regression suite
The foundation is a set of representative tasks with checkable outcomes, frozen so every change is a before/after on the same tasks. Without it you're back to "it feels better." With even 20–50 tasks, you can answer the only questions that matter: did this prompt change raise success or just move it around? Did adding reflection (Ch. 11) improve quality enough to justify the extra steps it costs? The harness turns those from arguments into measurements.
Beware the non-determinism
Run the same agent on the same task twice and you may get different trajectories — and sometimes different outcomes. So a single run isn't a measurement; a rate over a set is. For flaky-but-important tasks, run each a few times and report success@k or the pass rate. Treating one lucky success as "it works" is the most common self-inflicted agent-eval error.
Build an agent eval harness — success AND steps
You'll evaluate two agent configurations over a fixed task set, reporting success rate and average steps for each. The point is to catch the case where the "better" success rate is a bad trade on cost.
Setup: mock-only; two configs with different success/steps profiles.
Step 1. Define ~8 tasks with checkable outcomes.
Step 2. Run config A (thorough: higher success, more steps) and config B (lean: slightly lower success, far fewer steps).
Step 3. Print success rate and avg steps for both; state which you'd ship and why.
Your goal: a small table — "A: 88% @ 4.0 steps, B: 90% @ 15.0 steps" — and a defended choice.
Starter code
TASKS = [f"task{i}" for i in range(8)]
# Recorded outcomes: (succeeded, steps) per task, per config.
RESULTS = {
"lean": [(True,4),(True,3),(True,5),(False,6),(True,4),(True,3),(True,4),(False,3)],
"thorough": [(True,14),(True,16),(True,15),(True,18),(True,13),(False,20),(True,15),(True,14)],
}
def evaluate(cfg):
rows = RESULTS[cfg]
success = sum(ok for ok,_ in rows)/len(rows)
steps = sum(s for _,s in rows)/len(rows)
return success, steps
# TODO Step 3: print both, then argue the ship decision on success AND steps.
for cfg in ("lean","thorough"):
s, st = evaluate(cfg)
print(f"{cfg:9} success {s:.0%} avg steps {st:.1f}")
# => lean success 75% avg steps 4.0
# thorough success 88% avg steps 15.6
What you should see: "thorough" wins on raw success (88% vs 75%) but at ~4× the steps (15.6 vs 4.0), so ~4× the cost and latency. Whether the 13-point success gain is worth 4× the spend depends on the task's value — and you can only have that conversation because you measured both. A success-only harness would have hidden the entire cost dimension and shipped "thorough" by default.
The engineering read. The harness didn't decide for you; it made the trade-off visible and quantified. That's the job: turn "which agent is better?" into "here's success, here's cost, here's the failure breakdown — now choose." Freeze this task set and every future change (a new prompt, reflection, a different model) becomes a clean before/after instead of a vibe.
Going further (optional): add a reason to each failure (wrong tool / gave up / wrong answer) and print the failure taxonomy. That histogram, not the success number, is what tells you what to fix next.
TaskForge: the demo said 100%, the suite said 55%
TaskForge was ready to ship its agent on the strength of flawless demos. Then they built a real evaluation: 40 tasks with checkable success conditions (did the test pass, did the record get written, did the answer match), run repeatedly. The verdict was sobering — 55% task-completion, average 14 steps, and a cost-per-task that made the unit economics shaky. The demos had been the happy path; the suite exposed the distribution.
Crucially, they evaluated the trajectory, not just the final answer: did it call the right tools, avoid destructive mistakes, and stop when done? That's what a single demo run can never show. Armed with the numbers, they fixed the biggest failure modes and tracked completion up to 80% and steps down to 8. The takeaway: an agent isn't one output to eyeball — it's a multi-step process you measure over many tasks, with a sample size.
Ridgeline builds a suite of 30 representative tickets with checkable outcomes and runs the agent over all of them nightly, reporting completion rate, average steps, and cost per ticket. The first honest number — 61% completion — is what tells them exactly where to work.
Quiz · Chapter 8 — reasoning, not recall
- For a task with a checkable end state, the most trustworthy outcome eval is:
- Two agents both hit 100% success, but one averages 4 steps and the other 18. Outcome-only eval is dangerous here because:
- The failure taxonomy (wrong tool / bad args / gave up / wrong answer) is most useful for:
- Running an agent once on a task and calling it "working" is unsafe because:
- The foundation of agent evaluation is: