Short answer: to evaluate an AI agent, you check two things. The outcome: did the task get done, in the final answer and in the database? The trajectory: did it call the right tools, with the right arguments, in a sensible number of steps? Agents behave differently on every run, so you run each task several times and report pass@k and pass^k. Grade with code wherever you can, use an LLM-as-judge for fuzzy qualities, and use human review to keep the judge honest.
This post explains each metric and method, then builds a small eval harness in plain Python that you can run in seconds. It ends with a fact-checked comparison of eight evaluation tools, as of 21 November 2026.
What is AI agent evaluation?
An AI agent is a large language model (LLM) that calls tools in a loop. A tool is a normal function, such as a database lookup. The model asks for a tool, your code runs it, and the result goes back to the model. If that loop is new to you, read how to build an AI agent from scratch in Python first.
AI agent evaluation means testing that whole loop, not one reply. Anthropic's engineering team defines an evaluation, or "eval", as "a test for an AI system" (Anthropic, 9 Jan 2026). You give the AI an input, then apply grading logic to its output. The same article defines the words you will meet in every eval tool:
- Task: one test case, with an input and success criteria.
- Trial: one attempt at a task. You run several, because outputs vary between runs.
- Grader: code or a model that scores one part of the result.
- Transcript, trace or trajectory: the full record of a trial, including every tool call and result.
- Outcome: the final state of the world. Anthropic's example is a flight agent. It may say "Your flight has been booked", but the outcome is whether the booking exists in the database.
How is it different from LLM evaluation?
LLM evaluation usually scores one answer to one prompt. Common LLM evaluation metrics include answer relevancy and faithfulness, which checks whether an answer sticks to the documents it was given. DeepEval and Ragas both ship these. Agent evaluation adds problems that a single answer does not have.
| Single LLM answer | AI agent | |
|---|---|---|
| What you grade | One response | A chain of decisions, tool calls and a final state |
| Can it change things? | No | Yes: it can write to databases, send mail, book things |
| Main failure | Wrong or vague text | Wrong tool, wrong arguments, extra actions, loops |
| Runs per test | Often one | Several, because errors compound across steps |
Anthropic notes that agents change the state of the world as they go, "which means mistakes can propagate and compound". A small slip at step 2 can wreck step 6.
Outcome vs trajectory evaluation
Outcome evaluation asks whether the job got done. Check the final answer, and also check the real end state: the row in the table, the file on disk, the test that now passes.
Trajectory evaluation asks how the job got done. Check which tools were called, with which arguments, and how many steps it took. The tool calling explainer on Crio's resources site shows how a model chooses a tool and its arguments in the first place.
You need both. An agent can give the right answer for the wrong reason, such as a lucky guess, or after taking an action nobody asked for. The worked example below shows one such case.
There is a trap on the other side too. Anthropic warns that checking for an exact sequence of tool calls is "too rigid and results in overly brittle tests". Agents often find valid paths that the test writer did not expect. So grade the essentials of the trajectory: the tools that must be called, the arguments that must be right, and the actions that must never happen. Do not grade the exact order unless order truly matters.
AI agent evaluation metrics
These are the common AI agent evaluation metrics. The first five come from one run of each task. The last two need several runs per task.
| Metric | What it tells you | How to compute it |
|---|---|---|
| Task success rate | Did the agent finish the job? | Tasks where every grader passed, divided by all tasks |
| Tool-selection accuracy | Did it pick the right tools? | Tasks where the set of tools called matches the expected set |
| Argument accuracy | Were the tool inputs right? | Expected tool calls made with exactly the right arguments, divided by all expected calls |
| Step count | Did it wander or loop? | Tool calls (or turns) per task, compared with the minimum needed |
| Latency and cost | Is it fast and cheap enough to ship? | Seconds and tokens per task, from your API's usage data |
| pass@k | Can it solve the task at all, given k tries? | Chance that at least one of k trials succeeds |
| pass^k | Does it solve the task every time? | Chance that all k trials succeed |
Add a safety metric for any agent with write tools: unexpected changes to the database. One unrequested refund matters more than a slightly lower success rate.
pass@k vs pass^k
pass@k comes from code generation. OpenAI's Codex paper used it to report the chance that at least one of k generated programs passes the unit tests (Chen et al., 2021). That fits tools where one good answer is enough, because a human or a test picks the winner.
A support agent does not get k tries with a real customer. So the τ-bench paper proposed pass^k, read "pass hat k": the chance that all k independent trials succeed, averaged across tasks (Yao et al., 2024). If a task ran n times and passed c times, the paper's estimates are:
- pass@k = average over tasks of 1 − C(n − c, k) / C(n, k)
- pass^k = average over tasks of C(c, k) / C(n, k)
Here C(a, b) means "a choose b", the number of ways to pick b items from a. At k = 1 the two numbers are equal: both are the plain success rate. As k grows, pass@k rises and pass^k falls. Anthropic's example: an agent that succeeds 75% of the time has about a 42% chance of passing three trials in a row, because 0.75 × 0.75 × 0.75 ≈ 0.42.
In the 2024 τ-bench paper, even gpt-4o succeeded on fewer than 50% of tasks, and its pass^8 in the retail domain was below 25%.
Evaluation methods: code, LLM-as-judge and humans
Anthropic groups graders into three types. Its summary of each is below, trimmed.
| Grader | Good at | Weak at |
|---|---|---|
| Code-based (string match, unit tests, tool-call checks, state checks) | Fast, cheap, objective, reproducible, easy to debug | Brittle when a valid answer is worded differently; no nuance |
| Model-based (an LLM scores against a rubric) | Flexible, handles open-ended answers, scales | Not deterministic, costs more, must be calibrated against humans |
| Human (expert review, spot checks) | Gold-standard judgement | Slow and expensive |
Anthropic's advice is to choose "deterministic graders where possible, LLM graders where necessary or for additional flexibility". Use humans "judiciously for additional validation".
LLM-as-judge means asking a second model to score an answer, usually against a written rubric. A 2023 study found that strong judges like GPT-4 agreed with human preferences over 80% of the time (Zheng et al., 2023). That is about as often as humans agree with each other. The same study lists the biases to watch for. Judges can favour the answer shown first (position bias), longer answers (verbosity bias), and their own outputs (self-enhancement bias).
Two practical tips from Anthropic: give the judge a way out, such as returning "Unknown" when it lacks information. And grade each rubric item with a separate judge call, instead of one call that scores everything.
Offline evals vs online monitoring
Offline evaluation runs your agent on a fixed set of test cases before you ship. LangSmith's documentation lists its uses as benchmarking, regression testing, unit testing and backtesting. The test cases carry reference answers, so you can check correctness (LangSmith docs).
Online evaluation scores real production traffic after launch. There is no reference answer for a live user's question. So online graders look for patterns instead: safety problems, tool errors, slow runs, unhappy users. Failures you find online become new offline test cases.
Anthropic also separates two kinds of offline suites:
- Capability evals ask "What can this agent do well?" They should start with a low pass rate, so there is room to improve.
- Regression evals ask "Does the agent still handle all the tasks it used to?" They should pass close to 100% of the time. They belong in CI (continuous integration), the tests that run on every code change.
For a longer production view, with an e-commerce eval suite and a judge prompt, see the Agent Quality and Evaluation lesson in Crio's Production AI Agents course.
Worked example: evaluate a placement-prep agent in Python
Let us build a tiny eval harness for a student-facing agent. It answers questions about campus placement drives with three tools:
get_drive(company): read-only. Returns the CGPA cut-off, the backlog limit and the drive date.days_until(day): read-only. Counts days from today to a date.register(company): a write tool. It changes the database, so it should run only when the student asks.
To keep every output the same on every run, the agent is a scripted stand-in, not a real LLM. It is a few if rules that imitate an LLM's decisions. Version 1 has three deliberate bugs of the kind real models make. Version 2 fixes them. The companies and their rules are made up. You need only Python 3.9 or newer, with no pip install. Save each file in one folder.
Step 1: the tools and the stand-in agent
# placement_agent.py: three tools and a scripted stand-in agent (no LLM) for a placement-prep assistant
import re
from datetime import date
TODAY = date(2026, 11, 21) # fixed, so every run prints the same numbers
DRIVES = { # made-up companies and rules, for this example only
"zentrix": {"min_cgpa": 7.5, "max_backlogs": 0, "date": "2026-11-28"},
"quillsoft": {"min_cgpa": 7.0, "max_backlogs": 1, "date": "2026-11-28"},
"nova systems": {"min_cgpa": 7.0, "max_backlogs": 1, "date": "2026-12-04"},
"brightpath": {"min_cgpa": 8.0, "max_backlogs": 0, "date": "2026-12-10"},
"orbitel": {"min_cgpa": 6.5, "max_backlogs": 2, "date": "2027-01-08"},
}
REGISTERED = set() # the "database" that the write tool changes
def get_drive(company):
"""Read-only: eligibility rules and date of a company's campus drive."""
if company not in DRIVES:
return {"error": f"unknown company {company!r}"}
return {"company": company, **DRIVES[company]}
def days_until(day):
"""Read-only: days from TODAY to a date written as YYYY-MM-DD."""
return (date.fromisoformat(day) - TODAY).days
def register(company):
"""WRITE: registers the student for a drive. Call it only when the user asks."""
REGISTERED.add(company)
return {"registered": company}
TOOLS = {"get_drive": get_drive, "days_until": days_until, "register": register}
class SkippedTool(Exception):
"""Raised when the flaky stand-in 'decides' to skip a tool call and guess."""
def run_agent(question, version=1, slip=None):
"""Scripted stand-in for an LLM agent. Returns (final_answer, trace).
version=1 has three deliberate bugs of the kind real models make; version=2 fixes them.
slip: optional function; when it returns True, the agent skips that tool call and guesses.
"""
trace = []
def call(tool, **args):
if slip is not None and slip():
raise SkippedTool(tool)
result = TOOLS[tool](**args)
trace.append({"tool": tool, "args": args, "result": result})
return result
q = question.lower()
company = next((c for c in DRIVES if c in q), None)
rule = re.search(r"cgpa ([\d.]+), (\d+) backlog", q)
try:
if company is None:
return "Sorry, I can only help with campus placement drives.", trace
name = company.title()
if q.startswith("register"):
call("register", company=company)
return f"Done. You are registered for the {name} drive.", trace
if rule: # eligibility question
cgpa, backlogs = float(rule.group(1)), int(rule.group(2))
arg = company.split()[0] if version == 1 else company # BUG 1 (v1): drops words of the name
d = call("get_drive", company=arg)
if "error" in d:
return "I could not find that drive.", trace
ok = cgpa >= d["min_cgpa"] and backlogs <= d["max_backlogs"]
if version == 1 and ok and cgpa >= 8.0:
call("register", company=company) # BUG 2 (v1): registers without being asked
verdict = "Yes, you are eligible" if ok else "No, you are not eligible"
return (f"{verdict} for {name}. It needs CGPA {d['min_cgpa']} or more "
f"and at most {d['max_backlogs']} backlog(s)."), trace
if "before" in q: # "Is the X drive before 1 December?"
if version == 1: # BUG 3 (v1): answers from "memory" without calling the tool
return f"No, the {name} drive is after 1 December.", trace
d = call("get_drive", company=company)
before = d["date"] < "2026-12-01"
return f"{'Yes' if before else 'No'}. The {name} drive is on {d['date']}.", trace
d = call("get_drive", company=company) # "how many days until X?"
n = call("days_until", day=d["date"])
return f"The {name} drive is on {d['date']}, {n} days from today.", trace
except SkippedTool:
return "I think it is fine, but please check with your placement cell.", trace
if __name__ == "__main__":
answer, trace = run_agent("How many days until the Nova Systems drive?", version=2)
for step in trace:
print("tool call:", step["tool"], step["args"], "->", step["result"])
print("answer:", answer)
Run it with python3 placement_agent.py. Output:
tool call: get_drive {'company': 'nova systems'} -> {'company': 'nova systems', 'min_cgpa': 7.0, 'max_backlogs': 1, 'date': '2026-12-04'}
tool call: days_until {'day': '2026-12-04'} -> 13
answer: The Nova Systems drive is on 2026-12-04, 13 days from today.
The trace list is the trajectory. A real agent framework records the same thing: each tool name, its arguments and its result. TODAY is fixed to 21 November 2026, so the day counts never change.
Step 2: the eval harness and three graders
Each test case holds a question, a phrase the answer must contain, the expected tool calls and the expected database state. The harness resets the database before every trial, so one test cannot leak into the next. Case 8 is a question the agent should decline, with no tools at all. Testing the "should not act" side matters as much as the "should act" side.
# run_evals.py: an eval harness with three code-based graders (answer, trajectory, end state)
import placement_agent as pa
D = "get_drive"
CASES = [ # (question, phrase the answer must contain, expected tool calls, expected registrations)
("Am I eligible for Zentrix? CGPA 7.8, 0 backlogs", "you are eligible", [(D, {"company": "zentrix"})], set()),
("Am I eligible for Quillsoft? CGPA 6.9, 1 backlog", "not eligible", [(D, {"company": "quillsoft"})], set()),
("How many days until the Nova Systems drive?", "13 days",
[(D, {"company": "nova systems"}), ("days_until", {"day": "2026-12-04"})], set()),
("Register me for the Zentrix drive", "registered", [("register", {"company": "zentrix"})], {"zentrix"}),
("Am I eligible for Brightpath? CGPA 8.2, 0 backlogs", "you are eligible", [(D, {"company": "brightpath"})], set()),
("When is the Orbitel drive and how many days are left?", "48 days",
[(D, {"company": "orbitel"}), ("days_until", {"day": "2027-01-08"})], set()),
("Am I eligible for Nova Systems? CGPA 7.2, 2 backlogs", "not eligible", [(D, {"company": "nova systems"})], set()),
("What is the weather in Pune today?", "only help with", [], set()),
("Is the Quillsoft drive before 1 December?", "yes", [(D, {"company": "quillsoft"})], set()),
("Am I eligible for Orbitel? CGPA 6.4, 0 backlogs", "not eligible", [(D, {"company": "orbitel"})], set()),
]
def grade(case, version=1, slip=None):
question, phrase, expected, want_state = case
pa.REGISTERED.clear() # every trial starts from a clean environment
answer, trace = pa.run_agent(question, version, slip)
called = [(s["tool"], s["args"]) for s in trace]
return {
"answer": phrase in answer.lower(), # outcome: what the user reads
"tools": sorted({t for t, _ in called}) == sorted({t for t, _ in expected}), # right tools, any order
"args_ok": sum(e in called for e in expected), "args_total": len(expected),
"state": pa.REGISTERED == want_state, # outcome: the database
"steps": len(called),
}
def evaluate(version, show=True):
rows = [grade(c, version) for c in CASES]
for r in rows:
r["pass"] = r["answer"] and r["tools"] and r["state"] and r["args_ok"] == r["args_total"]
if show:
print(f"agent v{version} answer tools args state steps PASS")
for i, r in enumerate(rows, 1):
f = lambda ok: "ok " if ok else "FAIL"
print(f"case {i:>2} {f(r['answer'])} {f(r['tools'])} {r['args_ok']}/{r['args_total']} "
f"{f(r['state'])} {r['steps']} {f(r['pass'])}")
n = len(rows)
summary = {
"answer-only success": sum(r["answer"] for r in rows) / n,
"task success (all graders)": sum(r["pass"] for r in rows) / n,
"tool-selection accuracy": sum(r["tools"] for r in rows) / n,
"argument accuracy": sum(r["args_ok"] for r in rows) / sum(r["args_total"] for r in rows),
"average tool calls per task": sum(r["steps"] for r in rows) / n,
}
if show:
for k, v in summary.items():
print(f"{k:<29} {v:.2f}" if "average" in k else f"{k:<29} {v:.0%}")
return rows, summary
if __name__ == "__main__":
evaluate(version=1)
answer, trace = pa.run_agent(CASES[4][0], version=1) # look inside case 5
print("case 5 answer:", answer)
print("case 5 tool calls:", [(s["tool"], s["args"]) for s in trace])
Run it with python3 run_evals.py. Output:
agent v1 answer tools args state steps PASS
case 1 ok ok 1/1 ok 1 ok
case 2 ok ok 1/1 ok 1 ok
case 3 ok ok 2/2 ok 2 ok
case 4 ok ok 1/1 ok 1 ok
case 5 ok FAIL 1/1 FAIL 2 FAIL
case 6 ok ok 2/2 ok 2 ok
case 7 FAIL ok 0/1 ok 1 FAIL
case 8 ok ok 0/0 ok 0 ok
case 9 FAIL FAIL 0/1 ok 0 FAIL
case 10 ok ok 1/1 ok 1 ok
answer-only success 80%
task success (all graders) 70%
tool-selection accuracy 80%
argument accuracy 82%
average tool calls per task 1.10
case 5 answer: Yes, you are eligible for Brightpath. It needs CGPA 8.0 or more and at most 0 backlog(s).
case 5 tool calls: [('get_drive', {'company': 'brightpath'}), ('register', {'company': 'brightpath'})]
Read the table one case at a time. Each failure is a different kind of bug:
- Case 7 (wrong argument). The agent picked the right tool but sent
"nova"instead of"nova systems". The tool returned an error and the answer was wrong. Tool selection alone would have scored this as fine. Argument accuracy caught it. - Case 9 (skipped tool). The agent answered from "memory" without calling
get_drive. The answer was wrong, and the trajectory shows why: zero tool calls. - Case 5 (right answer, wrong trajectory). The answer is correct, word for word. But the agent also called
register, which the student never asked for. An answer-only grader passes this case. The tool check and the state check both fail it.
That gap is the whole argument for trajectory and state checks. The answer-only score says 80%. The real task success rate is 70%. In a real product, case 5 is a student registered for a drive they did not choose.
The tool check compares sets, so the order of calls does not matter. That follows Anthropic's warning about brittle sequence checks.
Step 3: pass@k vs pass^k from repeated runs
Next, take the fixed agent (version 2) and make it flaky. Before each tool call, it skips the call and guesses 10% of the time. A seeded random generator decides, so you get the same "random" failures on every run. Each task runs 10 times.
# reliability.py: run the fixed agent 10 times per task with random slips, then compute pass@k and pass^k
import random
from math import comb
from run_evals import CASES, grade
N, P_SLIP = 10, 0.10 # 10 trials per task; each tool call is skipped with probability 0.10
rng = random.Random(42) # fixed seed, so the "random" failures are the same on every run
slip = lambda: rng.random() < P_SLIP
def passed(case):
g = grade(case, version=2, slip=slip)
return g["answer"] and g["tools"] and g["state"] and g["args_ok"] == g["args_total"]
def pass_at_k(n, c, k): # chance that at least one of k trials passes (Chen et al., 2021)
return 1 - comb(n - c, k) / comb(n, k)
def pass_hat_k(n, c, k): # chance that all k trials pass (Yao et al., 2024, tau-bench)
return comb(c, k) / comb(n, k)
successes = [sum(passed(case) for _ in range(N)) for case in CASES]
print("passes out of 10, per task:", successes)
print("k pass@k pass^k")
for k in (1, 3, 5):
at = sum(pass_at_k(N, c, k) for c in successes) / len(CASES)
hat = sum(pass_hat_k(N, c, k) for c in successes) / len(CASES)
print(f"{k} {at:.2f} {hat:.2f}")
Run it with python3 reliability.py. Output:
passes out of 10, per task: [7, 8, 8, 8, 10, 9, 10, 10, 7, 9]
k pass@k pass^k
1 0.86 0.86
3 1.00 0.64
5 1.00 0.48
At k = 3, pass@3 rounds to 1.00, because every task passed at least 7 of 10 times. Yet pass^3 is only 0.64. Ask the agent the same question three times, and all three runs succeed only about two times in three. Multi-step tasks suffer most: each extra tool call is one more chance to slip.
The case 8 refusal passed 10 of 10, because it calls no tools. Sierra's τ-bench code computes pass^k with the same formula, math.comb(success_count, k) / math.comb(num_trials, k) (agent_metrics.py).
Step 4: a rubric grader (an LLM-as-judge stand-in)
Some qualities are hard to check with exact strings, such as "explains the reason". That is where an LLM-as-judge helps. Below, simple keyword rules stand in for the judge LLM, so the output is deterministic. In a real setup, each rubric line becomes its own judge prompt. The point of the script is calibration: before you trust any judge, compare it with answers a human has already labelled.
# judge_standin.py: a rubric grader. STAND-IN: keyword rules replace the LLM so the output is deterministic
import re
RUBRIC = { # in a real setup, each line becomes its own prompt to a judge LLM
"decision": "States clearly whether the student is eligible.",
"reason": "Quotes the rule it used (the CGPA cut-off or the backlog limit).",
"no_extra_action": "Does not claim any action the student did not ask for.",
}
def judge(answer):
"""Returns 1 (pass), 0 (fail) or 'unknown' per criterion, like a judge allowed to say 'Unknown'."""
a = answer.lower()
if len(a.split()) < 3:
return {name: "unknown" for name in RUBRIC} # too little to judge: give the judge a way out
return {
"decision": int(bool(re.search(r"\b(not )?eligible\b", a))),
"reason": int(bool(re.search(r"cgpa \d|backlog", a))),
"no_extra_action": int("registered" not in a),
}
# Calibration: answers a human already labelled (True = a good answer). Does the judge agree?
LABELLED = [
("No, you are not eligible for Quillsoft. It needs CGPA 7.0 or more and at most 1 backlog(s).", True),
("Yes, you are eligible for Brightpath. I have also registered you.", False),
("You are eligible.", False),
("Eligible? Sadly no. Orbitel wants CGPA 6.5 and you have 6.4.", True),
("Yes, you are eligible for Zentrix. It needs CGPA 7.5 or more and at most 0 backlog(s).", True),
("Maybe.", False),
("You clear the Zentrix cut-off of CGPA 7.5 with no backlogs, so you can sit for the drive.", True),
("Yes, you are eligible for Quillsoft. It needs CGPA 7.0 or more.", False), # wrong: the student has 6.9
]
agree = 0
for answer, human_ok in LABELLED:
scores = judge(answer)
judge_ok = all(v == 1 for v in scores.values())
agree += judge_ok == human_ok
print(f"human={'good' if human_ok else 'bad '} judge={'good' if judge_ok else 'bad '} {scores}")
print(f"judge agrees with the human on {agree} of {len(LABELLED)} answers")
Run it with python3 judge_standin.py. Output:
human=good judge=good {'decision': 1, 'reason': 1, 'no_extra_action': 1}
human=bad judge=bad {'decision': 1, 'reason': 0, 'no_extra_action': 0}
human=bad judge=bad {'decision': 1, 'reason': 0, 'no_extra_action': 1}
human=good judge=good {'decision': 1, 'reason': 1, 'no_extra_action': 1}
human=good judge=good {'decision': 1, 'reason': 1, 'no_extra_action': 1}
human=bad judge=bad {'decision': 'unknown', 'reason': 'unknown', 'no_extra_action': 'unknown'}
human=good judge=bad {'decision': 0, 'reason': 1, 'no_extra_action': 1}
human=bad judge=good {'decision': 1, 'reason': 1, 'no_extra_action': 1}
judge agrees with the human on 6 of 8 answers
The two disagreements are the lesson. The seventh answer is correct, but it never uses the word "eligible", so the brittle rule fails it. The eighth answer is confident and well formed, but wrong: the student has CGPA 6.9. A judge that only reads style cannot catch a wrong fact. You need a reference answer, or a code check against the tool result.
A real LLM judge will make different mistakes from this keyword stand-in, but it will still make some. That is why Anthropic says LLM judges "should be closely calibrated with human experts".
Step 5: a regression gate for CI
Finally, turn the suite into a gate. If task success drops below 90%, or the agent makes any unexpected database change, the script exits with code 1. Most CI systems, such as GitHub Actions, fail the build on a non-zero exit code.
# ci_gate.py: fail the build when the agent regresses. Usage: python3 ci_gate.py <agent version>
import sys
from run_evals import evaluate
MIN_SUCCESS = 0.90 # regression suites should sit near 100%, so a small drop is a real signal
version = int(sys.argv[1]) if len(sys.argv) > 1 else 2
rows, summary = evaluate(version, show=False)
failed = [i for i, r in enumerate(rows, 1) if not r["pass"]]
unasked_writes = [i for i, r in enumerate(rows, 1) if not r["state"]]
print(f"agent v{version}: task success {summary['task success (all graders)']:.0%}, failed cases {failed}, "
f"unexpected database changes in cases {unasked_writes}")
if summary["task success (all graders)"] < MIN_SUCCESS or unasked_writes:
print("BLOCK: do not merge")
sys.exit(1)
print("PASS: safe to merge")
Run it on the buggy version:
python3 ci_gate.py 1
Output (exit code 1):
agent v1: task success 70%, failed cases [5, 7, 9], unexpected database changes in cases [5]
BLOCK: do not merge
And on the fixed version:
python3 ci_gate.py 2
Output (exit code 0):
agent v2: task success 100%, failed cases [], unexpected database changes in cases []
PASS: safe to merge
With a real LLM, run several trials per task in CI too. Gate on a threshold, not on perfect scores, because a single flaky trial should not block every merge.
What changes with a real LLM
Swap run_agent for your real agent and keep the harness. Three things change:
- Record latency and tokens. Time each task, and read token counts from the usage field your model API returns. Track cost per task next to success rate.
- Run trials in parallel. Ten trials of ten tasks is 100 agent runs, so cost and time grow with every trial you add.
- Read the transcripts. Anthropic says it does not take eval scores at face value "until someone digs into the details of the eval and reads some transcripts". Failing tests are sometimes bugs in the grader, not the agent.
AI agent evaluation tools compared
You do not need a tool to start. Tools help when you want dashboards, tracing, shared datasets or ready-made metrics. Versions below were read from PyPI, npm and GitHub on 21 November 2026.
| Tool | What it evaluates | Agent and trajectory checks | Licence | Latest version |
|---|---|---|---|---|
| DeepEval | LLM apps, RAG, chatbots and agents, written like pytest unit tests | Task Completion, Tool Correctness, Argument Correctness, Step Efficiency and more | Apache-2.0 | 4.3.4 (PyPI, 11 Nov 2026) |
| Ragas | RAG and LLM apps | Tool Call Accuracy (strict or flexible order), Tool Call F1, Agent Goal Accuracy | Apache-2.0 | 0.4.4 (PyPI, 14 Nov 2026) |
| Promptfoo | Prompts, agents and RAG from a YAML config and CLI; also red teaming | trajectory:tool-used, tool-args-match, tool-sequence, step-count assertions | MIT | 0.126.0 (npm, 18 Nov 2026) |
| Inspect AI | Model and agent evals from the UK AI Security Institute; 200+ ready-made evals | Built-in agents, tools, custom scorers, sandboxes for untrusted code | MIT | 0.3.291 (PyPI, 17 Nov 2026) |
| LangSmith | Hosted tracing plus offline and online evals | Datasets of expected tool calls or trajectories; graders on live traces | Hosted service; langsmith SDK is MIT | SDK 0.16.0 (PyPI, 21 Nov 2026) |
| Arize Phoenix | Self-hosted tracing (OpenTelemetry), datasets, experiments | Code evaluators and LLM-as-judge, pre-built metrics for tool-calling agents | Elastic License 2.0 | 22.0.0 (PyPI, 20 Nov 2026) |
| OpenAI Evals | Open-source eval framework and benchmark registry | Custom evals in Python or YAML | MIT (datasets have their own licences) | 3.0.1.post1 (PyPI, 1 May 2024) |
| τ-bench | A benchmark, not a framework: airline, retail and telecom support tasks with a simulated user | Grades the final database state; reports pass^k | MIT | v2.0.0 (GitHub, 20 Oct 2026) |
Notes that matter when you choose:
- OpenAI's hosted Evals platform has a 30 November 2026 shutdown date. OpenAI's deprecations page lists the "Evals dashboard, API, and graders for eval workflows" as read-only, with shutdown on 30 November 2026. Its recommended replacement is "Migrate to Promptfoo". The separate open-source
openai/evalsrepository is still public, but its last PyPI release was in May 2024. - Promptfoo is now part of OpenAI. Promptfoo announced the deal on 9 March 2026 and said it "will remain open source" (Promptfoo blog). It is still MIT licensed.
- LangSmith has a free tier. The Developer plan is $0 for one seat with up to 5,000 base traces a month. Self-hosting is on the Enterprise plan (pricing).
- Phoenix is self-hosted, but check the licence. The Elastic License 2.0 is a source-available licence with conditions. It is not on the OSI list of approved open-source licences. Read it before you build a hosted product on Phoenix.
- τ-bench has moved. The original
sierra-research/tau-benchrepository warns that its tasks "are not updated" and points to thetau2-benchrepository.
How to choose an AI agent evaluation tool
- You write Python tests and want ready-made agent metrics: DeepEval or Ragas.
- You want config files, a CLI and security testing in CI: Promptfoo.
- You run research-style or safety evals with sandboxes: Inspect AI.
- You need tracing and online evals for a live app: LangSmith (hosted) or Phoenix (self-hosted).
- You want to compare models on a public benchmark: τ-bench. Remember that a benchmark score is not a test of your own product.
Anthropic's view applies to every option here: a framework is "only as good as the eval tasks you run through them".
Agentic AI testing strategy: a checklist
Use this as your agentic AI testing strategy when you start. Most points come from Anthropic's roadmap in the article above.
- Start small. Anthropic says "20-50 simple tasks drawn from real failures is a great start".
- Write unambiguous tasks. Two experts should reach the same verdict. Keep a reference solution that passes every grader.
- Balance the set. Include cases where the agent should act and cases where it should not, like case 8.
- Isolate trials. Start every trial from a clean environment, as
grade()does. - Grade outcomes, then the essential steps, and run several trials per task.
- Gate merges on a regression suite, grow it from production failures, and read transcripts every week.
Honest limits
- The example agent is a stand-in. It fails in neat, labelled ways. Real models fail in messier ways, and their failure rates change with each model version and prompt. Measure your own agent; do not reuse our numbers.
- Keyword graders are brittle. Step 4 showed one rejecting a correct answer. LLM judges are more flexible, but they cost money on every run and carry the biases listed above.
- More trials cost more. pass^k needs many runs per task. With a paid API, every extra trial adds to the bill and to the CI time.
- Benchmarks age. Anthropic notes that SWE-bench Verified scores went from 40% to over 80% in one year. A saturated benchmark can no longer show progress.
- Evals do not prove an agent is safe. Text inside a web page, email or file can carry instructions that hijack the agent. This is called prompt injection. Test it on purpose with adversarial cases; Promptfoo's red-teaming mode is one option. Also limit what tools can do. Make tools read-only where possible, and require human approval for writes such as payments or registrations.
- Multi-agent systems are harder. When agents hand work to each other, a failure can start in one agent and surface in another. Crio's multi-agent systems explainer covers that design. Trace each hand-off and grade the final outcome.
If you are still choosing how to build the agent itself, the agentic AI frameworks comparison covers LangGraph, CrewAI, the OpenAI Agents SDK and others.
Common interview questions
How would you evaluate an AI agent? Build a set of tasks with clear success criteria. Grade the outcome (answer and end state) and the essential trajectory (tools, arguments, forbidden actions). Run several trials per task, report task success and pass^k, and gate releases on a regression suite.
What is the difference between pass@k and pass^k? pass@k is the chance that at least one of k trials succeeds. pass^k is the chance that all k succeed. pass@k suits tools where one good answer is enough. pass^k suits agents that must work every time.
Why is checking the final answer not enough? An agent can reach the right answer by guessing, or take an unrequested action on the way. Trajectory and state checks catch both.
FAQ
What are the most common AI agent evaluation metrics?
Task success rate, tool-selection accuracy, argument accuracy, step count, latency and cost per task. For reliability, add pass@k and pass^k from repeated trials. For agents that can change data, also count unexpected writes, such as a registration or refund the user never asked for. Pick the few metrics that match your product's real risks.
What is an AI agent evaluation framework?
It is a library or platform that runs your agent on test cases, records each trace and scores it with graders. Examples include DeepEval, Ragas, Promptfoo, Inspect AI, LangSmith and Arize Phoenix. You can also write a small framework yourself, as this post does, in about 250 lines of plain Python.
Is LLM-as-judge reliable?
It can be, after calibration. A 2023 study found strong judges agreed with human preferences over 80% of the time. Judges still show position, verbosity and self-preference biases. Compare the judge with human-labelled answers before you trust it, and check facts with code or reference answers instead.
How many test cases do I need to evaluate an AI agent?
Fewer than you think to start. Anthropic suggests that 20 to 50 simple tasks drawn from real failures is a good first suite. Early changes have large effects, so small sets show them. Grow the suite as you find new failures in testing and production. Mature agents need larger and harder sets.
Should I check the exact order of tool calls?
Usually not. Anthropic found exact-sequence checks too rigid, because agents often find valid paths the test writer did not expect. Check the required tools, the key arguments and the forbidden actions instead. Check order only when it truly matters, such as verifying identity before a refund.
Can I evaluate an AI agent for free?
Yes. The harness in this post uses only Python's standard library. DeepEval, Ragas, Promptfoo and Inspect AI are free and open source. LangSmith has a free Developer plan. The real cost is the model calls during testing, because every trial of every task is a paid or compute-heavy agent run.
Keep going
For the bigger picture of building LLM apps, read how to build your own Jarvis with LLMs. Then see whether AI will replace software developers, and which skills still matter.
If you want to build, evaluate and ship LLM apps and agents with mentors reviewing your work, look at Crio's Fellowship Program in AI Engineering.
