Writing Evals in the Harbor Framework
What Harbor is
Harbor - a framework to write, run and track evals for models and harnesses on coding tasks. Built by the Terminal-Bench team. Agents run inside a sandbox.
- Dashboards on top of runs
- Leaderboards on top of runs
- Datasets - group many evals together and publish them for others
- Aim: every benchmark and every company uses Harbor (a possible 'Docker Hub for evals')
The Problem 100 evals x 50 models x 70 harnesses is too much to run locally.
The Solution Harbor orchestrates eval runners across sandbox providers. Give it an E2B, Daytona, Docker or Kubernetes key. Default is local Docker.
Harbor works for coding tasks. It cannot judge visual output like front-end looks, so there is no objective test for that. LLM judges are the only option there.
Task folder layout and setup
Install: uv tool install harbor. Success means harbor is a command. Docker must be installed for local runs.
harbor init creates a task folder named org/name. Python bootstrapping is the default. For other languages (Bun, Rust) use the no-solution flag and add the pieces yourself. One folder per task, so 20 tasks means 20 folders.
| Part | Purpose |
|---|---|
| environment/ | Code at the 'before' commit plus a Dockerfile (or docker-compose with Postgres/Redis if needed). Code lands in /app/repo |
| instruction.md | Problem statement given to the agent |
| solution/solve.sh | Optional. Writes the correct solution into the files |
| tests/test.sh | Runs tests and writes the reward |
Real evals use an open-source repo, not your own code. You cannot write a codebase hard enough for models to fail. For an open-source repo you can git clone and reset --hard to a commit in the Dockerfile. The hard part is figuring out how to run its tests (setup can take hours).
Toy example: string-case functions
Example
Repo: a few exported functions (toUpperCase, toSnakeCase, toCamelCase, toKebabCase) with bugs left in. Problem statement: fix the bugs in these functions. No vagueness, function names stay. Models will solve this easily, but it shows the flow.
FROM oven/bun
WORKDIR /app
COPY repo /app/repo
WORKDIR /app/repo
RUN bun installNo server to start, so no CMD needed. Build with docker build to check the image works. (The base image name must be exact. A wrong name or wrong working directory breaks the build.)
Solution and the oracle run
solution/solve.sh - a shell script that writes the final solution into the repo files. Shell keeps Harbor language-agnostic. It does not know if the repo is Python, Node or Rust.
- Write the solution file, then
cpit over /app/repo/index.ts, or cat it into place - Run harbor with the solution (oracle) agent: it starts the container, runs solve.sh, runs test.sh, checks the reward
- No LLM is called
- Reward must be 1, otherwise your tests or solution are wrong
The solution folder is never visible to the agent during a real run. It is only a convenience check. Optional but good practice.
Instruction file
- Description - the problem, often the PR text
- Requirements - expected behavior, edge cases
- Interface - public APIs, function signatures, inputs, outputs, return types
Whatever the tests import or assert on must be written in the statement. The LLM may otherwise solve it with different variable or function names and fail the tests. Then the failure comes from ambiguity, not reasoning.
Real example: a Splitwise-like app where computeSplit only supports equal split. The task is to add other split types such as 70/30, with the interface spelled out.
Tests and the reward file
Flow in a real run: sandbox starts -> agent gets instruction.md -> agent edits /app/repo -> tests folder is copied to /tests -> test.sh runs -> writes reward.
- Harbor does not know how to run your project's tests. test.sh does.
- reward.txt in /logs/verifier takes one number: 0.5 for 50% pass, 1 for all
- Or write reward.json with custom metrics (passed/failed per suite, lines touched, tokens, time) for dashboards or training
The Problem Test runners print messy terminal output, not pass/fail counts.
The Solution
Ask for structured output. With Bun, bun test --reporter=junit --outfile=... gives XML. Parse it for total, passed, failed, skipped. Some runners (e.g. Rust) can output JSON. Writing this in shell is hard, so test.sh calls a score.ts script that does the parsing.
Weighted rewards
Each test suite has a weight w. Sum of weights is 1. Example: a simple persistence suite gets 0.1, a harder simplify suite gets 0.35. If a 0.35 suite passes 3 of 10, it adds 0.35 x 3/10.
Example: a feature adds user.test.ts (few tests) and feature.test.ts (20 tests). Give user 10% and feature 90%. Choosing weights needs judgment: which tests show real agent performance and which barely matter.
Running the eval and tracking it
- Pick the task path, agent (Claude Code, Codex, etc.), model and number of attempts, plus how many run in parallel
- Pass credentials as environment variables, e.g. an Anthropic API key
- Choose sandbox: Docker by default, or E2B or Daytona with their keys
harbor view jobsopens a dashboard of runs with status, reward, tokens and cost. You can start new runs from the UI- You cannot intervene during a run. You can only add limits like max tokens.
Harbor itself has the logic to install and run each supported agent in the container (likely via their SDKs). It does not open the agent's terminal UI.
To benchmark your own agent: extend Harbor's agent classes to integrate it, then run with the Terminal-Bench dataset, your model and your agent, and compare against the leaderboard.
Good task and pre-submission checks
- Hard for the top model: needs at least about 100 agent steps
- Pass rate between 0 and 0.6 over 5 rollouts
- Never 0% or 100% always. Sometimes 30%, sometimes 100%, averaging 40-50%
- Deterministic grading, no external APIs
- Fair: no ambiguity anywhere
- Realistic: a real repo, real issue, multi-file change, architectural behavior change, not a DSA puzzle
- Difficulty comes from reasoning about the codebase, not vague statements
Three checks before submitting
- Oracle run - run the solution. Reward must be 1
- Null run - no agent. Reward must be 0
- Five rollouts with a state-of-the-art model - pass rate must land between 0 and 60%
If rollouts score near 100%, go back to the problem and tests and make the task harder without adding ambiguity. Large, unfamiliar codebases (and less common languages than Python or TypeScript) make models fail more often.
Glossary
- Harbor
- Framework for writing and running evals of models and harnesses on coding tasks in sandboxes.
- Oracle run
- Running the reference solution instead of an agent; reward should be 1.
- Null run
- Running with no agent changes; reward should be 0.
- test.sh
- Script that runs the tests after the agent finishes and writes the reward.
- reward.txt
- File in /logs/verifier holding one number from 0 to 1.
- instruction.md
- Self-contained problem statement the agent receives.