Skip to content
All posts

· 9 min read · Aravind Baranitharan

evaluating agents.

A demo proves an agent can work once. An eval tells you how often it works, what it costs, and whether the change you just made broke it. How I'd build one.

  • Evals
  • AI agents
  • Testing
  • Architecture

Every agent looks good in the demo. The question that matters is different: how often does it succeed, at what cost, and did the prompt change I made this morning quietly break something? Without evals you're answering that with vibes, and vibes don't catch regressions.

Evaluating a chatbot is hard enough. Agents are harder: they take many steps, call real tools, change state, and can reach the right answer by a wrong path or the wrong answer by a reasonable one. These are my notes on how to measure them honestly. Every section is open for feedback at the bottom.

Why agents are harder to evaluate

  • Many valid paths. Two runs can use different tools in a different order and both be right. Comparing against one reference transcript punishes good work.
  • Side effects. The answer isn't the text the agent prints, it's the state it leaves behind: the file changed, the ticket closed, the refund issued.
  • Non-determinism. Run the same task five times and you get five trajectories. One run tells you almost nothing.
  • Cost and time are part of quality. An agent that succeeds in 80 steps and costs ten times as much isn't equal to one that succeeds in 8.

What to measure

I score agents on four layers, from cheapest to check to most expensive:

  1. Steps. Was each tool call well-formed? Right tool, valid arguments, no forbidden actions. Cheap, and it catches a surprising share of failures.
  2. Trajectory. Was the path sensible? No loops, no redundant calls, no reading the same file six times, no giving up early.
  3. Outcome. Is the end state correct? This is the score that matters most, and the one to make checkable by code wherever you can.
  4. Efficiency and safety. Steps, tokens, wall-clock time, cost per task, and any policy violation, which should fail the run outright.

Success once vs success every time

Research benchmarks often report pass@k: did any of k attempts succeed? That's the right number when a human picks the best attempt. A deployed agent gets one attempt per customer, so the number you need is the opposite: did all k attempts succeed? τ-bench calls this pass^k, and agents that look strong on single runs drop sharply on it.

90%success on any single run, in this example
59%chance all 5 runs succeed if each is an independent 90% (0.9⁵)
k=5trials per task I'd start with, before trusting a number

The arithmetic is the same compounding as in long-horizon tasks: small unreliability, repeated, becomes a big one. Run every task several times and report both the average and the consistency.

Graders: code first, judges second

  • Code checks are fast, cheap and hard to argue with: tests pass, schema validates, row exists, file compiles, amount matches. Make as much of the eval checkable this way as you can, even if it means designing tasks around a checkable end state.
  • LLM judges cover what code can't, like tone, completeness or whether a summary is faithful. They have known biases: MT-Bench documented position bias, a preference for longer answers, and models favouring their own outputs. Give the judge a written rubric, ask for the reasons before the score, and check it against human labels.
  • Human review is the ground truth and the most expensive. Use it on a sample, to calibrate the judge, and on anything the other graders disagree about.

In my RAG test-case generator, Ragas monitored retrieval and answer quality continuously. The lesson carries over to agents: the eval has to run all the time, not once before launch.

The evaluation loop

An eval isn't a spreadsheet you fill in once. It's a loop that runs on every change and grows every time production finds a new failure.

Agent evaluation loopAgent evaluation loop: a versioned task set feeds a harness that runs each task k times in a fresh sandbox and records traces; graders score them with code checks first, then an LLM judge, then sampled human review; a scorecard reports success, consistency, efficiency and safety; a release gate blocks regressions; production traces and failures become new tasks.taskstracesscorecompareshipfailures becomenew tasks01task setreal tasks from tracesedge cases + past bugscheckable end stateversioned, frozen02harnesssame tools, fresh sandbox, every runrun ktimespinmodel · toolsrecordfull trace03graderscode checksfirstllm judgerubrichuman reviewsample04scorecardsuccess rateoutcomepass^kconsistencysteps · cost · timeefficiencypolicy breakssafety05release gateno regression on the frozen setruns on every prompt + model changeshipblock06productiontrace every runuser feedback + online checksalert on drift
Fig. 1 · The evaluation loop. Numbers match the walkthrough below.
  1. 01

    Task set

    Real tasks pulled from logs and traces, plus edge cases and every bug you've fixed. Each task has a checkable end state. Version it and freeze it, so scores compare across weeks.

  2. 02

    Harness

    Runs each task k times in a fresh sandbox with pinned model, prompts and tool versions, and records the full trace. If two runs can see each other's leftovers, the eval is lying.

  3. 03

    Graders

    Code checks first, an LLM judge with a rubric for what code can't check, and human review on a sample. Store every grade with its reason.

  4. 04

    Scorecard

    Success rate, pass^k, steps, cost, time and safety violations, broken down by task type. One average hides the category that got worse.

  5. 05

    Release gate

    Runs in CI on every prompt, tool or model change. A regression on the frozen set blocks the merge, the same way a failing unit test would.

  6. 06

    Production

    Trace every real run, collect user feedback and run cheap online checks. Every production failure becomes a new task in the set, so the same bug can't ship twice.

How evals lie

  • Contamination. Tasks that leaked into training data, or that you tuned the prompt against until it passed. Keep a held-out set you never look at while iterating.
  • Too easy. A set where everything scores 95% can't show you an improvement. Add tasks until the current agent fails a meaningful share of them.
  • Grading the claim. If the grader reads the agent's own summary, the agent gets credit for saying it succeeded. Check the world, not the report.
  • Leaky sandboxes. State left over from a previous run makes the next one pass for free.
  • One number. An average across task types hides the type that regressed. Always look at the breakdown, and read some actual traces.

What I'd build first

  1. Twenty real tasks with checkable end states. Twenty good tasks beat a thousand synthetic ones.
  2. A harness that resets state and runs each task five times, recording full traces.
  3. Code graders and a scorecard with success, pass^k, cost and steps.
  4. A CI gate, so a prompt change can't merge if it regresses the set.
  5. An LLM judge, calibrated against your own labels, only for what code can't check.

The same task set and graders are what RL for agents needs as an environment and reward. Good evals are the asset that compounds.

Open questions

  • How do you eval tasks that take days, where the end state only exists at the end?
  • How much should trajectory quality count if the outcome is right?
  • Can an LLM judge ever be trusted without a human-labelled check set behind it?
  • How do you keep an eval set honest as the agent, and the team, learn its contents?

Rate the post, start a thread on any concept below, or share it with someone shipping an agent on vibes. I'll update it as the discussion changes my mind.

Discussion

feedback.

Rate the post, then start a thread on any concept. Disagreements are especially welcome. No sign-up needed.

Reader rating

–No ratings yet. Be the first.

How useful was this?

Start a thread

Loading the discussion…