A guide · Evals for agents

How to build evals for an agent, starting with its traces

From the first trace to an evaluator you can trust, and how to tell when the eval itself is wrong.

Hotel, 1 nightPORT SELENE
Night 1$320.00
Standard cap$250.00 / night
Port Selene cap$350.00 / night
FLAGGED

outcome › Sent for human review. The amount check reported a $250 cap.

Why this guide

The scores look fine. Users still get wrong answers.

The example

I built a small expense-review agent

  • LangGraph
  • gpt-5-nano
  • 5 tools
  • 10-section policy
  • 42 requests, run 3 times
Hotel, 1 nightPORT SELENE
Night 1under cap$320.00
Standard cap$250.00 / night
Port Selene capapplies$350.00 / night
FLAGGED
  • Right tools
  • Right policy
  • Real citation
  • Decision and reason
  • ✕ Was the decision right?
320valid claim, waiting on a reviewer
Would your evals catch this?

A $320 hotel night in Port Selene.

The agent sends it to a reviewer.

Four checks. Four passes.

A valid claim is stuck in a queue.

An eval is a repeatable check of one behavior, with evidence.

What an eval is

Repeatable. Rerun it after any change.

One behavior. Say exactly what you check.

Evidence. A record anyone can inspect.

1Define the job
2Design cases
3Read traces
4Identify failure modes
5Choose an evaluator
6Test the evaluator
7Change and rerun
Once
Repeat after every change
The path

Seven steps. The first two happen once.

The rest repeat every time the agent changes.

Step 6 is the one teams skip.

Part 2

So what should we have checked?

Agent
The employeea decision and an accurate reason
The finance teama saved decision and its receiptNo matching record
The human reviewerthe flagged expense and why
23
Step 1 · Define the job

Three people rely on every review.

Each one leaves different evidence.

A review can work for one and fail another. 23 of 126 did.

Who asks
Employee
Expense
Hotel stay
What goes wrong
Missing receiptLookup returns nothingWrong approverNo approval

“I lost the receipt for my hotel stay. Can you check whether I can still claim it?”

42 requests, 3 runs each, 126 tracesThe Port Selene claim
Step 2 · Design cases

Don't generate 150 queries in one go.

Pick dimensions first.

Combine them into a request.

Run the agent on each. I had 42, three times each.

Request$320 hotel, one night, Port Selene
Expense lookupone night at $320
Policy searchlodging: $350 a night in Port Selene
Amount checkreturns the standard $250 cap
✕ tool said: $320 > $250 cap✓ policy says: $320 ≤ $350 in Port Selene
Replyflag for human review
Step 3 · Read traces

A trace records everything one run did.

Follow the calls in order.

There: the tool used the standard cap, not Port Selene's.

Note on q23The agent flagged the $320 Port Selene stay. The amount check returned the standard $250 cap, but the policy allows $350 a night in Port Selene.
Sent a clear violation for human review
Used the wrong limit or unit
Approved a claim it should have stopped
Step 4 · Identify failure modes

Write a note where it goes wrong.

9 wrong decisions in 126 runs.

Group them. A $240 dinner for two broke the same way.

Count. Now I know what to fix first.

Part 3

Now make it a check you can trust

Code
Wrong decisionCode
Missing decision recordCode
Unretrieved citationCode
Per-unit cap claimCode
Latency budgetCode
LLM judge
Misleading explanationJudge
evaluator.py
saved = [
    node.inputs.get("decision")
    for node in session.nodes
    if node.tool_name == "recommend_decision"
]
…
passed=len(saved) == 1,
passed=saved == [reply],
103
Step 5 · Choose an evaluator

One evaluator per failure mode.

Code, when the trace has the evidence.

A judge, only when it takes judgment.

This code check passed 103 of 126 runs.

Evaluatorunder test
A trace it should failMust fail
A trace it should passMust pass
A paraphrase of eachSame verdict
A negationVerdict flips

Number oneFailures the judge caught

Number twoGood replies it passed

Step 6 · Test the evaluator

A wrong evaluator is worse than none. Two of mine were wrong.

Give each one four small tests.

For a judge: human labels, two numbers.

Add this caseA standard-city night above $250
5 wrong → right0 right → wrong4 runs lost the finance record
q23 · Port Selene, 1 night$320.00NOT PROVEN
Step 7 · Change and rerun

Change one thing: the amount check tool.

Predict what should change, and what must not.

A lazy fix passes every row. Add the case that catches it.

Five decisions fixed. Four new finance failures.

Expense lookupFrom recording
Amount checkRuns live
Policy searchFrom recording
recommend_decisionFrom recording
Rerunning safely

Rerunning an agent touches the world.

So replay the recording. Only the changed tool runs live.

One run per case is not proof. Replay each three times.

Do this for your own agent
  1. Name who relies on the agent
  2. Design cases from dimensions
  3. Capture full traces
  4. Read and note every trace
  5. Group notes into failure modes
  6. Write one evaluator per failure mode
  7. Give each evaluator four small tests
  8. Add human labels for any judge
  9. Predict which cases should flip
  10. Replay, and read regressions first
What you need to start

Traces, time set aside to read them, and the habit of asking how each check could be wrong

Figures from 126 recorded runs of 42 requests. Diagrams are schematic.