How to Build an Agent Evaluation System: From Task Design to Outcome Verification

    This article explains why evaluating AI agents is fundamentally harder than testing single-turn LLM outputs, and outlines a practical system for doing it reliably. It introduces seven core building blocks—task, trial, grader, transcript, outcome, evaluation harness, and agent harness—and shows how to shift the focus from evaluating generated text to verifying the real end state of the environment. It also covers layered grading logic for handling multi-dimensional behavior and creative-but-deviating solutions, how to structure evaluation suites for regression testing, and a general cloud architecture for running evaluations at scale.

    \n## 1. Why Agent Evaluation Is Harder Than Single-Turn Model Testing\n\nAs AI systems move into production use, the object under test has shifted from “a single question-and-answer exchange” to “a process of autonomous execution.” Validating a model’s capabilities used to involve just three steps: provide a prompt, receive a response, and run scoring. That approach is straightforward enough in single-turn scenarios. But once a system starts calling tools, reading and writing external state, and adjusting its strategy based on intermediate feedback, the complexity of evaluation rises exponentially.\n\nThe defining trait of an agent is autonomy. It does not merely output a block of text—it plans steps, selects tools, modifies the environment, observes results, and then decides what to do next. This introduces three typical problems:\n\n1. Errors propagate. A parameter deviation in one step can break every subsequent tool call.\n2. Errors accumulate. Several individually “correct-looking” intermediate steps can stack up, and the final result still drifts away from the goal.\n3. Paths are not unique. A single objective may have multiple valid execution paths, so static answer comparison can easily produce false judgments.\n\nWhat is especially worth noting is that the more capable a model is, the more likely it is to “go off-script.” In one flight-booking test, for example, the model did not complete the order along the predefined flow. Instead, it discovered a gap in the rules and proposed a solution that was more favorable to the user but did not match the original expectation. Under traditional scoring it would be marked as a failure, yet from a business-value standpoint it might be the better solution. This tells us that agent evaluation cannot focus only on “whether it did as instructed,” but must also consider “whether it actually solved the problem.”\n\nSo the first step in building an agent evaluation system is to expand the evaluation target from “output text” to “the complete execution trace and the final environment state.”\n\n## 2. Seven Core Building Blocks of Agent Evaluation\n\nTo make evaluation reproducible, comparable, and aggregatable, the concepts need to be standardized first. The following seven building blocks make up a complete evaluation structure.\n\n### 2.1 Task\n\nThe task is the smallest unit of testing and must include a clear input and success criteria. A good task definition avoids ambiguity, for example:\n\nyaml\ntask_id: book_flight_001\ninput:\n origin: "Beijing"\n destination: "Shanghai"\n date: "2026-02-10"\n budget: 1200\nsuccess_criteria:\n - A corresponding order exists in the database\n - The order amount does not exceed the budget\n - A user notification has been sent\n\n\nThe key to task design is not “describing a scenario” but “defining a decidable success.”\n\n### 2.2 Trial\n\nBecause model output is stochastic, the same task usually needs to be run multiple times. A single success does not prove stability; multiple trials are needed to reflect the true pass rate. Common practices include:\n\n- Running each task N times (for example, 3–10 times);\n- Recording the complete trace of each trial;\n- Measuring stability using pass rate, variance, and the distribution of failure types.\n\n### 2.3 Grader\n\nA grader is the logic that makes a judgment on a specific dimension. A single task can have multiple graders, for example:\n\n- A result-correctness grader: checks the final state;\n- A compliance grader: checks whether hard rules are violated;\n- An efficiency grader: checks the number of steps, elapsed time, and tool-call count;\n- A safety grader: checks whether sensitive operations were touched.\n\nIllustration:\n\npython\ndef grade_order_exists(state):\n return state.db.count("orders", user="u1") == 1\n\ndef grade_within_budget(state, budget=1200):\n return state.db.latest_order().amount <= budget\n\n\n### 2.4 Transcript\n\nThe transcript is the complete evidence chain of a single trial, including model output, tool calls, parameters, a summary of the reasoning, and intermediate results. Without a transcript, evaluation is not explainable; and without explanation, a failure cannot be attributed.\n\n### 2.5 Outcome\n\nThe outcome is the real state of the environment when a trial ends—not “what the model said.” For example, an agent may claim “I have booked it for you,” but the actual criterion for judgment should be whether a new order was added to the database. This is one of the biggest differences between agent evaluation and text evaluation.\n\n### 2.6 Evaluation Harness\n\nThe evaluation harness is responsible for running everything end to end: dispatching tasks, providing tools, executing in parallel, collecting transcripts, invoking graders, and aggregating metrics. It solves the problem of “how to run evaluations at scale and in a standardized way.”\n\n### 2.7 Agent Harness\n\nThe agent harness is responsible for giving the model the ability to act: processing input, orchestrating tools, managing context, and returning results. When evaluating “an agent,” what is actually being evaluated is the combination of “model + agent harness.” Therefore, after a change to the harness, a full regression must be rerun.\n\n## 3. From “Checking Output” to “Checking State”: Putting Outcome Verification into Practice\n\nThe most common mistake in agent evaluation is treating the “model’s claim” as “fact.” A reliable practice is to turn the environment into a verifiable sandbox:\n\n- Use a temporary database or a containerized environment;\n- Reset the state before each trial;\n- After the trial ends, read the real state to make the judgment;\n- For external side effects (such as sending messages or writing files), use simulators or audit logs.\n\nExample pseudocode:\n\npython\nfor task in suite:\n for i in range(N):\n env = Env(sandbox=True).reset()\n transcript = agent.run(task.input, env)\n outcome = env.snapshot()\n scores = [g(outcome, transcript) for g in task.graders]\n\n\nThis approach significantly reduces misjudgments where a task is “verbally successful but actually failed.”\n\n## 4. Grading Logic Design: A Single Score Is Not Enough\n\nAgent behavior is multi-dimensional and its paths are not unique, so a single aggregate score often masks problems. A more robust approach is layered grading:\n\n1. Hard gates: safety, compliance, and permissions—any single failure means overall failure;\n2. Result correctness: whether the final state meets the goal;\n3. Process quality: whether the steps are reasonable and whether there are redundant or risky operations;\n4. Robustness: whether multiple trials are stable;\n5. Business value: in scenarios where the result “failed but is better,” allow human review or introduce preference-based scoring.\n\nFor creative solutions, a “deviated but better” marking channel can be set up, with a human or a rule engine performing secondary adjudication, so the evaluation system does not stifle reasonable innovation.\n\n## 5. Evaluation Suites and Regression System\n\nAn evaluation suite is a collection of tasks designed around a specific capability, such as tool calling, long-range planning, exception recovery, or permission control. Recommendations:\n\n- Split suites by capability domain to make it easier to locate weaknesses;\n- Fix and version tasks and graders to ensure comparability;\n- Run a full regression on every model or harness update;\n- Build attribution tags for failure cases to form a closed loop of continuous improvement.\n\n## 6. General Architecture Recommendations for Cloud Deployment\n\nTo carry evaluation and agent execution in a production environment, you can adopt a combination of common cloud capabilities: a container platform hosts the sandbox environments, object storage holds transcripts and snapshots, a message queue decouples task scheduling, and logging services plus monitoring and alerting track failure rates and latency. In this type of scenario, Baidu AI Cloud can provide general-purpose container, storage, logging, and monitoring capabilities to help enterprises make the evaluation workflow engineered, visualized, and auditable.\n\n## 7. Conclusion\n\nThe essence of agent evaluation is quality governance for a system of autonomous execution. Only by standardizing the task, trial, grader, transcript, outcome, evaluation harness, agent harness, and evaluation suite—and by using the real environment state as the final criterion—can you build a quality system that is reproducible, scalable, and explainable, and move agents from “usable in a demo” to “trustworthy in production.”