How Do You Evaluate AI Agents?
How to test an AI agent, why one run is not enough, and how to grade what it did, explained simply for your AI interview.
In short
Give the agent tasks with clear pass rules, run each one several times, and grade the final result. Agents vary from run to run, so one good run proves little.
11 min readAdvancedVery common · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
An agent is a model that uses tools over many steps, so I test it with tasks, not single questions. Each task has a clear pass rule, and I run it several times, because the same task can pass on one run and fail on the next. I grade the final result, like whether the refund really reached the payments system, and I read the full record of any run that fails. I start with 20 to 50 tasks from real failures, and I keep old tests running to catch anything that breaks again.
A normal test checks one answer. An agent does many things in a row: it calls tools, changes data and adapts to what it finds. So I use a test setup that gives it a task, lets it run its whole loop, and then grades what the run left behind. Each task is one test with defined inputs and success rules, and each attempt at it is a trial.
The hard part is variation. Models give different answers on different runs, so one lucky pass says little. I run each task several times and track two numbers. Pass@k is the chance of at least one success in k tries. Pass^k is the chance that all k tries succeed. For a customer-facing agent, pass^k especially matters, because users expect the agent to work every time.
For grading, I use plain code where I can, since it is fast and repeatable. I use a model as the judge where the answer is fuzzy, and I check that judge against what human experts would say. I grade what the agent produced rather than the exact path it took, because agents often find valid routes nobody planned for. I keep capability tests for what the agent can do yet, and regression tests that must still pass after every change. When something breaks, I read the full transcript.
What is evaluating an agent, in plain words?
An eval is a test for an AI system. You give it an input, grade its output against a rule, and count how often it passes. For a chatbot, that can be one question and one answer.
An agent is harder. It uses tools over many steps, changes real data as it goes, and adapts to what it finds. An early mistake can spread into later steps. So the test has to look at the whole run, and at what the run left behind in the system.
Think of a bank teller at the end of a shift. A manager counts the till and trusts the count over what the teller says. For an agent, the till is the system. Did the refund really reach the payments system? A reply that sounds right can hide a refund that never happened.
Key words
- Task
- One test with defined inputs and a clear success rule.
- Trial
- One attempt at a task. Agents vary, so each task runs several times.
- Grader
- The logic that scores a run: code, a model as judge, or a person.
- Transcript
- The full record of a run: tool calls, replies and results along the way.
- Outcome
- The final state after the run, such as whether the refund exists.
Why do you run each task more than once?
The same task can pass on one run and fail on the next, so one pass tells you very little. Anthropic's engineers run several trials per task for this reason, and they track two numbers.
- pass@k
At least one success
Counts a task as passed if any of k tries works. Useful when one good answer is enough.
- pass^k
Every try succeeds
Counts a task as passed only if all k tries work. The stricter bar for customers.
“This metric especially matters for customer-facing agents where users expect reliable behavior every time.”
Anthropic
The simple sum assumes each trial is separate. An agent with a 75% success rate per trial passes all three trials only about 42% of the time, since 0.75 times 0.75 times 0.75 is about 0.42.
Here is a small worked example with made-up results for a refund agent. Each task ran three times. Read the output as well as the code.
# Grades a refund agent on 4 tasks, 3 trials each. Results are made-up.
# pass@3: at least one trial passed. pass^3: all three trials passed.
RESULTS = {
"refund a duplicate card charge": [True, True, True],
"refund a late delivery within policy": [True, False, True],
"escalate a refund above the approval limit": [False, True, False],
"reject a refund after 90 days": [True, True, True],
}
def pass_at_k(trials):
return any(trials)
def pass_hat_k(trials):
return all(trials)
for task, trials in RESULTS.items():
print(f"{task}: {sum(trials)}/3 passed, "
f"pass@3={pass_at_k(trials)}, pass^3={pass_hat_k(trials)}")
all_three = sum(pass_hat_k(t) for t in RESULTS.values())
print(f"tasks that passed all 3 trials: {all_three} of {len(RESULTS)}")Output
refund a duplicate card charge: 3/3 passed, pass@3=True, pass^3=True refund a late delivery within policy: 2/3 passed, pass@3=True, pass^3=False escalate a refund above the approval limit: 1/3 passed, pass@3=True, pass^3=False reject a refund after 90 days: 3/3 passed, pass@3=True, pass^3=True tasks that passed all 3 trials: 2 of 4
Two tasks passed every trial. The late-delivery task passes pass@3 but fails pass^3, so a customer could get a different answer on a bad day. The approval-limit task is the warning sign: pass@3 says it passed, but the agent got it right only once in three.
How do you grade a run?
Graders score the transcript or the outcome, and most agent evals mix three kinds. Anthropic's guide lists code-based graders, model-based graders and human graders. It recommends deterministic checks where you can, a model where you need flexibility, and people to validate the rest.
Code
Exact checks, unit tests, or a check that the right record exists. Fast and repeatable, but brittle when a valid answer looks different.
A model as judge
Scores fuzzy things, like whether a reply is complete, against a rubric. Flexible, but check it against human experts first.
People
Spot checks and calibration. Slow and costly, so use them to check the other two.
Grade what the agent produced, and skip the exact path it took. Agents regularly find valid routes that the designers never planned for, so rigid step checks break on good runs. Scores can be partial too. A support agent that finds the problem and verifies the customer, but fails to issue the refund, is better than one that fails at the start.
How one agent test is graded
Task and pass rule
a test case with a clear pass rule
Agent
uses tools over many turns
Record and grade
Transcript
every tool call and reply
Outcome
what the system holds at the end
Pass rate over trials
run each task several times
- 1The task and its pass rule go in.
- 2Every step the agent takes gets written down.
- 3The final state of the system gets checked.
- 4Graders read the steps and check which tools were used.
- 5Graders confirm the real result in the system.
OpenAI's agent guide looks at the path as well. Trace grading, which scores the full record of one run (model calls, tool calls, guardrails and handoffs), is the fastest way to find workflow problems, such as whether the agent picked the right tool. For model judges, Anthropic warns that vague scoring rules (rubrics) give inconsistent judgements, so you check the judge against human experts first.
“So as not to unnecessarily punish creativity, it's often better to grade what the agent produced, not the path it took.”
Anthropic
“A trace captures the end-to-end record of model calls, tool calls, guardrails, and handoffs for one run.”
OpenAI
How do you build a test set that stays useful?
Start small. Anthropic suggests about 20 to 50 tasks taken from real failures, because early changes usually show big effects that small sets can catch.
Make each task fair. A good task is one where two domain experts would reach the same pass or fail verdict. If they would not, the task needs work, since ambiguity turns into noise in the numbers.
Keep two kinds of test. Capability tests ask what the agent can do yet. Regression tests ask whether it still does what it used to, and they should have a nearly 100% pass rate. After launch, a capability test with a high pass rate can graduate into the regression set.
Evals get harder to build the longer you wait, so start early, while you still know what success should look like.
Tip
Numbers hide causes. Read a few failing transcripts before you change the prompt or the tools. Anthropic's own advice on this is short: read the transcripts.
How would you evaluate a refund agent before launch?
Start with the cases support staff already handle: duplicate charges, late deliveries, refunds above the approval limit, and requests past the 90-day window. The policy owner writes each pass rule, not the engineer who built the agent.
- 1
Build the set
Take 20 to 50 real cases, including the ones that failed last quarter.
- 2
Run each case several times
Track pass^k, because a customer gets one answer, not an average.
- 3
Grade the outcome first
Check the refund in the payments system, then read transcripts from the failures and from a sample of passing runs, to check the graders.
- 4
Decide whether to ship
Ship only when the regression set stays near 100 percent and the new cases keep improving.
Tip
Say that a refund above the limit must go to a person. An eval that rewards the agent for issuing it is measuring the wrong thing.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: an input, grading logic, and a measured pass rate.
- Why agents need whole-run grading: tools, state and many turns.
- pass@k and pass^k, and when each one matters.
- Grade the outcome first, then read transcripts to check the graders, mixing code, model and human graders.
- Capability and regression sets, starting with 20 to 50 real failures.
- Honesty that this is still a young field, and how you would check the judge.
Common traps
Trap"Run it once and check that it passes."
BetterOne run can pass by luck. Run each task several times and track pass^k.
Trap"If the agent says it's done, it's done."
BetterCheck the outcome in the system, like a saved refund, not the agent's words.
Trap"A high score on our demo set means it's ready."
BetterA demo set only covers the cases you thought of. Add real failures and keep the regression tests running.
Can you spot the weak test?
Spot the weak test
A team runs its refund agent once per task and sees 95% pass. What is the weak point?
Quick check
A customer-facing refund agent passes most tasks, but one task fails in some trials. Which number shows that risk best?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
- Q256Capability evals vs regression evals?10 min
- Q265How do you sample production traffic for evals?Coming soon
- Q272How do you track latency and cost in evals?Coming soon
- Q279Statistical significance in evals?Coming soon
- Q182How do long-running agents use checkpoints?12 min
Learn it in depth
Last updated on 26 November 2026
Building an agent and not sure it works?
I design and build AI agents, including the interface and the system behind them. Book a short call and tell me what your agent needs to do and how you would know it works.