Run Harbor tasks
A Harbor task is a directory with task.toml, instruction.md, an
environment/ the agent works in, and tests/ holding the verifier that
writes a reward. Start every case in Vitest evals; write a
Harbor task only when the case needs its own container (system packages, the
workspace, the sandbox, services, an isolated verifier) or must run on a pushed
commit or deployed version. A case has one implementation, on one runner.
You need: a deployed runtime and an owner or admin login for platform runs, the default, or Docker for local runs. CLI 0.85.0 or later for a task’s input files.
1. Install the adapter
introspection setup --target harbor2. Write the verifier
The verifier is RewardKit : each
folder in tests/ is one named score, either Python checks or a model judge,
and tests/reward.toml combines them into reward.
evals/refund-task/tests/
test.sh
reward.toml
refund_issued/check.py # deterministic check
reply/judge.toml # model-graded criteria#!/bin/bash
mkdir -p /logs/verifier
uvx --from 'harbor-rewardkit==0.1.*' --with 'introspection-harbor>=0.10.0' \
rewardkit /tests --workspace /opt/introspection/recipefrom pathlib import Path
from rewardkit import criterion
from introspection_harbor.verifier import load_trajectory, tool_calls
CALLS = tool_calls(load_trajectory())
@criterion(description="A refund was issued for order A-1042")
def refund_issued(workspace: Path) -> bool:
return any(
call["name"] == "issue_refund"
and call["arguments"].get("order_id") == "A-1042"
and not call["is_error"]
for call in CALLS
)[judge]
judge = "anthropic/claude-sonnet-4-6"
atif-trajectory = "/logs/agent/trajectory.json"
[[criterion]]
name = "confirms_refund"
description = "The final reply tells the customer that the refund for order A-1042 was issued."
[scoring]
aggregation = "all_pass"[[reward]]
name = "reward"
aggregation = "all_pass"reward is the case score; every other key is a named score. A multi-step
task puts each step’s instruction, tests/ and solution/ under
steps/<name>/ and lists the steps in task.toml:
multi_step_reward_strategy = "mean" # or "final": the last step's scores
[[steps]]
name = "request"
min_reward = 1.0 # skip later steps unless reward reaches 1
[[steps]]
name = "approve"Each trial’s verifier/ directory (per step, steps/<name>/verifier/) holds
reward.json, the scores Harbor records, and reward-details.json, which
gives each criterion’s value and the judge’s reasoning. Read the second to
see why a score is low.
3. Give the agent input files
A file the agent reads, as a user’s upload, goes in the task’s
environment/files/<name>. The folder is flat. On every trial path, local
Docker, E2B or a platform trial, the agent finds each file at
/workspace/files/<name>.
evals/sow-review/
task.toml
instruction.md
environment/
files/
sow.pdf # the agent sees /workspace/files/sow.pdf
tests/instruction.md holds the turn as production stored it: the user’s text,
then the block that announces the files uploaded on that turn. A task you
write by hand writes the block itself:
Review the attached statement of work.
<files>
<file path="/workspace/files/sow.pdf" />
</files>A task from a later turn of a conversation ships the turns before its own as
an ATIF trajectory.json beside instruction.md
(steps/<first>/trajectory.json in a multi-step task), which Harbor loads
into the agent’s conversation through the adapter’s load() before the
instruction (CLI 0.90.0 or later).
Production announces an upload once, on the turn it arrives. A file from an
earlier turn is announced in that turn’s user step of the task’s
trajectory.json, and the agent has it from the start. In a
multi-step task, it is announced in the instruction.md of the step it
arrives on and is placed right before the first step that announces it.
Setup compares environment/files/ with all the <files> blocks together:
those in instruction.md, in each step’s instruction.md and in the user
steps of the trajectory the task loads. When they disagree, the trial fails
before the agent starts, naming each file that only one side lists, and
introspection eval run exits non-zero. Fix the side that is wrong.
introspection eval add --from-conversation <id> --turn <n> --runner harbor
writes the files and the blocks for you: it copies the uploads the turn and
the turns before it announced into environment/files/, keeps each turn’s
<files> block, and records each file’s name and sha256 under inputs
in the case file. A file the Files API no longer serves, or one the runtime
marked unavailable, fails eval add, naming it, and nothing is written.
4. Run on Introspection
Trials run in your runtime’s sandbox, against a commit you pushed. Commit and push first; the working tree is never evaluated.
git push
introspection eval run --runner harbor -p evals/refund-task \
--runtime support-agent --commit-sha <full-commit-sha> --trials 3git rev-parse HEAD prints the full SHA. -p is relative to the recipe.
Without --commit-sha, introspection eval run --runner harbor -p evals/refund-task runs on Introspection too, on your pushed HEAD: the CLI
refuses a dirty working tree or a commit on no remote branch. Each step runs on
the native Harbor adapter, which needs no environment setting (CLI 0.91.0 or
later). The output
names the Harbor adapter and environment, and run.json records them as
candidate.harbor.
Each trial uses the runtime’s image with the recipe replaced by your commit. Platform trials share an evaluation lane, one
at a time by default, apart from production tasks (Limits).
An owner or admin login can create trials; a member login can’t. A project API
key alone can’t start this run: --commit-sha resolves the runtime and
repository through your introspection login.
5. Or run locally
INTROSPECTION_HARBOR_ADAPTER=runtime introspection eval run --runner harbor -p evals/refund-taskA local run uses the runtime adapter, which runs the recipe’s Pi inside the
trial: set INTROSPECTION_HARBOR_ADAPTER=runtime (or --harbor-adapter runtime), or name the environment with --harbor-environment introspection_harbor.docker_environment:IntrospectionDockerEnvironment, which
selects runtime by itself. Local runs need CLI 0.85.1 or later. Each trial runs in local Docker on the
image your task names for main (its environment/Dockerfile), or else on the
runtime image, introspection-runtime-agent:latest, which you build on your
machine because runtime images aren’t published. Before the agent starts, the
recipe is installed at /opt/introspection/recipe from its pnpm-lock.yaml,
so commit the lockfile.
A task’s own image needs the Introspection toolchain. Start from the runtime image, or install it on Node 24:
FROM node:24-slim
RUN npm i -g @introspection-ai/cli@0.85.1 && introspection setup --yes6. Read and compare results
introspection eval view
introspection eval compare <run-a> <run-b>
introspection eval baseline promote <run-id> # writes baseline.json in the suite directoryCI checks that the committed baseline still matches the suite
(introspection eval baseline check, no login or Docker needed). Recording a
baseline and comparing runs need a platform run, so CI cannot run the
regression gate for Harbor. Multi-step tasks compare per step.
Keep a baseline
Record the baseline on Introspection against a pushed commit. A local run of
the same commit compares with it, but the images can differ, so check a case
that differs only between the two for that first. When a pull request changes a task, run its pushed commit, promote that
run, and commit baseline.json in the same pull request. A task’s fingerprint
covers only its own directory, so a change to a sidecar’s build context such as
fakes/, the runtime image, or the verifier package versions leaves the check
passing: promote a new baseline yourself and say so in the pull request.
Verify
introspection eval run ... --agent harbor:oracle scores 1 on every task: the
verifier accepts a correct solution. Then run your recipe agent.
Run options
| Flag | Effect |
|---|---|
--harbor-adapter native|runtime | native, the default, runs each step on Introspection; runtime runs the recipe’s Pi in the trial, as a local run does. Also INTROSPECTION_HARBOR_ADAPTER. CLI 0.91.0 or later. |
--agent <name> | Run a recipe agent variant. harbor:oracle runs the task’s solution/; harbor:nop sends nothing. Use them to test the verifier. |
--trials N | N separate runs, each with its own run.json |
--retry-errors N | Rerun trials that failed on infrastructure (no model response, expired login, sandbox never ready), up to N times. Agent failures and low scores are never rerun. |
Check MCP fakes in a verifier
A task can serve your MCP fakes as a sidecar on port 7353:
add a fakes service built from fakes/, whose image installs the committed
package-lock.json and runs eval-simulate serve, with EVAL_SIMULATE_SCENARIO set
to the task’s scenario. Bind each server to
http://fakes:7353/<server-id>/mcp in the Recipe’s committed
.pi/mcp.local.json, as Run them in Harbor
shows; task.toml names no MCP servers. Your API fakes’ hosts bind to the same
sidecar through a committed .pi/api.local.json, or from fakes/api/ when
none is committed (Bind API fakes). In the verifier,
introspection_harbor.verifier reads the trajectory (tool_calls, and
server_calls for one server’s calls under its own tool names) and
introspection_harbor.fakes reads each fake’s state (fake_state,
fake_initial_state) and checks it (load_manifests, state_changes,
write_attempts). With EVAL_SIMULATE_MANIFEST_DIR set, the sidecar also writes
each fake’s answers.json, which introspection_harbor.answers reads
(load_answers, read_result) to decode an answer as the fake’s contract
declares it. server_calls and introspection_harbor.answers need
introspection-harbor 0.11.0 or later.
Limits
| Not supported | Do this instead |
|---|---|
| Evaluating uncommitted changes on the platform | Push a branch and pass its SHA. |
--retry-errors with --from-conversation | Rerun failed trials separately. |
Or ask your agent: “Write a Harbor task for the refund flow and run it on support-agent against my pushed branch.”