> ## Documentation Index
> Fetch the complete documentation index at: https://docs.harborframework.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Separate verifier

> Run verification in a separate environment.

By default, the verifier runs in the same container as the agent. The `tests/` folder is uploaded to `/tests/` at the start of the verifier phase.

However, you can opt for running the verifier in a separate container, which is useful for isolated grading. This can improve the security boundary between the agent and the verifier and allow you to pre-install dependencies into the verifier image and build it ahead of time, which can reduce installation flakiness and speed up the verifier phase. It also enables [trial regrading](/jobs/regrade).

## Opt in

There are two ways to opt in to a separate verifier environment:

1. Set `environment_mode = "separate"` under `[verifier]` in `task.toml`.
2. Add `[verifier.environment]` to `task.toml`.

### Option 1: Reuse the agent's environment configuration

Set `environment_mode = "separate"` under `[verifier]`:

```toml theme={"system"}
[environment]
docker_image = "some/image:latest"
cpus = 2
memory_mb = 1024

[verifier]
environment_mode = "separate"
```

Without a verifier-specific image or build definition, Harbor starts a fresh copy of the agent environment and uploads `tests/` to `/tests/`. The agent's filesystem changes are not inherited.

### Option 2: Use a verifier-specific environment

Add `[verifier.environment]` to use a different image or resources. This implicitly enables separate mode:

```toml theme={"system"}
[verifier.environment]
docker_image = "my-org/grading-image:latest"
cpus = 2
memory_mb = 1024
```

This uses the same schema as `[environment]`, including [network policy](/tasks/network-policies). It cannot be combined with `environment_mode = "shared"`.

### Mode resolution

| `environment_mode` | `[verifier.environment]` | Result |
| - | - | - |
| omitted | omitted | `"shared"` |
| omitted | present | `"separate"` |
| `"shared"` | omitted | `"shared"` |
| `"shared"` | present | **validation error** |
| `"separate"` | omitted | `"separate"` (copy of top-level `[environment]`) |
| `"separate"` | present | `"separate"` (verifier-specific env) |

## Image selection

Harbor selects the first available definition:

| Priority | Definition | Tests |
| - | - | - |
| 1 | `[verifier.environment].docker_image` | Must be baked into the image. |
| 2 | `tests/Dockerfile` (or `tests/docker-compose.yaml`) | Must be baked into the image. |
| 3 | `[environment].docker_image` | Uploaded from `tests/` to `/tests/`. |
| 4 | `environment/Dockerfile` (or `environment/docker-compose.yaml`) | Uploaded from `tests/` to `/tests/`. |

Resource settings come from `[verifier.environment]` when provided, otherwise `[environment]`. An inherited agent image never overrides a verifier build definition.

### Dedicated verifier image

Dedicated verifier images must provide `/tests/test.sh` (or `/tests/test.bat` on Windows). Harbor does not upload tests into these images at runtime.

```bash theme={"system"}
my-task/
├── task.toml
├── instruction.md
├── environment/
│   └── Dockerfile        # agent environment
└── tests/
    ├── Dockerfile        # verifier image
    ├── test.sh
    └── grader.py
```

For example, `tests/Dockerfile` can bundle the grading files:

```dockerfile theme={"system"}
FROM python:3.12-slim
COPY . /tests/
```

## Artifact transfer

When a separate verifier runs, Harbor copies into the verifier env:

* `/logs/artifacts/` (agent publish directory)
* Paths listed in task-, trial-, and step-level `artifacts` fields

Artifacts are uploaded to their original `source` paths in the verifier environment, not their host `destination` paths. For example, `{ source = "/app/report.json", destination = "report.json" }` is restored to `/app/report.json` in the verifier; `destination` only controls where it is saved on the host. See [Artifacts](/tasks/artifacts).

`/logs/agent/` and `/logs/verifier/` are not copied unless declared as artifacts — e.g. trajectory grading:

```toml theme={"system"}
artifacts = ["/logs/agent/trajectory.json"]
```

## Multi-step tasks

Each step can override verifier mode under `[steps.verifier]`. Mixed shared/separate per step is supported:

```toml theme={"system"}
[[steps]]
name = "build"
# Inherits trial-level mode (shared by default).

[[steps]]
name = "grade"
[steps.verifier.environment]
docker_image = "my-org/grading-image:latest"
```

Resolution: `[steps.verifier].environment_mode` when set; else `[steps.verifier.environment]` present implies `"separate"`; else trial-level. Network rules: [Network policies](/tasks/network-policies).

Image precedence is step image, step tests build definition, task verifier image, task tests build definition, then agent environment. A step `tests/` directory without a build definition does not override a task verifier image. With the agent-environment fallback, Harbor uploads base tests, then overlays step tests.

Tests are validated against each step's **effective** verifier OS, so a Linux agent can be graded on Windows (and vice versa) when the matching `test.sh` / `test.bat` exists.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.