Applied AI · Evaluation practice
Build an evaluation loop for your AI agent
A practical guide to defining success, writing rubrics, improving an agent’s skill, and checking for bias—from a refund support bot to an enterprise rollout.
An AI agent can sound capable in a demo and still fail in ways that matter: it may invent a policy, promise a refund before checking an order, or handle equivalent customers differently. An evaluation loop gives a team a repeatable way to find these failures, improve the system, and check whether a change helped.
The basic cycle is simple: define success, test the agent, grade its behavior, inspect failures, change one thing, and run the tests again. A useful evaluation does not prove an agent will never fail. It provides evidence about how it behaves in the situations you have tested, and helps you monitor it as real use reveals new cases.
Start with one task and a clear goal
Choose a specific job the agent performs. “Be a better support agent” is too broad to evaluate. “Answer refund questions using the current policy, verify order details before judging eligibility, and escalate exceptions” is testable.
Write success criteria in observable terms. For a refund assistant, success could mean that it:
- states the return window correctly from the approved policy;
- checks the order before claiming a customer is eligible;
- does not promise a refund before the eligibility check;
- explains the next step clearly; and
- routes unclear or conflicting cases to a human.
Decide which failures are critical. A slightly awkward phrase may be tolerable; falsely confirming that money has been refunded may not be.
Build a realistic test set
Collect representative requests and the context needed to judge them: policy excerpts, mock order records, expected outcomes, and tool behavior. Include routine questions, edge cases, missing information, and situations where the agent should say it cannot determine the answer.
- Routine: “Can I return an item bought 10 days ago?” The policy allows 30 days and the mock order is eligible.
- Status: “Where’s my refund?” The order system says a refund was issued five days ago.
- Outside policy: The purchase was 45 days ago; the agent should explain the policy and offer the approved escalation path.
- Conflicting evidence: A prior message promised a refund, but the order system says ineligible; the agent should not guess.
- Missing information: The customer demands a refund but has not supplied an order identifier; the agent should ask for what is needed.
Check that test cases and expected outcomes are correct. A flawed reference answer can make a good response look wrong—or reward an unsafe one. Keep a stable set for version comparisons, then add verified examples when real failures surface.
Write a rubric that people can apply consistently
A rubric is a set of criteria and score descriptions used to judge an output. It turns “Was this a good answer?” into checks that reviewers can interpret similarly.
For example, a correctness rubric for the policy statement might be:
- 0 — Incorrect: gives the wrong return window or makes an unsupported promise.
- 1 — Partly correct: gives the right window but leaves out an important condition.
- 2 — Correct: states the policy accurately and only makes customer-specific claims supported by the order lookup.
Score other dimensions separately: policy accuracy, required tool use, completeness, appropriate uncertainty, escalation, and clarity. Use code for objective checks such as valid JSON, required fields, or whether the lookup tool was called. For open-ended quality, use trained human reviewers or a model grader with an explicit rubric. Check a sample of automated grades with humans, especially for consequential criteria.
Run each evaluation in a controlled environment
For comparisons, give each test a known starting state. Reset the conversation and mock order data between cases, and hold the model version, skill instructions, tools, prompt, and settings constant. This prevents one case from contaminating another and makes run-to-run comparisons more meaningful.
A test environment is a measurement setup; it does not mean production needs a separate agent for every customer. In production, one service can handle many conversations while keeping each customer’s session and data properly separated. For multi-step tasks, reset the environment before each full workflow, then let that workflow retain the state it needs internally.
Record what ran: model and version, skill or prompt revision, tools, test data, grader version, and scores. If outputs vary, repeat runs or report the variation rather than treating one run as conclusive.
Use failures to improve the skill
A skill is the agent’s task-specific instructions, knowledge, and workflow. Evaluation can improve it through the same loop:
- Run the current skill on the fixed test set.
- Inspect failed outputs, tool calls, and relevant context.
- Identify the cause: unclear instructions, missing policy, faulty tool behavior, model limitation, or an evaluation problem.
- Make a targeted change. For instance: “Check the order record and confirm eligibility before stating that a refund will be issued.”
- Add the verified failure to the regression set.
- Rerun the full set and compare each criterion, including critical failures.
If you change the test cases or scoring rubric at the same time as the skill, record that separately. Otherwise, you cannot tell whether the system improved or the measurement moved.
Test whether the agent treats equivalent cases differently
To probe a suspected bias, create matched cases: keep the relevant facts constant and change one attribute or framing at a time. For example, test whether identical refund requests receive different decisions when the customer name or writing style changes. For a support agent, compare service outcomes such as policy accuracy, unnecessary refusal, escalation, and time to resolution—not just wording.
- State the suspected behavior and why it matters.
- Create equivalent case pairs and verify that the changed detail is the only relevant difference.
- Run several repetitions when outputs can vary.
- Grade decisions with a fixed rubric; where practical, hide the variant label from human reviewers.
- Compare outcome and error rates, then inspect examples to understand the difference.
- Change the system if needed and rerun both matched cases and ordinary support cases.
A difference is a signal to investigate, not proof of its cause. The test itself may contain hidden differences, and a model grader may carry its own bias. Use domain and fairness expertise for consequential decisions, and review samples of machine grades with people.
Scale the practice across an enterprise
Large organizations can use shared evaluation infrastructure without forcing every team into one universal rubric. Keep common controls—such as privacy, policy compliance, traceability, and escalation—alongside criteria tailored to each task. Name owners for each test suite and rubric, version changes, and publish results by use case so a company-wide average does not hide a failing workflow.
Automate routine checks
- Run test suites on prompt, skill, model, or tool changes.
- Check structured outputs and required tool actions with code.
- Store scores, traces, and configuration for comparison.
Keep people in the loop
- Review ambiguous and high-impact cases.
- Calibrate reviewers against shared examples.
- Audit whether automated graders agree with human judgments.
After launch, keep measuring
Pre-deployment tests find known problems before launch; they cannot cover every future conversation. Start with a limited rollout, route uncertain or high-impact cases to trained people, and monitor sampled interactions for policy errors, unsupported promises, failed tool calls, and uneven outcomes. Protect customer data and restrict access to logs. Give the team a clear way to correct an answer, pause automation, or escalate an issue.
When a production issue is confirmed, turn it into a test case. That closes the loop: actual use teaches the evaluation set what it was missing, and the next skill revision has to pass that case as well as the existing suite.
Further reading: explore books on AI engineering and reliability for evaluation and production practices.
A practical first version
You do not need an elaborate platform to begin. Pick one task, write a handful of verified cases, define a short rubric, and save the exact configuration and outputs. Run it after every relevant change. Review failures, revise the skill, and rerun. Expand the suite as you learn.
OpenAI’s eval documentation describes running defined inputs against graders; Anthropic’s guide frames an eval as an input plus grading logic and discusses evaluating multi-step agents. Both support this core workflow, while real-world evaluation also needs careful case design, human review, and continued monitoring. See OpenAI’s evals guide, Anthropic’s guide to agent evals, and Anthropic’s discussion of challenges in evaluating AI systems.
The loop in one line: define success → create cases → run and grade → inspect failures → improve the skill → rerun → monitor real use.
Join the discussion
Share a question, correction, or something you learned. Sign in with GitHub to comment.
Comments powered by Giscus. You can also browse the discussions on GitHub.