AI agents

How to Evaluate an AI Agent Before Launch

Antonio Evans8 min read

A robot runs an obstacle course of hoops, hurdles and balance beams while two people with clipboards and a stopwatch score each attempt.
Key points

Key points

  1. 1Write down what success means for the agent in measurable terms before you build a single test, because vague goals produce tests that cannot fail.
  2. 2Build the first evaluation set from real requests and real failures, and include cases where the agent should not act as well as cases where it should.
  3. 3Grade the outcome and the trace, not only the final message, because many agent failures hide behind a fluent, confident answer.
  4. 4Run each task several times, calibrate any model-based grader against human labels and set a launch bar before you look at the scores.

Start with a definition of success

Most teams test an agent the same way at first: they try a handful of prompts, read the answers and decide it feels good enough. That works for a prototype. It stops working once other people depend on the agent, because nobody can say whether a change made it better or worse.

An evaluation, or eval, replaces that feeling with a repeatable test. Anthropic defines it simply: "give an AI an input, then apply grading logic to its output to measure success" (Anthropic, Demystifying evals for AI agents). The hard part is the grading logic, and that starts with a clear statement of what success means.

Google Cloud's guidance on agent evaluation shows the difference between a goal you can test and one you cannot (Google Cloud, A methodical approach to agent evaluation):

Vague goalTestable success statement
"The agent should be helpful."A factually correct, concise summary fully grounded in the provided documents.
"The agent should book trips."A correctly booked multi-leg flight that meets every user constraint on time, cost and airline, with no errors.

Write two or three statements like these for your agent. Then add the constraints that matter in production: how many turns a task may take, what it may cost, which actions need a human and what the agent must never do. Each statement becomes one or more checks.

Anthropic notes a side benefit. Two engineers reading the same specification often disagree about how the agent should handle edge cases, and writing eval tasks forces that disagreement into the open before launch rather than after.

Build a task set from real cases

The test set does not need to be large to be useful. Anthropic's guide says teams often delay evals because they think they need hundreds of tasks, when "20-50 simple tasks drawn from real failures is a great start." Early in development each change has a large effect, so a small set is enough to see it (Anthropic).

Where to find the first tasks:

  1. The checks you already run by hand before each demo or release.
  2. Support tickets and bug reports if anything is already in production.
  3. Requests from people who will use the agent, written in their own words, not cleaned up by engineers.
  4. Adversarial inputs: prompt injection attempts, off-topic requests, angry users and missing information.

Each task needs inputs, an expected outcome and, ideally, a reference solution that you have confirmed passes your graders. Anthropic's test for task quality is that two domain experts would independently reach the same pass or fail verdict. If they would not, the task is ambiguous, and ambiguity in tasks becomes noise in your scores.

Balance matters as much as size. Anthropic describes building search evals for its own assistant: if you only test cases where the model should search, you end up with an agent that searches for everything. Include cases where the right behavior is to not call a tool, not take an action or hand off to a person (Anthropic).

Langfuse recommends scoping each dataset to one question, such as end-to-end support or retrieval alone, and sizing it to the job. Its working guide suggests around 10 items to explore a single issue and 100 to 1,000 items for checks on larger changes that should cover the production distribution. It also warns that a dataset of easy cases "scores 95 percent forever and tells you nothing" (Langfuse, Golden dataset evaluation).

Grade the outcome and the trace

The most dangerous agent failures produce a good-looking final message. Confident AI describes several patterns that output-only scoring misses (Confident AI, AI agent evaluation guide):

  • The ghost action. A booking agent replies "Done, your flight is booked" but never called the booking tool. The message is fluent and relevant, and nothing happened.
  • The interrogation loop. A user gives an order number, and the agent keeps asking for it, because it never maps the number into the tool's parameter.
  • The confident fabricator. A research agent fills gaps in stale search results with its own guesses and presents them as current facts.
  • The budget burner. The task completes, but only after many redundant model calls that multiply cost.

