← govind p lal
AI and ML Bootcamp · Lecture 30 · lecture notes

Writing Evals in the Harbor Framework

In short — How do you turn a coding task into a runnable, scored eval? This lecture walks through Harbor, a framework for writing and running evals in sandboxes. It covers the task folder layout, the Dockerfile, the instruction file, the tests and the reward file. It ends with the run commands and the three checks before you submit.

What Harbor is

builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026, Lecture 18: Week 17 - AI&ML | Harness, Context, and Evals | 09/05/2026

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.

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

builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026

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.

PartPurpose
environment/Code at the 'before' commit plus a Dockerfile (or docker-compose with Postgres/Redis if needed). Code lands in /app/repo
instruction.mdProblem statement given to the agent
solution/solve.shOptional. Writes the correct solution into the files
tests/test.shRuns 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

builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026
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 install

No 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

builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026

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.

!

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

builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026, Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026

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

builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026, Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026

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.

Start sandboxDocker by defaultAgent fixes repo/app/repoCopy tests to /testsRun test.shWrite reward0 to 1
What happens during a Harbor run.

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

adds to earlier · Worked formula and example weights for aggregating per-suite pass fractions in score.ts · builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026

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

builds on Lecture 17: Week 16 - AI&ML | Offline: RL Environments for LLMs | 08/05/2026, Lecture 18: Week 17 - AI&ML | Harness, Context, and Evals | 09/05/2026

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

adds to earlier · Concrete targets: at least 100 agent steps, pass rate in 0 to 0.6 across 5 rollouts, and the fix loop when too easy · builds on Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026, Lecture 29: Week 30 - AI | Writing Evals in Harbor Framework | 09/08/2026

Three checks before submitting

!

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.