Where Your Coding Agent Burns Its Budget: Choose the Harness per Model, Not per Habit

By Blob · November 18, 2026 · 7 min read

Most of the money you spend on a coding agent does not buy working code. It buys failure.

That is not a vibe. It is a measurement. Runta and Baseten just ran 27,280 coding-agent trials — 22 harness configurations, 5 open-weight models, 62 terminal tasks, 4 attempts each, 83 billion tokens in total — and counted where the money went. 64.5% of the estimated inference cost went to runs that did not pass: 52.7% to outright failures and 11.8% to timeouts. Roughly two dollars in every three bought a run that produced nothing you could ship.

If you run agents daily, that ratio is probably sitting in your own bill too. This post is about why it happens, how to measure your own version of it, and what to change before the next run — starting with the least obvious lever: the harness, and the fact that the right one changes every time the model does.

What was actually measured

The benchmark is FrontierHarness Eval v1.1, published by Runta with models served by Baseten. A "harness" is the wrapper around the model — Codex CLI, Claude Code, OpenCode, Pi and 18 other configurations — the part that decides what context gets sent, which tools are offered, and how the agent loops. The model was held fixed while the wrapper changed, and the wrapper alone moved cost per task by 1.8 to 5.0 times.

Two caveats before the numbers harden into folklore. First, the costs are estimates at list prices, not billed invoices. Second, Runta sells sandbox runtime infrastructure and the eval ran on its own runtime — the company flagged that conflict itself. Treat the study as a strong, unusually large signal about shape, not as gospel about any single harness.

With that said, the shape is hard to argue with:

Why a failed run costs more than a successful one

The mechanism is boring, which is why it is expensive. An agent is billed per turn, and every turn re-sends the whole context: the instructions, every tool description, and the entire task history so far. A run that goes well ends early. A run that goes wrong goes long — more turns, each one carrying a bigger context, each retry re-paying for everything that came before it.

And because the agent usually cannot tell it is failing, nothing stops the meter. There is no natural moment where the run says "this is not working" and quits. It patches, re-reads, re-runs, and eventually hands you a confident summary of work that does not pass. The failure is not a single wasted call. It is the longest, fattest run in your log.

A second measurement, from a different team, shows the same shape from the other side. The TokenEconomizer project — a cost controller from researchers at Microsoft Research and UC Berkeley — profiles real agent workloads and reports that on its project page, the 17% of tasks that fail take 32% of the spend. Do the arithmetic and a failing task costs roughly 2.3 times a succeeding one.

So your failure bill has two multipliers: how often runs fail, and how long each failure is allowed to run. Most cost advice attacks the model's price per token. The bigger lever is usually the failures themselves.

The harness is a per-model decision

Here is the part that should change a habit. These were the best-value harnesses — lowest cost per passed task — for each model:

ModelBest-value harness
GLM-5.3Codex CLI
GLM-5.3 FlashPi
DeepSeek V4.1 FlashZCode
MuseOh My Pi
Kimi-K3Alma

Five models, five different winners. And the swings are not gentle: Codex CLI was the cheapest harness per pass on GLM-5.3 at $0.803 — and ranked 16th of 22 on cost per task with Kimi-K3. The harness you tuned last quarter is not an asset. It is a pairing, and it expires when the model changes.

One more nuance, because it decides how to use this: Runta re-drew the task set 4,000 times to test how stable the winners were. Only Codex CLI on GLM-5.3 was a near-certain winner, holding first place in 99.6% of draws. The other four were the most likely of several close harnesses. A public benchmark gives you a shortlist. Your own tasks give you the verdict.

The metric that makes all of this visible is cost per passed task — total spend divided by runs that actually passed. Cost per run hides the failures inside a reassuring average. Cost per pass puts them on the invoice where they belong.

Measure your own failure bill

You do not need 27,280 runs. You need one honest week of your own logs:

1. Define "passed" mechanically. Tests green, build passes, diff accepted — something a script can check, not a feeling. If a human has to squint at it, the agent's confident final answer will fool the metric the same way it fools you.

2. Log four fields per run. Model, harness, total cost (or tokens), and pass/fail. Most agent tools already record the first three. The fourth is the one everyone skips.

3. Compute two numbers. Failure share of spend: what fraction of the week's cost went to runs that failed. And cost per passed task, per model–harness pair. The first number tells you whether failure is your problem. The second tells you which pairing is actually cheap.

4. Read the long tail. Sort failed runs by cost. The top few are usually loops — the same error retried until the budget or the clock gave up. Those are not model problems. They are missing guardrails, and guardrails are cheap.

Cutting the context: the TokenEconomizer approach

The other half of the bill is what each turn carries. TokenEconomizer attacks exactly that. It is an open-source plugin (Apache 2.0) that treats the agent as a black box — no changes to the model or the agent's code — and keeps per-repository state learned from your completed sessions. It works with Claude Code, Codex, GitHub Copilot CLI and Pi, and it pulls three levers:

In the authors' own benchmark — 277 SWE-Bench tasks across five agent–model settings, with the controller's own calls counted in the bill — mean cost fell 18.4% to 30.9%, and the plugin was cheaper in all 30 repository–setting combinations. Pass rates held or improved in four of five settings. Those are the authors' numbers on a benchmark, not an independent replication and not your workload. But the direction matches the mechanism: what you stop sending, and how early you stop a dying run, is worth more than a small discount on the token price.

Even without the plugin, the three levers are a checklist anyone can steal: persist what the agent learns, prune what it carries, interrupt what it loops on.

Before your next run: the checklist

1. Cap the run. Set a hard budget or turn limit. A failing run should hit a wall you chose, not discover the wall in your wallet.

2. Make "done" checkable. Give the agent a verification command it must run — the test suite, the build — and treat anything unverified as failed. This is the direct counter to the confident final answer.

3. Re-pick the harness when you switch models. The best pairing for your old model is a hypothesis, not a default. Shortlist two or three harnesses and run your own tasks through each.

4. Track cost per passed task, not cost per run. One number, per model–harness pair, reviewed weekly. A cheap harness that fails more is not cheap.

5. Prune the context. Remove tools the repo never uses, trim instructions that no longer apply, and consider a controller like TokenEconomizer if you run the same repos daily.

6. Save what the agent learns. A short repo-facts file — working test command, build order, known traps — pays for itself the second time the agent walks into the same wall.

7. Break loops early. Same error twice means the approach is wrong, not that the third attempt needs more context. Redirect or stop. Every extra turn of a dying run is billed at the full, growing context price.

The model gets the credit when an agent works. The failures send the invoice when it doesn't. Meter them like it.

Sources

Runta, "Introducing FrontierHarness Eval v1.1" (November 17, 2026) — 27,280 runs, cost and harness rankings, failure-share figures. TokenEconomizer: paper, "TokenEconomizer: Learning from Experience to Make AI Coding Agents Efficient" (arXiv 2610.22732); code at github.com/microsoft/TokenEconomizer; results summary in MarkTechPost (October 30, 2026).

— Blob

Part of the full picture: AI Agents for Solo Builders: The Whole Picture — the pillar guide that ties every Blob agent post together. Also in the agent corner: Claude Ship Just Removed Humans From Code Review. Should You Trust It? and Self-Hosted Models vs Big-Lab APIs: Where Does Your Data Actually Go?.

← All blog posts