[KongchangAI]
· 4 min read· 2,106 words

Agent Evaluation Guide: How to Test AI Agents and the Software They Use

Agent Evaluation Guide: How to Test AI Agents and the Software They Use

Agents are now software users, requiring end-to-end evals to measure task success rates and reliability.

The article notes that Agents are replacing humans in using software; traditional testing only asks "does it work," while evals ask "how often and how well." The author proposes an Agent testing pyramid (deterministic, single-turn, end-to-end) and four steps for building E2E evals: setting goals, defining metrics (success rate, Pass@k, Pass^k), designing task sets, and running via the Harbor framework. It also warns of reward hacking, tasks that are too easy, and looking only at averages, emphasizing continuous comparative iteration.

Agents are becoming the users of software, doing work on behalf of humans. Whether you're building an Agent or building the software it uses (APIs, CLIs, MCP servers, SDKs), evals are the key means of measuring the quality of work completed. This article, based on a systematic review of Agent evaluation systems by the technical community, breaks down how to build end-to-end evaluations for Agents and the software they depend on.

Agent evaluation framework overview

Why Traditional Testing Falls Short

An Agent may have completed a "successful" order, but the user wanted an iced latte and it ordered a hot one instead. The request succeeded, the observability logs look normal, but the result is wrong. What's worse, LLM outputs vary from run to run, and a single manual test passing doesn't prove a fix works. You need to repeatedly execute the same task, score the results, and compare before and after changes.

This is what evals do: if testing asks "does it work?", evals ask "how often does it work, and how well?" Give the Agent a task, score the result, then aggregate results across multiple attempts.

The Agent Testing Pyramid

Based on the number of LLM calls typically required, Agent software testing can be divided into three layers:

  • Deterministic tests (0 calls): Verify whether the software's own behavior meets expectations—for example, whether a search command returns only matching cafes, or whether a quote correctly calculates tax and tip.
  • Single-turn evals (1 call): Check a single decision by the Agent—for example, whether it selected the correct command, or whether the parameters are reasonable.
  • End-to-end evals (2+ calls, spanning the entire task): Have the Agent complete an entire task in an environment, then check whether the final result meets user needs. Popular coding benchmarks like SWE-bench and Terminal-Bench are all E2E evals.

The principle for using the pyramid: start from the problem you want to catch, and choose the lowest layer that can catch it. Deterministic tests are cheap and fast and should make up the bulk of your test suite; E2E evals are expensive and should only be used to verify overall task success.

The economics of using LLM call count as the layering criterion deserve elaboration. A single LLM call means one model inference, with costs including token fees and latency; an end-to-end task can easily involve dozens of calls, and each trial must rebuild the environment from the same initial state. Therefore, pyramid-bottom test cases can run at high frequency on every commit, while E2E evals are typically triggered only nightly or before release. In addition, the failure diagnosis granularity differs greatly across layers: a deterministic test failure can be pinpointed directly to a specific function or parameter validation; a single-turn eval failure indicates the model made a judgment error at some decision point; an E2E failure may combine multiple causes such as unclear tool descriptions, environment instability, and multi-step planning errors, requiring traces to drill down layer by layer. In practice, a combined strategy of "bottom-layer regression interception, top-layer capability monitoring" is often adopted: deterministic tests serve as commit gates, while E2E evals serve as capability dashboards.

Four Steps to Building End-to-End Evals

Step 1: Set Goals

Building E2E evals for all scenarios is unrealistic. Traditional software can pursue 100% test coverage, but the coverage scope for Agents is "everything an LLM might do to your product," and the boundaries are extremely hard to define. You should start from an outcome the user cares about and narrow it to a scope that can be evaluated with a small number of tasks. Goals typically come from three places: observability data (which Agents are using it, where they fail), customer feedback (support tickets, churn reasons), and the product roadmap (the hypotheses most in need of validation).

For example, the operator of a coffee-ordering API found that most Agent traffic came from Claude Code and Codex, and that the most frequent support ticket was "the Agent ordered the wrong drink"—ordering hot when iced was requested, or going over budget after tax and tip. The goal is thus clear: improve the Agent's success rate at ordering the drink the user specifies.

Step 2: Define Metrics

The most commonly used metrics for E2E Agent evals include:

  • Success rate: the proportion of trials that pass.
  • Pass@k: the probability that at least one of k trials passes, answering "can the Agent do it at all?"
  • Pass^k: the probability that all k trials pass, answering "can I rely on it every time?"
  • Efficiency metrics (computed only on successful trials): steps, time, cost.

Take five trials as an example, assuming three pass—a 60% success rate. Pass@5 is about 99%, meaning given five chances it will almost certainly get it right once; but Pass^5 is only about 8%, meaning a user who orders coffee every day will likely encounter at least one wrong order each week. Both numbers are correct; they just answer different questions.

Which metric matters most depends on the cost of failure to the user. Morning coffee has no retry opportunity—the user needs it right every time—so you should optimize Pass^k. For a coding Agent with a test suite, a single failure just costs extra time and model cost, and the Agent can use test feedback to fix the code and retry, so Pass@k is more appropriate. For an email draft that needs user review, the cost of failure is just a quick edit, so success rate suffices.

Step 3: Design the Task Set

Goals are abstract; Agents need concrete tasks. A good task set should cover common scenarios, edge cases that easily trip up Agents, and at least one request where "the correct action is to take no action." Each task includes: instructions (the user request), environment (where the Agent works, with the same starting state for each trial), verifier (checks the final state, ideally scoring each constraint separately), and optional reference answer (proving the task is solvable).

