# Datasets overview

Generate pinned dataset evals, record baselines, sync regression suites, and gate releases with the dataset CLI.

Source: https://www.agentclash.dev/docs/guides/datasets-overview
Markdown export: https://www.agentclash.dev/md/docs/guides/datasets-overview

Dataset evals run a **pinned version** of labeled examples through a challenge pack and deployment, then compare candidate runs against recorded baselines. They complement ad-hoc eval runs when you need reproducible regression signal tied to curated examples.

## Lifecycle

1. **Create or import a dataset** in the workspace (web UI, API, or the `agentclash dataset` CLI commands below).
2. **Pin a version** with examples linked to challenge cases.
3. **Run a dataset eval** — AgentClash executes each example and aggregates pass/fail.
4. **Record a baseline** from a green eval run.
5. **Gate CI** with `agentclash dataset test` (see [Dataset CI Gates](https://www.agentclash.dev/md/docs/guides/dataset-ci-gates)).

```bash
export AGENTCLASH_API_URL="https://api.agentclash.dev"
export AGENTCLASH_TOKEN="<token>"
export AGENTCLASH_WORKSPACE="<workspace-id>"

# Start an eval against a pinned version
agentclash dataset eval <datasetId> \
  --version <dataset-version-id> \
  --pack <challenge-pack-version-id> \
  --challenge support \
  --deployment <deployment-id>
```

## Manage datasets from the CLI

The whole dataset lifecycle is available under `agentclash dataset`.

```bash
# Create, inspect, list, archive
agentclash dataset create --name "Support set" --slug support \
  --description "Curated support questions" \
  --default-challenge-pack-version-id <challenge-pack-version-id>
agentclash dataset list --limit 20
agentclash dataset view <datasetId>
agentclash dataset delete <datasetId>        # archives the dataset
```

`dataset create` also accepts `--input-schema` (a JSON Schema), `--enforce-schema` to reject examples that do not match it, and `--from-file` to load the whole create payload from JSON.

### Examples

```bash
agentclash dataset example add <datasetId> \
  --external-id refund-001 \
  --input '{"question":"Can I get a refund?"}' \
  --expected '{"answer":"Yes, within 30 days"}' \
  --tag refunds
agentclash dataset example list <datasetId>
agentclash dataset example edit <datasetId> <exampleId> --status muted
agentclash dataset example rm <datasetId> <exampleId>   # archives the example
```

`--external-id` makes `example add` an idempotent upsert. `--source` accepts `manual`, `import`, `trace`, `synthetic`, or `promotion`. `example edit --status` accepts `active`, `archived`, or `muted`.

### Import and export

```bash
# Preview first, then import
agentclash dataset import <datasetId> ./examples.jsonl --format jsonl --dry-run
agentclash dataset import <datasetId> ./examples.jsonl --format jsonl --mode add

# Export a pinned version
agentclash dataset export <datasetId> --version <dataset-version-id> --format csv
```

`--format` is one of `openai`, `braintrust`, `langsmith`, `phoenix`, `jsonl`, or `csv`. `--mode` is `add` (default) or `replace`. For generic JSONL or CSV files, describe the columns with `--mapping '<json>'` or repeatable `--map key=value` entries (comma-separated values are allowed for `input_keys`, `output_keys`, and `metadata_keys`). `dataset export` defaults to `jsonl`.

### Versions

```bash
agentclash dataset version create <datasetId> --label "before prompt change"
agentclash dataset version list <datasetId>
```

`version create` snapshots the current examples. Use the resulting version ID with `dataset eval`, `dataset test`, and `dataset export`.

### Production traces

Import traces as reviewable candidates, then promote the good ones into examples.

```bash
agentclash dataset import-traces <datasetId> ./traces.json --source otel
agentclash dataset trace-candidates list <datasetId> --status pending
agentclash dataset promote <datasetId> <candidateId> --tag from-prod
```

`--source` is one of `otel`, `braintrust`, `langsmith`, `phoenix`, or `agentclash`. For `agentclash` traces pass `--run` and `--run-agent` instead of a file, or reference an existing artifact with `--artifact`. `--redaction` takes a JSON config that drops or hashes metadata keys. `trace-candidates list --status` filters by `pending`, `promoted`, or `rejected`. `promote` accepts `--expected` to replace the expected output with an edited JSON value.

## Record a baseline

A baseline snapshots the per-example outcomes of one completed, green eval run so later candidates can be compared against it. Record it with `agentclash dataset baseline create`. The command prints the baseline `id`. Give that ID to `agentclash dataset test --baseline <id>` to gate candidates against it.

```bash
agentclash dataset baseline create <datasetId> \
  --run <eval-run-id> \
  --label "support v1 baseline"

# List the baselines of the dataset, newest first
agentclash dataset baseline list <datasetId>
```

Each call adds a new baseline. The server does not replace an older one. A server-side dataset baseline is not the same as `agentclash baseline set`, which saves a local bookmark of a run in your CLI config.

The API form is `POST /v1/workspaces/{workspaceID}/datasets/{datasetID}/baselines` with the eval `run_id` and an optional `label`.

## Baselines and regression suites

Syncing a pinned dataset version into a regression suite copies each example's provenance — its dataset-example ID and trace metadata — into the workspace regression suite, so manifest-based release gates can reference the same curated examples. (Under the hood these land in the `workspace_regression_cases` table keyed by `dataset_example_id`.)

```bash
agentclash dataset sync-regression-suite <datasetId> \
  --version <dataset-version-id> \
  --pack <challenge-pack-version-id> \
  --challenge support \
  --suite-name "Support dataset regression"
```

Re-running sync is idempotent: cases that already exist for an example are skipped, so you can safely re-sync after adding new examples.

## CI gate output formats

`agentclash dataset test` supports human text, JSON gate payloads, and JUnit XML for CI parsers. Use `--max-regressions 0` to fail on any newly failing example versus the baseline.

> Info: Dataset gates are complementary to [CI/CD agent gates](https://www.agentclash.dev/md/docs/guides/ci-cd-agent-gates) and [eval workflows](https://www.agentclash.dev/md/docs/challenge-packs/eval-workflows-and-gates). Use datasets when examples are curated and pinned; use eval scorecards when you are comparing agent revisions on a live pack.

## See also

- [Synthetic dataset generation](https://www.agentclash.dev/md/docs/guides/synthetic-dataset-generation) — Fast Self-Instruct and Agentic Self-Instruct in workspaces
- [Dataset CI Gates](https://www.agentclash.dev/md/docs/guides/dataset-ci-gates) — GitHub Actions recipe and API surface
- [CI/CD workload recipes](https://www.agentclash.dev/md/docs/guides/ci-cd-workload-recipes) — pick realistic agent workloads
- [Interpret results](https://www.agentclash.dev/md/docs/guides/interpret-results) — read scorecards and timelines