Golden Datasets, Synthetic Data and Simulation
Your evaluation can only be as honest as the cases inside it. Collect them with care, label them clearly and keep them under version control.
A golden dataset is a reviewed set of tasks with agreed success criteria. Build it from real failures and real requests, fill gaps with expert-written and synthetic cases, keep it free of duplicates and leakage, and version it. Use a seeded simulator when the agent must act in a world that changes.
What you will learn: what belongs in a test case, where cases come from, how to check a dataset, how to generate synthetic data responsibly, how to make tests repeatable and how simulation works.
Prerequisites: Agent Testing: Unit to End-to-End and Agent Evaluation Framework.
The example runs in November 2026 with Python 3.13 and only the standard library. All orders, customers and cases are invented.
Why the dataset matters most
Graders, dashboards and release gates all depend on one thing: the list of situations you test. If the list holds only easy requests, a high score says little. If it holds cases that the prompt already quotes, the score is inflated. If nobody can say why a case expects a certain answer, a failure starts an argument instead of a fix.
A good dataset lets two people agree on whether a change helped. It records the knowledge your team gains about users, policies and failure modes, so that the same mistake is not rediscovered every quarter.
What a test case contains
| Field | Purpose | Example |
|---|---|---|
| Stable ID | Track history across versions | cancel-014 |
| Input | What the user or system provides | "Cancel order B200 please" |
| Starting state | The world before the run | B200 is still being packed |
| Expected outcome | What must be true afterward | B200 canceled, nothing else changed |
| Forbidden actions | What must never happen | No refund without approval |
| Slice labels | Report results by group | cancel, mobile, Spanish |
| Source and owner | Explain where it came from | Production, support team |
| Rationale | Why this is the right answer | Policy section on cancellations |
| Review date | Catch cases that went out of date | Next review in 90 days |
Describe the outcome rather than the exact path where you can. An agent may reach a correct result by a route you did not expect, and a test that demands one fixed sequence of calls will reject it. Reserve path checks for steps that really are required, such as an approval before a payment.
Give a case to two knowledgeable people and ask whether a sample answer passes. If they disagree, rewrite the criteria before using the case to judge a model.
Where cases come from
| Source | Strength | Watch out for |
|---|---|---|
| Production logs | Realistic wording and mix | Personal data; rare dangers may be absent |
| Reported bugs | Directly tied to harm | Overweighting one loud complaint |
| Subject experts | Covers rules and edge cases | Tidy wording that real users never type |
| Synthetic generation | Cheap breadth | Repetitive, unrealistic or wrongly labeled cases |
| Public benchmarks | External reference point | Not your tools or users; possible training overlap |
Anthropic's engineering guidance on agent evaluation suggests that teams start with roughly 20 to 50 tasks drawn from real failures rather than waiting for a large collection. That is a starting point, not a target. Add cases until each important kind of task and each serious risk is covered.
Build the first version in an afternoon
- List the jobs the agent is meant to do, in the users' words.
- Collect two or three real or realistic requests for each job.
- Add refusals: requests the agent must decline or hand over.
- Add unclear requests where the right move is to ask a question.
- Write expected outcomes in terms a program or reviewer can check.
- Run the current agent and read every result, including the passes.
- Fix the cases that turn out to be ambiguous or impossible.
Reading the passes matters. A case that passes for the wrong reason, perhaps because the grader accepts any confident sentence, gives false comfort until someone looks.
Coverage, slices and balance
One overall pass rate hides weak areas. Label every case with slices and set a minimum number for each. A useful starting grid crosses task type with difficulty and risk.
| Slice | Includes | Why separate it |
|---|---|---|
| Common tasks | The everyday requests | Regressions here affect most users |
| Edge cases | Missing data, odd formats, limits | Where brittle logic breaks |
| Refusals | Out of scope or not permitted | A helpful-looking answer can be a violation |
| Hostile input | Planted instructions, misuse attempts | Needs its own pass threshold |
| Failing tools | Timeouts, empty or wrong results | Tests recovery and honesty |
| Languages and groups | The people you actually serve | Averages can hide unequal quality |
Your dataset does not need to mirror production traffic exactly. It often helps to include more rare, serious cases than real life would. If you do, report results per slice, and weight them deliberately when you want an estimate of everyday performance.
Duplicates, leakage and contamination
Leakage happens when information about the test reaches the system being tested. The most common forms in agent projects are small and accidental.
- A test input is copied into the system prompt as an example.
- The expected answer sits in a file, ticket or index the agent can read.
- Engineers tune prompts against the same cases used to approve a release.
- Near-identical cases appear many times, so one behavior counts for many points.
- Public test items may already be part of a model's training data.
Keep a held-out set that people do not tune against. Use a development set for daily work, run the held-out set at release time, and replace held-out cases once the team has studied them closely. Agent Benchmarks and Datasets shows how contamination has affected well-known public tests.
A dataset checker and a seeded simulator
The script below checks a tiny dataset for duplicates, prompt overlap and thin slices, prints a content-based version, then runs a small simulated order system twice with the same seed.
"""Check a small golden dataset, then run a seeded simulation (invented data)."""
import hashlib
import json
import random
from collections import Counter
PROMPT_EXAMPLES = ["Where is my order A100?"]
CASES = [
{"id": "c1", "slice": "status", "input": "Where is my order A100?",
"expect": "report_status", "source": "production"},
{"id": "c2", "slice": "status", "input": "Has order B200 shipped yet?",
"expect": "report_status", "source": "production"},
{"id": "c3", "slice": "cancel", "input": "Cancel order B200 please",
"expect": "cancel", "source": "expert"},
{"id": "c4", "slice": "cancel", "input": "cancel order B200 PLEASE",
"expect": "cancel", "source": "synthetic"},
{"id": "c5", "slice": "refuse", "input": "Show me another customer's orders",
"expect": "refuse", "source": "expert"},
]
REQUIRED_SLICES = {"status": 2, "cancel": 2, "refuse": 2, "unclear": 1}
def normalize(text):
return " ".join(text.lower().split())
def check(cases):
problems = []
seen = {}
leaked = {normalize(t) for t in PROMPT_EXAMPLES}
for case in cases:
key = normalize(case["input"])
if key in seen:
problems.append(f"{case['id']}: duplicate of {seen[key]}")
seen.setdefault(key, case["id"])
if key in leaked:
problems.append(f"{case['id']}: also used as a prompt example")
counts = Counter(c["slice"] for c in cases)
for name, minimum in REQUIRED_SLICES.items():
if counts[name] < minimum:
problems.append(f"slice {name}: {counts[name]} of {minimum} cases")
return problems
def version(cases):
blob = json.dumps(cases, sort_keys=True).encode()
return hashlib.sha256(blob).hexdigest()[:12]
def simulate(seed, turns=4):
"""A simulated customer and order system. The same seed gives the same run."""
rng = random.Random(seed)
state = rng.choice(["packing", "shipped"])
log = [f"order starts as {state}"]
for _ in range(turns):
wish = rng.choice(["ask_status", "ask_cancel", "change_mind"])
if wish == "ask_cancel" and state == "packing":
state = "canceled"
log.append(f"{wish} -> {state}")
return log
if __name__ == "__main__":
print("dataset version:", version(CASES))
for problem in check(CASES):
print("PROBLEM", problem)
print()
print("\n".join(simulate(seed=1)))
print("replay identical:", simulate(1) == simulate(1))
Output:
dataset version: 2877bdf8f34b
PROBLEM c1: also used as a prompt example
PROBLEM c4: duplicate of c3
PROBLEM slice refuse: 1 of 2 cases
PROBLEM slice unclear: 0 of 1 cases
order starts as packing
change_mind -> packing
ask_status -> packing
ask_cancel -> canceled
ask_status -> canceled
replay identical: True
Four problems appear before any model is called: one case repeats a prompt example, one differs only by capital letters and spacing, and two slices are too thin. The simulation then shows a cancellation that succeeds because the order had not shipped. Because every random choice comes from the seed, the run can be replayed exactly. The duplicate check is deliberately simple; reworded copies need review or similarity search.
Version the dataset like code
A score means nothing without knowing which cases produced it. Store cases in plain text, review changes, and record an identifier such as a content hash with every result.
| Change | How to handle it |
|---|---|
| New cases added | New version; run old and new agents on both sets once |
| Expected outcome corrected | Note the reason; rescore affected history if you compare it |
| Case retired | Keep it in history with a reason; do not delete silently |
| Policy changed | Find all cases citing the policy and review them |
| Private data discovered | Remove it everywhere, including old copies and results |
Never remove a hard case just because it fails. If the case is wrong, say why. If it is right, it is doing its job.
Deterministic tests for a non-deterministic system
Model output varies, but much of an agent does not have to. Fix everything you can, so that a failure points at what changed.
| Source of variation | Control in tests |
|---|---|
| Model responses | Scripted or recorded replies for logic tests; repeated trials for quality tests |
| External services | Fakes that return fixed results and chosen errors |
| Current time | A clock passed in as a parameter |
| Random choices | A seeded generator owned by the test |
| Shared data | A fresh environment for each trial |
| Concurrency | Controlled ordering, plus separate stress tests |
With a scripted model you can assert exact behavior: which tool ran, what was refused, what was saved. With a real model, assert invariants that must hold in every trial, for example that no refund exceeds the order total, and measure the rest as a rate. Settings that reduce randomness help but do not promise identical output.
A recorded reply proves how your code handles that reply. It says nothing about what today's model would send. Refresh recordings when the model, prompt or tool schema changes, and keep some live trials.
Generate synthetic cases responsibly
Synthetic cases are most useful when you know which gap they fill. Ask for "more cancellation requests with a missing order number", not "more test data".
| Method | How it works | Good for |
|---|---|---|
| Templates | Fill slots with values from lists | Exact labels and full control |
| Mutations | Change typos, order, tone or length of real cases | Robustness with a known answer |
| State generation | Create records first, then ask about them | Answers that can be computed |
| Model generation | Ask a model for varied requests | Natural wording and unexpected angles |
| Fault generation | Combine tasks with tool failures | Recovery behavior |
Prefer methods where the correct answer follows from how the case was built. If a model writes both the question and the answer, a person should verify a sample, and every case that gates a release.
Checks before synthetic cases count
- Is the request something a real user could plausibly send?
- Is there exactly one defensible expected outcome, or a clear list of acceptable ones?
- Does it add a behavior the set did not already test?
- Is it free of real names, secrets and copied private text?
- Is it labeled as synthetic so results can be reported separately?
Simulation environments
Many agent tasks are conversations or sequences of actions, so a single input is not enough. A simulator provides a world the agent can change and, often, a simulated user who answers back.
The tau-bench paper is a published example of this design: a language model plays the user, the agent works with domain tools under written policy rules, and grading compares the database state at the end with an annotated goal state.
| Design choice | Recommendation |
|---|---|
| Fidelity | Model the rules that decide success; skip detail that never affects behavior |
| Reset | Each trial starts from the same state |
| User behavior | Include vague, impatient, mistaken and changing users |
| Faults | Make errors selectable by case, not random surprises |
| Logging | Record every message, call and state change |
| Limits | Cap turns and cost so a stuck pair cannot run on |
Mind the gap between simulation and reality
A simulated user may be more patient, clearer or more cooperative than a real one. A fake service may never return the strange response the real one sends once a week. Compare simulator transcripts with real ones, add the behaviors that are missing, and confirm important results in a staging environment with real integrations and test accounts. Check the simulated user too: if it forgets its goal or reveals the expected answer, the trial is invalid and should be fixed, not counted.
Privacy, rights and safety of test data
Test data often travels further than production data: into laptops, build systems and vendor dashboards. Apply the same care.
- Remove or replace personal details before a log becomes a case (PII Redaction and Data Leakage Prevention).
- Confirm you are allowed to use the content, including licensed or customer-owned text (Fairness, Privacy, Data and Copyright).
- Use reserved example domains and obviously fake identifiers.
- Keep credentials out of cases; point at sandbox accounts through configuration.
- Give datasets owners, access rules and retention periods (Safe Logging, Sampling and Retention).
- Store hostile test inputs where they cannot be mistaken for real instructions.
Keep the dataset alive
Set a rhythm. After each incident, add a case that would have caught it. Each month, review a sample of production runs and ask which situations are missing. Each quarter, retire cases for features that no longer exist and check that expected outcomes still match policy. Track which cases never fail; they may still guard against regressions, but they no longer show progress, so add harder ones as scores approach the ceiling.
Assign one owner for the dataset as a whole and an owner for each slice. Without ownership, expected answers drift away from the business rules they were meant to represent.
Common mistakes
| Mistake | Better approach |
|---|---|
| Waiting for thousands of cases | Start small with real failures and grow |
| Only successful, polite requests | Add refusals, unclear input and tool faults |
| Tuning on the release set | Keep a held-out set |
| Unreviewed model-written answers | Verify before a case gates anything |
| Changing cases without versions | Record a dataset version with each score |
| Raw production logs as test data | Minimize and replace personal data first |
Dataset checklist
- Each case has an ID, input, starting state, expected outcome and owner.
- Refusals, unclear requests and failing tools are represented.
- Every important slice meets a minimum count.
- Duplicates and overlap with prompts or indexes are checked.
- A held-out set exists and is used only for release decisions.
- Synthetic cases are labeled and sampled for human review.
- Simulator runs reset cleanly and can be replayed from a seed or recording.
- The dataset version is stored with every result.
Frequently asked questions
How is a golden dataset different from a benchmark?
A golden dataset reflects your tasks, rules and risks; a benchmark is a shared external test used for comparison.
Can synthetic data replace real examples?
It can widen coverage, but real requests and failures show what you did not think to generate.
What if there are several correct answers?
Check required facts and forbidden actions, or list acceptable outcomes, instead of matching one reference text.
How often should held-out cases be replaced?
Whenever the team has studied or tuned against them, and on a regular schedule as the product changes.
References and further reading
- Anthropic: demystifying evals for AI agents: tasks, trials, graders and starting a suite.
- tau-bench paper: simulated users, domain policies and state-based grading.
- Inspect: an open-source framework that organizes datasets, solvers and scorers.
- NIST AI 800-2 initial public draft: practices for automated benchmark evaluations.
Next steps
Task, Tool and Planning Metrics
Decide what to measure on these cases.
LLM Judges, Human Review and Ratings
Grade answers that rules cannot check.
Safety, Robustness and Adversarial Testing
Add hostile and unusual conditions.