The degree of environment fidelity can be adjusted as needed. What matters is giving the Agent real tools, but using seed data and a frozen clock to ensure every trial starts from the same morning.

The design quality of the verifier directly determines the credibility of the eval. An ideal verifier should only read the final state produced by the Agent's actions (such as order records, file contents), rather than relying on the Agent's self-reported "I completed it." Scoring each constraint separately is a common practice: a task may simultaneously include multiple constraints such as correct drink type, correct temperature, total price within budget, and pickup time meeting requirements, each judged independently, with a final reward=1 only if all are satisfied. The benefit of this design is that failed trials clearly expose which constraint was violated, facilitating attribution. The verifier also needs to be isolated from the Agent—the Agent must not be allowed to write to the data sources the verifier depends on, otherwise reward hacking will occur. For operations involving side effects (such as placing an order), the verifier should also check whether the number and order of operations meet expectations, not just whether the final state is correct.

Step 4: Run and Validate

Using the open-source framework Harbor (launched by the creator of Terminal-Bench), you can run Agents in containers, check results, and record traces. Core concepts include: Task (a problem to solve plus starting environment and success check), Variant (the Agent configuration under test, such as model, prompt, tools, memory, and skills), Trial (one attempt by a given Variant on a given Task), Run (all Variants running multiple times on all Tasks), and Trace (all messages, tool calls, logs, and files recorded during a trial).

The verifier runs after the Agent finishes, scoring each constraint item by item, with reward=1 only when all constraints pass. This way failed trials precisely show which item went wrong—wrong drink, timeout, or over budget.

Harbor is an open-source Agent evaluation framework from the Terminal-Bench team, whose core abstractions revolve around "reproducible containerized trials." Task defines the problem statement, Docker environment, and validation scripts; Variant combines the model under test, system prompt, available toolset, memory, and skills into a versionable configuration; Trial is an independent run of a Variant on a Task, with each Trial starting from a fresh container snapshot to ensure a consistent initial state; Run is the set of all Variant×Task combinations each run multiple times, used to compute aggregate metrics like Pass@k and Pass^k. Trace records all interactions between the Agent and the environment during a Trial—messages, tool calls, standard output, file changes—and is the main basis for post-hoc debugging and reward hacking investigation. When using such frameworks, pay attention to container resource quotas and timeout settings, otherwise long tasks may be judged as failed due to environment limits rather than Agent capability.

Common Pitfalls and Cautions

The most easily overlooked problem in E2E evals is reward hacking: if the Agent can directly edit order files or inventory data, it may bypass the CLI and cheat. In real evaluations, you should protect seed data and verifier code, ensuring the Agent can only update order records through the CLI.

Another problem is that tasks aren't hard enough. If tasks are too simple, you learn nothing from running them. You should deliberately add edge cases, such as the user's usual cafe being out of stock that day, a team order of six drinks with total price and pickup location constraints, and an unsolvable request—where the correct behavior is to inform the user rather than force an order. For unsolvable requests, the verifier also needs to check whether the Agent searched before giving up, which requires reading command logs the Agent cannot write to.

Finally, looking only at overall averages can mask a specific high-frequency failing task, so be sure to check results task by task. Moreover, 100% across five trials only means "no failure observed yet," not "never fails."

Reward hacking is more insidious in Agent evaluations than in traditional RL environments because the Agent has real filesystem and command-line permissions. Common cheating paths include: directly modifying the database or JSON files the verifier reads, forging command output, bypassing the CLI to call internal APIs, or even tampering with the clock to evade timeout constraints. Defenses include: placing seed data and verifier code in mount volumes the Agent container cannot write to; having the verifier trust only the final state it re-reads itself, not the Agent's log claims; recording signed audit logs for key operations, with the verifier checking log integrity; and designing tasks so that "the correct approach" must go through the expected tool path, making bypass paths either infeasible or obviously anomalous. In addition, tasks with abnormally high pass rates should be periodically manually reviewed to investigate whether there are undiscovered cheating surfaces.

From Evaluation to Iteration

Evals are not a one-time effort. After establishing a baseline, you can use the same task set to compare the effects of different models, prompts, and tool configurations, verify whether a certain Agent skill actually brings improvement, or A/B test prompt changes. This is the real value of evaluation: turning "it feels better" into repeatable, comparable data, so that Agent reliability improvements have a basis.

For developers building APIs, CLIs, or MCP servers, one reality is: the Agent is already your user, and it won't watch your launch video, but it will go through the same funnel as a human—discovery, selection, access, success. Evaluation helps you figure out how well it does at the last and most important stage.

One-line Summary

Agents have become software users, requiring end-to-end evals to measure task success rates and reliability.

Paragraph Summary

The article notes that Agents are replacing humans in using software; traditional testing only asks "does it work," while evals ask "how often does it work, and how well," requiring repeated tasks and scored aggregation of results. The author proposes an Agent testing pyramid: deterministic tests, single-turn evals, and end-to-end evals, advocating choosing the lowest layer that catches the problem you want to catch. Building E2E evals has four steps: set goals (from observability, customer feedback, roadmap), define metrics (success rate, Pass@k, Pass^k, efficiency, chosen based on failure cost), design the task set (covering common and edge cases, including unsolvable requests, with seed data and a frozen clock for the environment), and run validation in containers using the Harbor framework. The article also warns of pitfalls such as reward hacking, tasks that are too easy, and looking only at averages, emphasizing that evals should be continuously used for comparative iteration on models, prompts, and tool configurations.

#Agent evaluation#AI agent testing#end-to-end evals#Pass@k#Pass^k#reward hacking#Harbor framework#MCP server testing
Share:

Related articles