Token Burn Rate per Agent Run as the Engineering Metric That Replaces Vague AI Budget Lines
Tracking tokens per agent run ties AI spend to merged work.

Per-run agent cost attribution for engineering teams starts with a task-scoped usage record tagged with the initiating engineer or automation, task source, model, and harness version. Token burn rate per agent run lets teams measure and control how much their coding agents use, which a seat-count budget cannot do. Paired with cost per merged pull request, it connects AI spending to shipped engineering work.
Why seat-count budget lines cannot account for coding-agent spend
A VP of Engineering receives an unexpected AI invoice but cannot tell whether the increase came from a model change, a new task category, or one runaway session. The budget contains a single row labeled “AI tools,” combining subscription seats, API invoices, and cloud-compute charges. That row records spending without explaining its cause. It does little to help predict the next bill.
Seat-count budgets work for tools such as Jira or GitHub, where the charge is for access. Coding agents introduce consumption that varies by model, harness, and assigned task, each of which can independently shift the bill by an order of magnitude. Two engineers with the same tool access can therefore generate very different costs.
How much coding agents actually cost per task, compared to every other AI interaction
Inline completion consumes hundreds of tokens per interaction and remains inexpensive even at high daily volume. A single-file review or explanation moves consumption into the low thousands, but the work remains bounded. A one-shot debugging prompt also starts at a few thousand tokens. The economics change when an agent loop begins. Repeated exploration and tool use can push that debugging task into hundreds of thousands of tokens.
Bai et al.’s 2026 preprint studied eight frontier models across five hundred coding benchmark instances and found that they used millions of tokens per agentic coding task on average. That is roughly a thousand times the token count of the same work handled as chat. Input dominates this consumption. A chat exchange consists of a prompt and response, while an agentic task involves dozens of calls that repeatedly send accumulated context.
Even the same task on the same model can consume dramatically different token totals. Budget exposure therefore depends on the expensive tail of the distribution. The fact that completion and autonomous coding both use an LLM is not enough to make the same consumption forecast useful for both.
What actually drives token consumption inside a single agent run
Most consumption comes from reconstructing context. Four recurring mechanisms explain how that reconstruction becomes waste. Broad search occurs when the agent lacks an authoritative starting point and searches across the repository, leaving a signal in tool calls per task. Re-search happens when it loses something it learned earlier and reads the same files again, an effect visible in repeat-read ratios and cache hit rates.
Mis-routing creates a different form of waste. The agent retrieves a plausible but stale or incorrect source and builds its answer on that foundation. Wrong-source retrieval rate captures the error, while correcting the resulting answer consumes further tokens. Runaway loops compound failed work by retrying an approach until the available token budget is exhausted. Retry counts and sessions that cost far more than usual show that pattern.
Harness overhead adds a repeated charge beneath these behaviors. A large prefix returns on subsequent calls, accumulating input tokens that are not visible in the code printed to the terminal. Codebase health multiplies the effect because less healthy repositories require more broad-search and re-search turns. These are distinct mechanisms with observable fingerprints, rather than an unexplained fluctuation in model usage.
Defining token burn rate per agent run as an engineering metric
Token burn rate per agent run measures total input tokens consumed from the first API call through the final response of one agent session. Despite the word “rate,” the accounting unit here is a run. Its scope excludes the engineer’s other sessions and subscription seat. It exposes consumption at the point where a task is attempted.
The record keeps repeated harness overhead separate from the context that builds up, including tool results and re-read material. Productive generation, including code and reasoning output, is recorded alongside the input accounting and kept out of the input-token total. Cache reads and fresh reads also need separate treatment. Equal input totals can have different billing implications when their cache composition differs.
Tool-call count, retry count, and the resulting artifact complete the record. Whether the run produced a mergeable pull request gives its consumption an engineering outcome. The measurement remains model-agnostic while retaining harness-specific attribution, allowing comparisons across Claude Code, Codex, Cursor, OpenCode, and Pi. A team can change its tools without changing the unit of measurement.
Why spending more tokens does not buy better outcomes, and what that means for the metric
The strongest objection is that expensive runs might be more thorough. If more exploration led to better results, using fewer tokens could cut out useful work. Bai et al. found that using more tokens did not lead to higher accuracy across the models studied. Accuracy peaked in the second-cheapest cost quartile and then flattened. More consumption was not a reliable quality signal.
Models also lack a reliable mechanism for recognizing an unsolvable task and stopping. Those that explore most broadly can therefore fail most expensively, leaving unproductive attempts in the costly tail. This changes the optimization target. The objective is not the smallest possible token total, but the most merged pull requests per token spent.
Token burn rate supplies the consumption side of that calculation. Cost per merged pull request shows how much was spent on engineering work that was accepted. A higher-consumption run can still earn its cost if it produces useful work. Conversely, a low-cost run that produces no usable artifact is not automatically efficient.
How model and harness choice determine the token burn rate before a task begins
Model and harness selection establish much of a run’s consumption profile before execution. Bai et al. found that the highest-reading model averaged over six times as many file views per task as the lowest-reading model on identical tasks. Roughly half of the highest-reading model’s views were of files it had already opened. The lowest-reading model repeated about a quarter of its reads, while most models repeated about half.
Task difficulty alone did not explain the gap. The token-efficiency ranking held both on tasks every model solved and on tasks every model failed. Exploration strategy was therefore a property of the model. That makes model selection a direct cost lever.
Harness selection adds another structural difference. A prefix containing tens of thousands of tokens can recur across an eighty-step task and accumulate millions of prefix tokens independently of productive generation. The practical response is to benchmark harness overhead on a trivial prompt before production use. A headless command for each agent, run across three runs to get a stable median, gives a quick measure of that starting burden.
How do engineering teams track each coding-agent run and its cost?
The operational task is to aggregate and attribute usage already emitted by the harness. Codex CLI 0.161.0 exposes usage in turn.completed events from JSON exec output, while Cursor CLI 2026.10.08 provides a usage object in JSON output. Cline CLI 3.0.0 exposes run_result usage, and Gemini CLI 0.6.0 provides stats.models. Aider 0.86.2 reports a rounded session total. These interfaces differ in precision and extraction method.
For each run, the recommended record includes total input tokens, cache read share, tool-call count, retry count, and outcome. The input total includes uncached input, cache writes, and cache reads, and each is also kept as a separate count. Outcomes distinguish a PR opened, a PR merged, no artifact, and failure. This keeps a run that finished successfully from being counted as work that was accepted.
Attribution requires more than a usage total. Each record needs the task source, such as a Linear issue, Slack thread, or GitHub event, plus the harness version, model, and initiating engineer or automation. Those identifiers make shared Claude Code or Codex consumption traceable to the work and initiator responsible for it. Cloud-native agent platforms can add the task-context identifiers they already know automatically. Without that attribution layer, aggregated token records reproduce the opacity of the original budget line.
Using token burn rate to set task-level budgets and catch runaway runs before they close
Once usage is tied to its source, engineering leaders can set baselines for each task type. A scoped bug fix should be compared with bug-fix runs of similar scope. The median provides a reference point, while baseline ranges accommodate ordinary variation. One expensive run is not sufficient evidence of a systematic problem.
A cluster of above-baseline runs is more informative. It can indicate a harness, model, or codebase problem. While a run is still in progress, repeated attempts on the same subtask give an earlier warning. A retry threshold gives the team a point at which to stop the attempt and route the task differently, avoiding the cost of another repetition.
The control belongs at task scope before execution. A task-level token budget lets the agent proceed until that allowance is consumed, then return whatever artifact it has for a human decision on continuation. This differs from reacting to a rapidly growing API bill with monthly limits per engineer. The recognizable failure pattern is a small initial bill expanding quickly as agent use scales.
What happens to review capacity when agent throughput scales without a token-rate metric
Agents can produce pull requests faster than humans can review them, so greater generation throughput can become review debt. A senior engineer directing agents can generate far more change than before, but review capacity still depends on human attention. Token efficiency cannot expand that capacity by itself.
Cost per merged PR exposes spending on work that has not become accepted output. When PRs fail review and need agent-driven revisions, the extra tokens used add to the cost of reaching a merge.
The system-level target is maximum merged throughput per unit of token spend. That target penalizes high-churn attempts and rewards clean, reviewable work produced on the first attempt. It also connects the cost discussion to the engineering bottleneck. A team that looks only at tokens per run could see cheaper generation as a win while paying more for each change it ships.
Replacing seat-count budget lines with token burn rate in practice
Engineering leaders can make this shift through three changes to planning, measurement, and reporting. The first is to classify consumption by task type. Lightweight interactions include completion and single-turn review, while bounded agentic tasks include scoped bug fixes and single-file refactors. Open-ended agentic tasks include feature implementation and multi-repo changes. Each category needs its own expected consumption range and allowance for runaway risk.
The second change is harness-level instrumentation with attribution. Structured usage output gives teams input-token and cache records, while tool calls, retries, and outcomes show the rest of what happened in the run. Task source, initiating engineer or automation, harness version, and model keep each run accountable. Baseline ranges then support alerts on consistent deviation. This is an attribution layer over existing agent work.
The third change is to report cost per merged pull request. Token burn rate remains the diagnostic input for explaining which tasks, models, harnesses, and retries drove expenditure. The merged-PR measure shows whether that spending led to work that was accepted or to more churn. Together, these records give finance an attributable account of spending and engineering a means of controlling it. Because the measurement is independent of any one harness or model, tool changes need not force a redesign of the budget framework.