To catch these, separate two things Anthropic distinguishes clearly. The transcript is the full record of a run: messages, tool calls, reasoning and intermediate results. The outcome is the final state of the world. "A flight-booking agent might say 'Your flight has been booked' at the end of the transcript, but the outcome is whether a reservation exists in the environment's SQL database" (Anthropic).

So for each task, check the outcome directly where you can: query the database, read the file, inspect the ticket status. Then check the trace for things the outcome cannot show: forbidden tool calls, too many turns, excessive tokens or a step that leaked data.

Google Cloud calls the reverse case a silent failure: an agent reports the right inventory number but read it from last year's report. The answer is correct and the process is wrong, and only the trajectory reveals it (Google Cloud).

One caution. Do not require one exact sequence of tool calls. Anthropic found that approach "too rigid," because agents regularly find valid paths the designers did not anticipate. Grade what the agent produced and the rules it must not break, and give partial credit for multi-step tasks where it got some of the way.

Pick the right grader for each check

There are three kinds of graders, and a good eval mixes them. The table below summarizes Anthropic's comparison (Anthropic):

GraderGood forWeaknesses
CodeExact matches, state checks, tool-call checks, schema validation, turn and token limitsBrittle to valid variations, poor at nuance
ModelTone, helpfulness, groundedness, open-ended answersNon-deterministic, costs more, needs calibration
HumanGround truth, subjective quality, calibrating model gradersSlow, expensive, hard to scale

The rule of thumb is to use code wherever a check can be written as code, a model where it cannot and humans to set the standard and check the model graders. Google Cloud recommends the same layering and adds a fourth category, adversarial testing, to see whether the agent fails safely under hostile input (Google Cloud).

A single support task might combine all of them:

task: refund-damaged-item
input: "My blender arrived cracked. Order 4821. I want my money back."
graders:
  - type: state_check            # code
    expect: { refunds: { order: 4821, status: processed } }
  - type: tool_calls             # code
    must_include: [verify_identity, process_refund]
    must_not_include: [delete_account]
  - type: transcript             # code
    max_turns: 8
  - type: rubric                 # model
    checks:
      - "Explains the refund timeline in plain words"
      - "Does not promise anything the policy does not allow"

Make model-based judges trustworthy

A model that grades another model is only as good as its prompt and its calibration. Evidently AI describes building a judge as "a small ML project": label a set of examples yourself, write the evaluation prompt, run it on your labels and measure agreement with metrics such as precision and recall before trusting it (Evidently AI, LLM-as-a-judge guide).

Practical rules from the sources:

  • Keep each judge to one question. Evidently recommends splitting dimensions such as tone and accuracy into separate evaluations and using clear binary choices where possible. Anthropic likewise recommends grading each dimension with an isolated judge rather than one judge for everything.
  • Give the judge a way out. Anthropic suggests instructing it to return "Unknown" when it lacks the information to decide, which reduces invented verdicts.
  • Keep a held-out set. Evidently recommends reserving part of your labeled data to test the final judge prompt, so you do not tune the judge to the same examples you measure it on.
  • Bring in domain experts. The people who know what a good answer looks like should write the criteria and review disagreements.
  • Recalibrate. Expectations shift as you read more outputs, a pattern Evidently calls criteria drift, so re-check the judge against fresh human labels periodically.

Google Cloud puts the order of operations plainly: humans identify the failure modes first, then the judge is built to detect them and aligned against the human grading before deployment (Google Cloud).

Run every task more than once

Agents are not deterministic. The same task can pass on one run and fail on the next, so a single pass tells you little. Anthropic calls each attempt a trial and recommends running several per task. It also describes two metrics for summarizing them (Anthropic):

  • pass@k is the chance that at least one of k attempts succeeds. It suits tools where one good answer is enough, such as generating candidate solutions.
  • pass^k is the chance that all k attempts succeed. It suits customer-facing agents, where every user expects it to work.

