Agent Trial Rig
For Claude Code, Codex, Cursor and GitHub Copilot

A/B trials of coding agents you can trust

Does a documentation layer, a code graph, a skill or a prompt change make an agent cheaper or more correct? Run the same questions across arms, agents and repetitions, measure what the agent actually did, and get a report that says how far to trust the result.

pip install git+https://github.com/meabs/AgentTrialRig
A trial runs as: trial file, fresh clone, agent runs, parse, score, report

One run tells you very little

Agent cost varies a lot from run to run, so a single comparison is mostly noise. This is a real trial: two repetitions of the same question, same agent, same repository, with the cheaper and dearer one up to 2.6 times apart.

Dot plot of tokens per run in a 16-run trial on Click, showing wide spread between repetitions
Each dot is one run from the trial shown below; the tick is the mean of the repetitions.

Measured, not reported

Tokens, cost and tool calls are read from the agent's own output. An agent cannot reliably tally its own actions, and self-reported metrics drift.

Fresh clone every run

Runs cannot influence each other. Arms differ only in what you add: a setup command, an overlay directory, a different clone, or words before or after the prompt.

Independent checks

Answers are scored against keys you write. For change tasks a verify command runs afterwards, so "tests pass" is checked, not claimed.

Real output

Everything below was produced by the tool on real repositories and real agent CLIs. Nothing is mocked up; long lines are trimmed with an ellipsis where noted.

The real examples/graph-vs-plain.toml from the repository: two arms (plain, and with a code graph installed), two agents, two questions with answer keys.

$ cat examples/graph-vs-plain.toml
name = "graph-vs-plain"
[defaults]
reps = 2
parallel = 4
timeout = 600
baseline = "plain"
prompt_suffix = "Answer briefly and say which tools or files you used."

[[repos]]
name = "click"
source = "https://github.com/pallets/click"

[[arms]]
name = "plain"

[[arms]]
name = "graph"
prepare = ["rm -rf $TRIAL_OUT/warm && mkdir -p $TRIAL_OUT/warm && cd $TRIAL_OUT/warm && git init -q && printf 'x = 1\\n' > a.py && git add . && python3 /path/to/AgentGraphWorkTree/.apm/skills/agent-graph/install.py --repo . --home $TRIAL_OUT/agent-graph-home >/dev/null 2>&1"]
setup = ["python3 /path/to/AgentGraphWorkTree/.apm/skills/agent-graph/install.py --repo . --home $TRIAL_OUT/agent-graph-home >/dev/null 2>&1"]
uses = "agent-knowledge/bin/kg"

[[agents]]
name = "claude"

[[agents]]
name = "codex"

[[questions]]
id = "inherit"
repo = "click"
prompt = "Which classes in src/click inherit from Parameter?"
expect = ["\\bOption\\b", "\\bArgument\\b"]

[[questions]]
id = "callers"
repo = "click"
prompt = "Which functions or methods call iter_params_for_processing? Ignore tests."
expect = ["parse_args"]

Statistics that admit what they cannot tell you

Costs differ between questions, so each run's tokens are divided by the baseline arm's mean for the same question and agent. A relative cost of 0.65 means 35% cheaper. The interval is a bootstrap over those values.

When the interval contains 1.00 the report says no clear difference. With fewer than 8 runs per arm it marks even a clear result provisional, because a bootstrap on so few runs is too optimistic. It also tells you how many runs you would need to detect a 20% difference given the spread it saw.

VerdictMeans
no clear differenceThe interval contains 1.00.
cheaper or dearerThe interval excludes 1.00.
(provisional)Fewer than 8 runs per arm.
too few runsFewer than 2 runs, so no interval.
Token totals are not comparable between agents: Claude Code reports cache reads and writes separately, while Codex and Copilot include cached input in their input count. Compare an agent only with itself.

Install and run

Needs Python 3.11 or newer and git, plus whichever agent CLIs you want to test. No other dependencies.

trialrig initWrite an example trial file.
trialrig runRun it; resumes if interrupted.
trialrig reportPrint the report again.
trialrig rescoreScore again after editing a key.
trialrig planRuns needed to detect a difference; with --results, per agent and question from a pilot, with the spend left.
trialrig snapshot, compare, regressSave what a trial did, then check whether a newer model, CLI or instruction file made the agent worse or dearer on the same tasks. Exit 1 on a regression.
trialrig run --stop-when-decidedOne repetition at a time; stops each agent and question once its verdict is clear or hopeless.
trialrig parseRead a saved agent output.
$ pip install git+https://github.com/meabs/AgentTrialRig
$ trialrig init trial.toml
$ trialrig run trial.toml --dry-run
$ trialrig run trial.toml
# change tasks: let the agent edit, then verify
[[agents]]
name = "codex"
edits = true

[[questions]]
verify = "bash verify.sh"