Source: https://hatchery.build/docs/quickstart

# Quickstart

Follow the [Introduction](introduction.md) for definitions of tasks, agents, trials, and jobs.

The example runs a task locally, saves an immutable revision in Hatchery, and runs that revision in a hosted job. It needs no model key.

## Before you begin

Install Bun 1.4 or later and Git. Then install the CLI from npm:

```sh
npm install -g htchry
```

The package installs `hatchery` and the shorter `htchry` alias. The commands in this guide use `hatchery`.

Local `run`, `check`, and `regrade` commands also require Docker and a compatible Python environment containing the Hatchery Python bridge supplied by the Hatchery team. To run only on Hatchery, skip the local run below; you need neither Python nor Docker on your computer.

Confirm that the CLI is available:

```sh
hatchery --help
```

## Connect the CLI

Open [Hatchery](https://hatchery.build) and sign in. Your default project holds your team's tasks, jobs, and results. You can rename it in Studio.

The CLI login must select the WorkOS organization that owns the project. Ask your organization owner for its `org_...` id, then run:

```sh
hatchery login --organization org_...
hatchery projects list
```

The second command lists the projects in that account. Copy the default project id for the next command. The task template saves it locally, so commands inside the task directory select the same project.

## Make your first task

Create the example and select the project listed above:

```sh
hatchery init hello --project your-project-id
cd hello
```

The `hello` directory contains the complete task:

- `instruction.md` tells an agent to write `hello` to `/workspace/answer.txt`.
- `task.toml` describes the container environments used for the work and the score.
- `solution/solve.sh` is the reference solution. The `oracle` agent runs it.
- `tests/test.sh` is the verifier. It examines the agent's output and assigns a reward of 1 for the expected answer or 0 otherwise.

The generated `hatchery.json` contains only the selected project:

```json
{
  "project": "your-project-id"
}
```

Project commands use `--project`, then `HATCHERY_PROJECT`, then the nearest `hatchery.json` in the current directory or an ancestor. Commands inside `hello` select its project automatically. Initialization without `--project` writes `{}`; set its `project` or pass an override before using a project command.

## Run locally

Start Docker and run the task with the `oracle` agent, which executes the reference solution:

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

The runtime creates the environment, runs the reference solution, and asks the verifier to score the outcome. A successful command creates a result under `../results` with reward 1.

This complete run is a **job**. The example job contains one **trial**, meaning one agent attempt at the task. The **reward** is the verifier's score for that trial.

## Run on Hatchery

Add `--remote` to run the same task on Hatchery:

```sh
hatchery run --path . --remote --agent oracle
```

The command pushes the task as an immutable revision, submits it to the native Harbor driver on Daytona, and waits for the job to finish. The hosted job continues if your computer disconnects.

Use the printed job id to inspect the job and its trial:

```sh
hatchery jobs printed-job-id
hatchery trials printed-job-id
hatchery open printed-job-id --kind jobs
```

The final command prints a Studio link. The verifier assigns a **reward** to each measured outcome. **Coverage** is the share of planned trials that produced valid measurements. A job can have a high average reward and low coverage when some trials are missing or invalid.

## Continue

- [Tasks and datasets](tasks-and-datasets.md) explains package layout, stable names, revisions, and benchmark datasets.
- [Jobs](jobs.md) covers other agents, repeated trials, local and hosted runs, secrets, and evidence.
- [Checks](checks.md) adds dataset-wide lint, rubric, and custom checks.
- [Pages](pages.md) publishes selected benchmark results and task samples.
