Evals
The eval platform measures how a change to the harness affects agent outcomes. It covers a prompt, a launch key, a tool, or a whole revision. Each run records, per trial:
- whether the task’s verifier passed;
- the tokens used and an estimated cost;
- the agent and trial wall time;
- the model.
Runs go into a SQLite database that operators can read without root. It is opt-in, Linux-only, and runs Harbor tasks under rootless Podman through an approval-gated declared operation.
The Harness² loop names the surrounding improvement method Propose → Probe → Compose → Select → Reflect. This eval platform is its existing Harbor-based Probe engine; the terminology does not introduce another runner or automatic promotion path.
Enabling it
services.cowboy.pubsub.runas.enable = true; # the approval-gated operations
services.cowboy.evals = {
agents = [ "cb" ]; # may stage inputs and request `eval`
readers = [ "alice" ]; # may read results; eval agents always can
};
This generates:
- the
evaloperation, which runs as thecowboy-evalsystem account; - the database directory
/var/lib/cowboy-eval; - the inbox
/var/lib/cowboy-eval-inbox, bind-mounted writable into each eval agent; - the
cowboy-evalcommand on every user’s PATH. - a host firewall rule for the
cowboy-evalaccount: task containers may reach the public internet (benchmarks such as Terminal-Bench install packages), but not private, link-local or loopback addresses, except the resolver and the credential proxy. It needsnetworking.firewallornetworking.nftablesenabled.
Nothing is generated while agents is empty. timeout (default 6 hours),
memoryMax, tasksMax and cpuQuota bound a single run.
Experiments
An experiment is a directory: experiment.json plus Harbor tasks and any files the
arms install. For example:
{
"schema_version": 2,
"name": "terse-prompt",
"hypothesis": "A terse system prompt does not lower task success.",
"harness_loop": {
"cycle": "terse-prompt-1",
"stage": "probe",
"baseline_arm": "shipped",
"candidate_arms": ["terse"]
},
"arms": {
"shipped": {},
"terse": { "files": { "prompt.md": "terse.md" } }
},
"suite": { "tasks": "tasks", "images": ["python:3.12-slim@sha256:…"] },
"design": { "tasks": ["01-fix", "02-refactor"], "replicates_per_task": 5,
"randomization_seed": 7, "pairing": "paired", "agent_timeout_sec": 300 },
"budget": { "max_trials": 20, "max_usd": 2 },
"primary_outcome": "Harbor verifier reward == 1"
}
An arm may set:
launch: string launch keys;files: agent config files, as destination → path in the experiment;expect_stderr: lines that must appear inmontana.log, which proves the arm took effect;modelorprovider: a per-arm override. The runner reaches a provider only through the credential proxy, so an arm may name onlyopenrouterorvercel;revision: the arm runs another build, described below.
Every trial launches with oneshot_nudges=3: a reply that ends the turn
without a tool call or TASK COMPLETE is answered with a request to continue,
up to three times, because nobody else will answer it. An arm may set its own
value, 0 included. Keys the controller owns are refused. These include the provider, the model, credentials, sockets and paths.
design.agent_timeout_sec sets one runner budget for every task. If it is
omitted, or set to "task", each task gets its own task.toml agent timeout
minus 30 seconds, which a benchmark with mixed timeouts needs. Either way, the
Harbor agent timeout must leave 30 seconds for setup and collection. The agent
works in the task’s last Dockerfile WORKDIR, or design.workspace, or /app.
The schedule is deterministic. Each replicate shuffles the tasks and each
block (one task and replicate) shuffles the arms, from the seed. A payload runs
a slice of the schedule, so a large experiment can be run and paid for in
parts. A slice must hold whole blocks, because a block’s arms are compared only
with each other: with two arms it starts at an odd sequence number and holds an
even number of trials. payload --dir and the runner refuse a slice that
splits a block. cowboy-eval schedule DIR [--start N --limit N] prints the
schedule, or a slice of it, as CSV with its sequence numbers. cowboy-eval analyze pools the parts (see
Reading results).
cowboy-eval validate DIR checks a definition and prints its digest and the
arm table that goes on the approval card. An experiment does not have to be on
main. cowboy-eval pack REF PATH archives it into the inbox from any git ref,
and the run records the commit and tree it came from.
Comparing revisions
An arm with no revision runs the deployed build. To compare builds, pack the
other revision’s runtime closure:
cowboy-eval pack-arm github:you/cowboy/<commit> > b.json
This builds <commit>#harbor-runtime-closure. The closure contains Montana, the lite
component and a minimal Python. For revisions that predate that output, the
current tree packs the old revision’s Montana and component. The binding goes
into the payload as --arm NAME=b.json.
The approver sees the closure’s hash. The claim that it was built from
<commit> is only attested, not verified. The closure runs only inside the task
container; the controller, the Harbor adapter and the trigger are always the
deployed build. A commit that crashes at launch counts as a failure of its arm,
not as infrastructure.
Running
cowboy-eval pack HEAD evals/experiments/terse-prompt > exp.json
cowboy-eval payload --experiment exp.json --model z-ai/glm-5.3-flash \
--price z-ai/glm-5.3-flash=0.07,0.01,0.4 --limit 20 --max-usd 2 \
--dir evals/experiments/terse-prompt > payload.json
The provider is OpenRouter unless payload --provider vercel selects the
Vercel AI Gateway, whose model ids look like zai/glm-5.2. Either way the
credential proxy injects the key, and a run’s relay admits only its provider.
--price MODEL=IN,CACHE_READ,OUT gives USD per million fresh input,
cache-read and output tokens. A fourth value, CACHE_WRITE, prices cache
writes; input counts include cache reads and writes, so each is priced once.
A model that reports no cache writes needs only the three. If a trial reports
cache writes and its model has no cache-write price, the trial has no cost
estimate and the run aborts, starting no more trials, rather than price the
writes at zero.
pack and pack-arm write into the inbox. To add an archive built some other way, use
cowboy-eval stage FILE. It names the file by its hash and makes it readable to the
runner (mode 0440). A plain cp usually leaves a file mode 0600, and the runner refuses it.
payload prints the canonical payload on stdout and the approval card on
stderr. The agent submits the payload with runas-request, using operation eval. A
human approves that exact payload, budget included. The payload’s
max_trials and max_usd may not exceed the experiment’s budget, which
bounds any one run; payload --dir and the runner both refuse one that does.
The runner does not add up what several runs of an experiment spend. The
runner then does the following:
- It copies each named archive out of the inbox and checks its hash.
- It pre-pulls the pinned images.
- It runs each scheduled trial in a fresh Harbor environment. A trial that runs past its task’s timeouts plus a margin is stopped, then killed a minute later, and any container it left is removed.
- It records every attempt, including failures, with the stage where it stopped.
The runner stops before a trial the estimate says would pass max_usd. It
aborts after three consecutive infrastructure failures, meaning environment or
agent setup, unless the experiment freezes a different list. A trial with no
Harbor result, or whose trigger or artifact collection fails in the runner, is
an infrastructure failure at stage controller. A run that has already
stopped starting trials, because it was drained or reached its budget or time
limit, keeps that reason even if the trials still running then fail this way.
A run the runner itself cannot finish is recorded as failed, not left
running.
Concurrent trials
By default trials run one at a time. payload --concurrency N asks for up to
N at once, and the card shows it. The runner uses the least of that, the
experiment’s optional design.max_concurrency and the host’s
services.cowboy.evals.maxConcurrency (unlimited by default). The first trial
always starts. Each further one starts only if both of these hold:
- its task’s memory fits
memoryMax, less 1 GiB, beside the trials already running; - the host has memory available for it and for the trials already running, plus 2 GiB, and memory pressure is under 10%. A running trial’s memory is counted in full because a trial just started has not claimed any yet.
Otherwise it waits for a trial to finish. The budget forecast counts the trials still running. Attempts are recorded as trials finish.
While a run is going, any reader can lower its limit or drain it:
cowboy-eval throttle 3f1c 2 # at most 2 trials at once from now on
cowboy-eval drain 3f1c # start no more; running trials finish
Each reader’s command replaces that reader’s own earlier limit. The runner
takes the lowest limit any reader has set and never goes above the approved
one. A drained run ends stopped (drained).
The reply on the approval channel summarises the run:
eval terse-prompt 3f1c…: completed, 20/20 trials
shipped: 8/10 pass, 4.1k in/0.3k out, $0.0004 per trial, $0.0005 per pass, agent 38s med
terse: 7/9 pass (not scored: 1 infra), 3.6k in/0.3k out, $0.0004 per trial, $0.0005 per pass, agent 35s med
paired shipped/terse: 2 shipped-only / 1 terse-only of 9 pairs (not scored: 1 infra), sign p=1.000, cost shipped-terse $+0.0000/trial
estimated $0.0079 (advisory budget); key usage +$0.0081 incl. concurrent use
full report: cowboy-eval report 3f1c…
What a score leaves out
An arm’s score is its passes over its valid attempts. Model errors, timeouts
and a revision that crashes at launch are valid attempts that failed. The
runner never runs a trial twice, so four kinds of scheduled trial are left
out of the denominator. The reply and cowboy-eval report count each kind
beside the score:
infra: attempts that failed as infrastructure, at a stage the experiment’sexclusions.infrastructure_stagesnames (environment or agent setup by default) or at stagecontroller;interrupted: trials in flight when the run was stopped (see Rebuilding the host stops runs), left out like infrastructure failures;skipped for time: trials the run’s time limit left out;not started: trials that never started because the run reached its budget, was drained or was aborted.
The paired analysis drops a whole block when either of its arms failed as
infrastructure (infra) and counts a block missing an arm as incomplete.
To run such blocks again, approve a payload whose slice holds them, then pool
the runs with cowboy-eval analyze. Tasks that payload --exclude leaves out
are different: the approver removes them before the run, the card lists them,
and they are never scheduled, so none of these counts includes them.
Rebuilding the host stops runs
Each run executes in an instance of the eval operation’s runas unit, whose
name carries a digest of its configuration. Rebuilding and switching the host
(nixos-rebuild switch, or anything that runs switch-to-configuration)
stops that instance whenever the unit changed, and any change to the deployed
Cowboy changes it. Nothing holds a rebuild back for a run, so check
cowboy-eval runs before switching.
A stopped run is not resumed. The trials in flight are lost, together with what they had already spent at the provider. On the unit’s SIGTERM the controller records what it can before systemd kills what is left:
- the run ends with status
interrupted, stop reasoninterrupted (service stopped), and afinished_at; - each trial in flight is recorded at stage
interruptedwith that cause, classified as infrastructure. It is counted asinterrupted, apart frominfra, and like an infrastructure failure it is left out of the score and invalidates its block, which a later run can replace; - trials that had already finished stay recorded as they were.
If the controller was killed before it could record anything, the run is left
running. The next run ends it as interrupted before it starts: it holds the
host’s one-run lock, so any other run still marked running has no controller.
A controller records its process and boot id, so a run whose process is still
alive is never touched. To end such runs without waiting for another run, run
sudo -u cowboy-eval cowboy-eval reconcile on the host (--dry-run shows
what it would change). It marks a run only when its recorded process is gone,
or, for a run recorded before controllers were, when systemd reports its unit
inactive.
To run the remainder, approve a payload with the same slice, or a slice that
holds the blocks the stopped run did not finish. Use payload --exclude to
leave out tasks the stopped run already completed validly in every block,
since each trial spends money again. Then pool the runs with
cowboy-eval analyze: a block that was interrupted counts from the later run,
and a block that ran validly keeps its first result (see
Reading results).
Terminal-Bench 2.1
The flake builds Terminal-Bench 2.1 as an experiment: the dataset version
published on Harbor Hub (terminal-bench/terminal-bench-2-1), downloaded at a
pinned version and checked against a fixed hash. No git commit of the task
repositories matches that version exactly. The experiment has 89 tasks, with
reference solutions removed and each task image pinned by digest. It has one
arm, the deployed build, and is scored as a benchmark rather than a
comparison. Pack the directory and run it in slices:
cowboy-eval pack-dir $(nix build --print-out-paths github:you/cowboy/<commit>#terminal-bench-2-1) > tb.json
cowboy-eval payload --experiment tb.json --model … --price … --start 1 --limit 20 --concurrency 4 > payload.json
Tasks use their own images and the public internet. Their agent timeouts range
from 10 minutes to over 3 hours. The runner starts the slice’s longest trials
first, and skips any trial whose timeouts could run past the run’s timeout;
the rest still run, and the run ends stopped, naming the skipped tasks.
payload --exclude <task> (repeatable, shown on the card) leaves tasks out of
a slice, for example build-pov-ray and sam-cell-seg, which each hold a slot
for hours. It refuses a slice with any task that asks for more memory than
memoryMax less 1 GiB. The full set needs memoryMax = "9G", and a timeout
of at least 26100 for build-pov-ray. The images total about 20 GB compressed;
set services.cowboy.evals.keepImages to keep them between runs.
Published scores, such as tbench.ai and Artificial Analysis, run this dataset with other harnesses and sandboxes, and usually average 3 trials per task. A score here measures Cowboy with the run’s model on this host, so treat a published score for the same model as a reference point, not a like-for-like comparison.
Reading results
cowboy-eval runs
cowboy-eval report 3f1c # per-arm and per-trial tables
cowboy-eval report 3f1c --json
cowboy-eval analyze 3f1c 9e02 51ab # one analysis over several runs
cowboy-eval sql 'SELECT arm, avg(success), sum(cost_estimate_usd) FROM attempts GROUP BY arm'
analyze pools runs of one experiment definition, such as the slices of a
large one, and prints the per-arm summaries and paired analysis as JSON. With
more than two arms in a paired design, the paired analysis runs for every arm
pair, in definition order, under pairwise; with two, that one comparison is
also paired. Beside success, each arm reports estimated cost per trial and
per pass (everything its valid attempts spent over its passes), and cache-read
tokens, cache-write tokens and responses per trial. Each comparison reports the
macro per-pair cost difference, with a task-stratified bootstrap CI over the
pairs both arms priced, and each arm’s cost per pass over those pairs. It
refuses runs of different definitions, or where an arm used a different
provider or model; builds_per_arm shows whether an arm’s build changed
between runs. Each block counts once, from the oldest run in which every arm
ran and none failed as infrastructure. A block no run completed that way
counts from the oldest run that holds it. So a block that failed as
infrastructure and was run again in a later payload counts from the later run.
A block that ran validly is never replaced, whatever a later run of it scored.
The database opens read-only for readers. Each trial’s Harbor artifacts
(result.json, montana.log, frames.ndjson) are stored by hash under
/var/lib/cowboy-eval/blobs, and artifacts maps them to attempts. Up to
200 files of at most 64 MiB each are kept per trial. Once a run is recorded,
or refused, the runner deletes its working tree under the cowboy-eval
account’s runs/ directory, which holds copies of its archives and Harbor’s
job directories. A run the runner itself could not finish keeps its tree for
diagnosis.
Limits
- The budget is advisory (
specs/THREAT-MODEL.mdN-18). It is estimated from the usage the harness reports inside the task container. The key-usage delta is recorded as a cross-check, not enforced. Trials already running when the budget is reached still finish, so a run can end past it; its stop reason then gives the estimate that exceeded the budget. - One run holds the proxy relay at a time; a run’s own trials may overlap.
- The runner has host network access so it can reach the credential proxy.
Each task container still gets its own network mode. The pinned local tasks
use
no-network, with the provider reachable only through a relay socket. A task with network, such as every Terminal-Bench task, can also reach the credential proxy directly and use every credential route it has on the host (specs/THREAT-MODEL.md). - Readers see everything recorded, including trajectories.