Build a dataset
Collect examples and traces in datasets, in the app, from existing traces, or from code.
A dataset is ten or so real requests your agent has handled, such as "refund the order I placed last week" or "change my shipping address".
Datasets live under Datasets & Tests in the app. Use them to collect examples and traces you want to keep, to label a dataset against a judge, and to export test cases out of Judgment.
Datasets and test suites
To test your agent, use a test suite. Test suites keep their own cases and don't read from datasets: add the rows you want to test as cases. For a dataset of saved traces, each case names its trace and the run grades it without running your agent; see Add cases from traces, and From a dataset for the code. Test configs, which ran a dataset directly, end on November 12, 2026.
Before you begin
Select your project. Creating or populating a dataset requires the Developer role or higher in the organization that owns it. This role applies to every project in that organization. Ask an Admin or Owner for a role change if needed.
For the code examples, install and configure judgeval with a personal API key; an ingest key cannot write datasets. To copy production evidence, first send a completed trace.
Pick the fields first
Every dataset has a schema, and every test case must fill every field. Choose the fields by what you plan to do with the dataset:
- To collect agent inputs, give the dataset the fields your agent takes as input. For a chat agent that's one string field,
input, holding the user's request. To test with them, add the rows to a test suite as cases. - To keep traces for re-scoring with a changed judge, or to label the dataset, the dataset needs a trace field (or a session field) that points at existing traces. To grade trace-field rows in a test, add them to a test suite as cases from traces. Session-field rows can't be graded as stored traces.
Once a test case is added, the schema can't change.
Ask the agent to build it
- Open Datasets & Tests and select New Dataset.
- The dialog asks "What test cases should we create for your agent?" Describe what you want, or pick a suggestion: Turn recent failures into test cases or Build a regression set for my agent.
- Type
@to add context, for example an Issue, a saved view, or a judge label. You can also attach files. - Send the prompt. The agent reads your project's traces and creates the dataset.
This is the fastest way to turn an Issue into test cases. Mention the Issue, for example "Lookups time out and the agent silently drops the result", and ask for test cases that cover it.
Add traces you already have
When you're looking at a trace that shows the problem, add it straight to a dataset. To test against it instead, choose Add to test case; see Add cases from traces.
- In the traces table, select one or more traces and choose Add to Dataset.
- In a single trace's view, use Add to Dataset from the header.
- Sessions have the same action.
- A judge action can add matching traces for you with Add to dataset.
In the dialog, pick an existing dataset or Create New Dataset. The schema presets decide what gets copied from the trace:
| Preset | Fields |
|---|---|
| Trace only | trace |
| Session only | session |
| LLM Eval | input, actual_output, trace |
| Full Trace | input, output, span_name, duration, llm_cost, tags, behaviors (the trace's labels), trace |
Field and API names still say behavior; it means label.
Issue evidence works the same way: open an evidence trace from the Issue and add it.
Create one by hand
- Select New Dataset, then Create manually.
- In Create empty dataset, enter a name.
- Select Define schema and add your fields, or start from a preset.
- Fill it with Add to Dataset from traces, or from code (below). The app has no form for typing test cases in one by one, and no file upload.
Create one from code
Code is the easiest way to keep a hand-written list of prompts in your repo and push it to Judgment.
from judgeval import Judgeval
from judgeval.data import Example
client = Judgeval(project_name="my-agent")
prompts = [
"refund the order I placed last week",
"change my shipping address",
"cancel my subscription before it renews",
]
client.datasets.create(
name="regression",
schema={"type": "object", "properties": {"input": {"type": "string"}}},
examples=[Example.create(input=p) for p in prompts],
)Both read JUDGMENT_API_KEY and JUDGMENT_ORG_ID from the environment. Dataset names are unique per project; create fails if the name exists unless you pass overwrite=True (Python) or overwrite: true (TypeScript), and overwrite is refused once test configs use the dataset. To append later in Python, fetch the dataset with client.datasets.get(name="regression") and call add_examples(...) or add_from_json(path).
Coding agents can do the same through MCP with create_dataset and add_examples_to_dataset. See MCP tools.
Versions
Every change to a dataset's test cases creates a new version. Adding cases creates one; removing cases creates one too, and earlier versions keep the removed cases. The dataset header shows Version {n}, and you can switch to an earlier version there.
A legacy test config run uses the latest version unless you pin one with dataset_version.
To take test cases out of Judgment, export them from the dataset (the Export Examples dialog).