Skip to content
News

How to build a golden dataset for AI agents

One ambiguous supplier email becomes a reusable agent test. See how to preserve the exact evidence, agree on expected behavior and keep results comparable as your agent changes.

Offset holes form curved bands across two saffron sheets.

On most mornings, a purchasing coordinator can read an email about a delayed part and say which orders need attention. One Friday, a supplier says “the Thursday shipment” is moving to Monday. There are two Thursday shipments under the same purchase order, and the sketch in the email names only one part. The coordinator uses the part reference to identify the affected line and checks whether Monday is a commitment or a proposed date before telling production to replan.

A team evaluating an agent for that work can turn this example into a reusable test. A golden dataset is a collection of reviewed examples with the inputs, relevant evidence and expected behavior recorded for each case. For agents, that behavior may include checking the right record, asking a question when the evidence is ambiguous, or stopping before making a change. A single sample answer rarely captures everything a reviewer cares about.

Build the first case from a decision someone had to make

Start with one decision the team would trust the agent to prepare. In this example the agent drafts a note for purchasing about a change to a shipment. Its test environment contains synthetic purchase orders and supplier messages. It can read them and draft a note; the purchasing coordinator still owns the conversation with the supplier.

The first case might preserve the following details. Use stable identifiers so someone else can assemble exactly the same test again.

Case PO01: A date change to one purchase order line

  • Request. “Which of the Thursday shipments needs our attention, and what should I check with the supplier?”

  • Inputs. The synthetic supplier message, the original order, the two schedule entries and the part reference visible in the message. The date is marked as proposed.

  • Expected behavior. Identify the affected line and cite the evidence that distinguishes it from the other shipment. Treat Monday as proposed. Leave the current schedule unchanged and surface the need for confirmation.

  • Evidence to score. The draft, the source records it references and any available tool actions or resulting changes in the test environment.

Make the fixture self contained. The case should say which source versions the agent can read and what a tool should return in that test environment. If a copy of the order used in the fixture later changes, the next run should still have access to the original test inputs. When a case comes from a real trace, use only material your team is authorized to reuse and remove customer identifiers, credentials and irrelevant personal data. A synthetic fixture can preserve the ambiguity without preserving the original message.

A limestone white shuttle reaches for an archival box between deep shelves.

Add cases with reasons, not quotas

PO01 teaches the reviewer what a good interpretation looks like when the part reference is available. Change one condition and the appropriate response changes. With the part reference missing, a good draft should ask which shipment the supplier means and avoid choosing a line. With a later written confirmation, the draft can report the new date as confirmed and cite the newer message.

Those cases are useful for testing a difference you can name. You also want examples of the ordinary work the agent handles most often: a clearly numbered shipment, a date confirmed without ambiguity and an email that requires no change at all. A set made up only of failures is useful for regression testing; its pass rate won't tell you how often those failures happen in daily work.

Keep a small set of cases outside day to day prompt tuning for a more independent check before a rollout. Group close variants in the same split so a slightly reworded PO01 doesn't end up pretending to be fresh evidence. When there are too few cases for a meaningful estimate, describe which behaviors you exercised and what remains unknown. LangSmith's dataset documentation illustrates how versioning and splits can work in an evaluation tool. A versioned file and a well defined export can serve the same purpose for a small team.

Decide what counts before you look at the results

For PO01, the source record identifiers and the absence of a schedule change can be checked against the fixture and tool evidence. Whether the note communicates the uncertainty clearly requires someone who understands the workflow. They might accept several phrasings, provided the reader can tell that Monday still needs confirmation. Save that judgment alongside the case so the next reviewer can apply it.

Separate serious failures from overall scores. A draft that nails the date and cites the right source still fails the case if the agent changes the schedule without permission. The strongest evidence is the recorded action or resulting state, where the test environment exposes it. If you can't observe that state, say so in the evaluation; the agent's claim that it made no change is a different kind of evidence. Anthropic's guide to agent evaluations covers this distinction between judging a response and examining what an agent actually did.

Copper traces enter a pale ceramic edge beside narrow machined channels.

Test the baseline and proposed agent against the same dataset revision, with comparable tools, instructions and environment apart from the change you're testing. Repeat cases when behavior varies, and keep individual attempts available so a pass on rerun doesn't erase an earlier failure. If a test case turns out to have a wrong expectation, correct it in a new dataset revision and rerun both candidates where the comparison matters. Our guide to LLM evaluation covers scoring methods in more detail.

Make the dataset something the next reviewer can use

In a Swarm Space, keep a copy of the approved case list, its fixture references and the reasoning behind disputed labels. Save a Task asking an authorized agent to prepare cases from selected evidence or review a comparison your test runner produced. If the runner and its files are in your existing coding environment, the connected agent can work there within its access. Record the dataset revision, baseline, proposed version and important failures with the results in the Space. Link the evidence a reviewer needs to reproduce the comparison.

One useful first pass is to take a failure the team remembers, open its original report and see whether a second person can reproduce the case from the saved record alone. If they have to ask what the supplier meant, which version of the order was visible or whether the agent could write to the schedule, you have found the missing part of your dataset. For a fuller example of keeping the evidence of a failure, see how agents can learn from mistakes. For a compact model of that review, see how to make an experiment result independently checkable with the original input and scoring rule.

Silver frost traces staggered tea rows on a hillside in early light.

When another shipment case turns up, the person who reviews it can start with the purchasing team's earlier decisions. That continuity is what makes the dataset worth keeping: the judgment behind each example remains available when the agent, its tools or the people running the tests change.

Swarm | How to build a golden dataset for AI agents