The gap between them can be large. If a task succeeds 75 percent of the time, the chance of three successes in a row is 0.75 cubed, about 42 percent. An agent that "usually works" can still fail a large share of customers.

Keep the test environment clean between trials. Anthropic warns that shared state, such as leftover files or cached data, can cause correlated failures or inflate scores. In one internal case, a model gained an unfair advantage by reading the git history left by previous trials.

Set a launch bar and keep the suite alive

Decide the bar before you see the results, so the numbers cannot talk you into launching. A reasonable bar names a minimum pass rate per suite, zero failures on safety and permission checks, and limits on turns and cost per task. Anthropic separates two kinds of suite: capability evals, which start with a low pass rate and give the team something to climb, and regression evals, which "should have a nearly 100% pass rate" and catch anything that breaks (Anthropic).

Before launch, read transcripts, not only scores. Anthropic's rule is not to take eval scores at face value until someone has read some transcripts, because a failure might be the agent's fault or a broken grader. It also notes that a 0 percent pass rate across many trials is usually a sign of a broken task rather than an incapable agent.

After launch, the evaluation set becomes a living record. Langfuse recommends routing flagged production traces, such as thumbs-down feedback, into the dataset as candidates, having an expert write the corrected expected output, deduplicating near-identical items and versioning the dataset so scores from different dates stay comparable (Langfuse).

A short pre-launch checklist:

  • Success statements are written and each maps to at least one check.
  • The task set includes real requests, past failures and cases where the agent should decline or hand off.
  • Outcome checks verify state, not just the agent's claims.
  • Model judges are calibrated against human labels and a held-out set.
  • Every task runs several trials, and customer-facing flows are judged on consistency.
  • The launch bar was written down before the final run.
  • Someone has read a sample of transcripts from the final run.

The same suite earns its keep after launch. Rerun it before every prompt change, tool change or model swap, including when you move an agent to a different model through a gateway such as Quanta Inference.

FAQ

FAQ

How many test cases do I need before launch?

Fewer than most teams expect to start. Anthropic suggests 20 to 50 tasks drawn from real failures as a strong first set, because early changes have large effects. Grow the set as the agent matures and as production surfaces failures you did not anticipate.

Should I use an LLM as a judge or write code checks?

Use both. Code checks are fast, cheap and objective, so use them for anything verifiable, such as database state, tool calls and formats. Use a model judge only for qualities code cannot measure, such as tone or groundedness, and calibrate it against human labels first.

Why run the same task several times?

Because agents give different results on the same input. A single pass can hide a task that fails one time in three. Running several trials and tracking how often all of them pass shows whether customers will get consistent behavior.

What is the difference between capability and regression evals?

Capability evals measure what the agent cannot yet do well and start with low pass rates. Regression evals cover what it already does and should pass almost every time. When a capability task passes reliably, move it into the regression suite.

How do I keep an evaluation set from going stale?

Feed it from production. Add failed or flagged conversations as candidate tasks, have an expert write the correct outcome, remove near-duplicates and version the dataset. Date each item so you can see how much of the set reflects current usage.

Sources

Sources

  1. https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents
  2. https://cloud.google.com/blog/topics/developers-practitioners/a-methodical-approach-to-agent-evaluation
  3. https://langfuse.com/resources/engineering/golden-dataset-evaluation
  4. https://www.confident-ai.com/blog/definitive-ai-agent-evaluation-guide
  5. https://www.evidentlyai.com/llm-guide/llm-as-a-judge
About the author

About the author

Antonio Evans
Antonio Evans

Antonio Evans is the founder of Quanta Intelligence and a fractional CTO who builds HIPAA-ready AI systems for health and life-science companies. Before that he was technical co-founder of FriendsEAT for twenty years, CEO of Socialdraft, and a data engineer at IBM. Antonio lives with his dog Santino in Lisbon, Portugal.

All articles