Source: https://hatchery.build/docs/tasks-and-datasets

# Tasks and datasets

Hatchery saves each pushed version of a task as an immutable revision. A dataset pins exact task revisions so you can run the same benchmark again.

First [connect the CLI](quickstart.md#connect-the-cli). The quickstart stores the selected project in `hello/hatchery.json`. The commands below run from the directory containing `hello`, outside that configuration's scope. Set `HATCHERY_PROJECT` to its `project` value:

```sh
export HATCHERY_PROJECT=your-project-id
```

## Build a task package

A task package keeps one evaluation's instructions, container environment, reference solution, and verifier in one directory.

```text
hello/
├── task.toml
├── instruction.md
├── environment/
│   └── Dockerfile
├── solution/
│   └── solve.sh
└── tests/
    └── test.sh
```

`task.toml` holds task and runtime settings. `instruction.md` gives the agent its assignment. `environment` defines the container. The `oracle` agent runs `solution/solve.sh` to produce the expected outcome. The script under `tests` checks the outcome and writes the reward.

You can create this layout from the built-in template and immediately run the reference solution:

```sh
hatchery init hello
hatchery run --path hello --agent oracle \
  --python /path/to/compatible/python --output results
```

Before you share or upload the task, give it a stable package name in `task.toml`:

```toml
[task]
name = "clavia/hello"
```

Package names use the form `organization/name`. If you leave out the name, the CLI derives one from the project and directory and tells you which name it chose when you push.

## Push a task revision

After the oracle run passes, push the package into your project:

```sh
hatchery push hello
```

The command prints the task id, revision number, and content digest. The id stays with the task across revisions. A later push of changed package files creates the next revision. A push with identical bytes reports `unchanged` and reuses the existing revision.

Use the printed task id whenever you want to run that exact stored revision:

```sh
hatchery run --task TASK_ID --revision 1 --agent oracle \
  --python /path/to/compatible/python --output results
hatchery run --task TASK_ID --revision 1 --agent oracle --remote
```

The first command downloads the revision and runs it locally. The second runs the same revision on Hatchery and continues if your computer disconnects.

## Pull tasks

Pull every task's latest revision into a new working directory:

```sh
mkdir my-benchmark
cd my-benchmark
hatchery pull --project your-project-id
```

The command creates a root `hatchery.json` when one is absent and preserves a matching configuration. It places each task under its full package name. A task named `clavia/hello` lands at `clavia/hello`, so you can edit and push it using the ancestor project configuration:

```sh
cd clavia/hello
hatchery push .
```

Select one task by canonical package name or task id. A unique short name also works. `--revision` is available only for a selected task and defaults to `latest`:

```sh
hatchery pull clavia/hello --revision 2 \
  --project your-project-id --output revision-2
```

Pull downloads task source packages. It does not copy jobs, results, secrets, or datasets. It also refuses an existing task destination, with no merge, overwrite, or force mode. Choose an empty output directory, or pass `--output another-directory`.

## Build a dataset

A dataset groups task revisions into one benchmark. Create two complete task packages inside a `tasks` directory:

```sh
hatchery init tasks/hello
hatchery init tasks/goodbye
```

Keep each task directly inside the dataset directory so the CLI can discover it. Each child is a complete task package. This shortened tree shows their configuration files:

```text
tasks/
├── dataset.toml
├── hello/
│   └── task.toml
└── goodbye/
    └── task.toml
```

Add `dataset.toml` at the root and give the dataset its own stable package name:

```toml
[dataset]
name = "clavia/hello-suite"
```

Push the dataset directory:

```sh
hatchery push tasks
```

The CLI uploads each child task, then creates a dataset revision containing every task's exact id, revision, and digest. It prints one line per task and a final dataset line. Copy the dataset id from the final line.

Run the pinned set locally or hosted:

```sh
hatchery run --dataset DATASET_ID --revision 1 \
  --agent oracle --python /path/to/compatible/python --output results
hatchery run --dataset DATASET_ID --revision 1 \
  --agent oracle --remote
```

An existing dataset revision retains its original task selection. Push the dataset again after updating a task to create a dataset revision that pins the update.

Add dataset-wide assessment with [Checks](checks.md).
