Evaluating your agents with test sets means running them against a fixed collection of inputs with known expected outcomes, then scoring the results consistently. This gives you a repeatable way to compare agent versions, catch regressions before deployment, and decide whether a change actually improved performance. Before you start, you need a clear definition of what “good” looks like for your agent, a representative sample of real inputs, and a way to record outputs. No special tooling is required beyond a spreadsheet or a simple script, though an evaluation harness helps at scale.
What You'll Need
- A written definition of the agent’s job and what counts as a correct or acceptable response.
- A set of test inputs drawn from real usage, edge cases, and known failure modes.
- Expected outputs or scoring criteria for each input (exact match, rubric, or human judgment).
- A way to run the agent on each input automatically or semi-automatically.
- A place to store results: a spreadsheet, database, or evaluation tool.
- Optionally, a second reviewer for subjective criteria to reduce bias.
Step-by-Step
- Define the evaluation goal. Decide what you are measuring: correctness, helpfulness, safety, tone, or task completion. Write one sentence per criterion so every reviewer applies the same standard. For example, “A correct answer contains the requested date and does not invent a policy.”
- Collect representative inputs. Pull real user requests from logs if available, then add edge cases: empty input, ambiguous requests, out-of-scope questions, and inputs that previously caused failures. Aim for breadth over volume; 30–100 well-chosen cases often reveal more than thousands of random ones.
- Write expected outputs or rubrics. For deterministic tasks, record the exact expected answer. For open-ended tasks, write a short rubric with 3–5 criteria and a pass/fail or 1–5 scale. Keep rubrics specific enough that two reviewers would agree.
- Build the test set file. Store each case as a row with an ID, input, expected output or rubric, and any metadata such as category or difficulty. Use a consistent format (CSV or JSON) so you can rerun the same set later.
- Run the agent on every case. Automate the run if possible, capturing the full output and any errors. If the agent has side effects (sending emails, changing records), use a sandbox or mock environment.
- Score the outputs. Apply exact-match scoring for deterministic cases and rubric scoring for open-ended ones. For subjective criteria, have a second person score a sample independently and compare; large disagreements mean the rubric needs tightening.
- Analyze results by category. Calculate pass rates overall and per category (e.g., edge cases, common requests). Look for patterns in failures rather than only the total score.
- Record a baseline. Save the results of your current agent version as the baseline. Every future change should be compared against this baseline on the same test set.
- Iterate and re-run. After changing prompts, tools, or models, rerun the full test set. Treat any drop in a category as a regression until you understand why it happened.
- Version the test set. When you add or change cases, create a new version. Keep old versions so you can compare results across time and avoid moving the goalposts.
Common Mistakes
- Testing only happy paths. If every case is a clean, well-formed request, the test set will miss the failures users actually hit.
- Vague rubrics. “Good answer” is not a criterion. Without specific, observable requirements, scores drift between reviewers and runs.
- Changing the test set and the agent at the same time. You cannot tell whether a score change came from the agent or the test set. Change one at a time.
- Ignoring category-level results. An overall score can hide a serious regression in a small but important category such as safety or billing questions.
- Scoring from memory. Always record outputs before scoring. Reviewing outputs after seeing the expected answer biases judgment.
- Treating one run as definitive. Agents can be nondeterministic. Run each case multiple times if outputs vary, and report the distribution.
Tips
- Start small and grow. A 50-case test set you actually maintain beats a 5,000-case set that goes stale.
- Include a “known failures” section for cases the agent currently fails. These become your regression checks.
- Use exact-match scoring only where the answer is truly deterministic; otherwise use rubrics or human review.
- Log the agent’s full output, including tool calls and intermediate steps, so you can debug failures without rerunning.
- Review a random sample of passing cases too; false passes are easy to miss.
- Keep test inputs separate from training or prompt examples to avoid inflated scores.
- Automate the run-and-score loop early; manual evaluation does not scale and invites inconsistency.
Troubleshooting
- Scores are inconsistent between runs. The agent may be nondeterministic. Run each case 3–5 times and report pass rate rather than a single pass/fail.
- Reviewers disagree on scores. The rubric is too vague. Rewrite criteria as observable statements and calibrate on a few examples together.
- The agent passes tests but fails in production. The test set does not reflect real inputs. Add cases from production logs and edge cases you missed.
- Every case fails after a change. Check for a broken integration, missing credentials, or a prompt change that removed required context before assuming the model regressed.
- Evaluation takes too long. Automate the run, parallelize where possible, and reserve human review for subjective or high-risk categories.
- You cannot reproduce a failure. Capture the exact input, agent version, and configuration. Without versioning, failures are not reproducible.
Frequently Asked Questions
How many test cases do I need?
There is no fixed number. Start with enough cases to cover each category and known failure mode, often 30–100. Expand as you discover new edge cases. Coverage matters more than raw count.
Should I use exact match or human review?
Use exact match for deterministic tasks with one correct answer. Use rubrics or human review for open-ended tasks where multiple answers are acceptable. Many teams combine both.
How often should I rerun the test set?
Rerun after every change to the agent, its prompts, tools, or model. Also rerun on a schedule to catch drift from external dependencies.
Can I use the same test set for multiple agents?
Yes, if the agents share the same task and output format. Otherwise, adapt the expected outputs and rubrics to each agent’s job so the comparison is fair.
What is a regression in agent evaluation?
A regression is a case that previously passed and now fails after a change. Tracking regressions separately from new failures helps you prioritize fixes.
Do I need special tools to evaluate agents?
No. A spreadsheet and a script to run the agent can work for small sets. Evaluation frameworks help with automation, versioning, and scoring at scale, but they are optional.