Dr. Obieda Ananbeh

PhD in computer science

Sr.Software Engineer

Microsoft Certified

Java Developer

AI

Dr. Obieda Ananbeh

PhD in computer science

Sr.Software Engineer

Microsoft Certified

Java Developer

AI

Blog Post

The cheapest AI agent call can produce the most expensive fix

November 28, 2026 Tech
The cheapest AI agent call can produce the most expensive fix

A coding agent can make a cheap API call and still be an expensive way to fix a bug. It may reread the repository, fail a test, ask another model for help, and try again. The price of the first response tells you little about the cost of the finished work.

This week’s update to METR’s assessment of AI R&D acceleration at Anthropic makes the budget question particularly relevant. In its November 25 update, METR added comparisons showing that models on token-intensive benchmarks such as MirrorCode typically use over one million output tokens per task. The report also cautions that token accounting across evaluations may not be comparable.

That is not a recommended budget for your bug tracker. It is a reason to ask what resources sit behind a capability score. For a software team choosing an agent, I would want to see the cost of getting a fix accepted, with failed attempts included.

A task needs its own cost ledger

Imagine two workflows tackling the same repository issues. Workflow A uses cheaper calls but often retries. Workflow B uses more expensive calls and resolves more issues on its first attempt. Comparing their token prices would miss the behavior you are buying.

Assign a stable ID to each original issue. Attach every model call, tool charge, and retry to that ID, including calls to reviewers and subagents. Keep the assigned task list separate from the execution log so that an issue the agent never started does not disappear from the denominator.

For a fixed task set, a useful measure is total recorded execution spend divided by the number of distinct tasks that satisfy the acceptance checks. The numerator includes spending on unresolved tasks. Counting only successful attempts makes failures look free.

Report the completion rate beside that number. An agent that solves only the easiest issue can have an attractive cost per success while leaving most of the work undone. Also retain elapsed time and the unresolved task IDs; a deadline or a particular blocking issue may matter more than the average.

A small example you can run

The following Python example uses invented costs and outcomes to demonstrate the accounting. It is not a model comparison, a pricing claim, or an empirical estimate. Each row represents one complete attempt, whose cost should already include its model and tool charges. The acceptance flag comes from external checks, not the agent’s statement that it finished.

from decimal import Decimal

# Illustrative costs, not measurements or vendor prices.
# Each tuple: task ID, billed cost in dollars, accepted by checks.
runs = {
    "A": [
        ("t1", "0.10", True),
        ("t2", "0.10", False), ("t2", "0.10", True),
        ("t3", "0.10", False), ("t3", "0.10", False),
        ("t4", "0.10", False), ("t4", "0.10", False),
    ],
    "B": [
        ("t1", "0.25", True), ("t2", "0.25", True),
        ("t3", "0.25", True), ("t4", "0.25", True),
    ],
}
assigned = {"t1", "t2", "t3", "t4"}

for name, attempts in runs.items():
    assert all(task in assigned for task, _, _ in attempts)
    total = sum((Decimal(cost) for _, cost, _ in attempts), Decimal("0"))
    solved = {task for task, _, accepted in attempts if accepted}
    attempted = {task for task, _, _ in attempts}
    retries = len(attempts) - len(attempted)
    unit = f"${total / len(solved):.2f}" if solved else "undefined"
    print(f"{name}: solved={len(solved)}/{len(assigned)}, retries={retries}, "
          f"total=${total:.2f}, per_solved={unit}")

Running it with Python 3 produces:

A: solved=2/4, retries=3, total=$0.70, per_solved=$0.35
B: solved=4/4, retries=0, total=$1.00, per_solved=$0.25

A costs less in total, but it resolves only two of the four assigned tasks. B spends more overall and less per resolved task. Neither number alone describes the trade-off. If all four tasks are required, A’s lower bill is also a bill for incomplete work.

The sets prevent repeated successful checks for one task from inflating the solved count. In this simplified log, each row is an attempt; in a real system, distinguish attempt IDs from individual API calls. For one integrated release, rerun the acceptance suite against the final combined revision. An earlier passing patch may no longer pass after later changes.

Compare budgets, not just models

METR’s report calls for returns-to-expenditure curves: scores at different spending levels. That is more informative than attaching a single score to a model name. A workflow allowed ten attempts has a different opportunity to succeed from one allowed a single attempt.

For your own evaluation, hold the task set, repository snapshot, tools, and acceptance checks fixed. Test each workflow under several predeclared per-task spending caps. Specify whether the cap covers model charges only or also includes execution tools, and record actual spend as well as the cap. A hard cap needs enforcement in the execution layer, including concurrent calls; a sentence in the prompt cannot enforce a billing limit.

Do not assume additional agents justify themselves. In its November 20 capability update, METR reports that swarms helped on verifiable tasks with clear metrics and fast feedback, compared with its best-of-k baseline, but had unclear or negative effects on other tasks. That finding concerns METR’s experiments, not every development workflow. It is a good reason to measure what your extra coordination buys.

A prompt for auditing an agent run

Use this with a read-only analysis agent that can inspect your task list, billing records, and test artifacts. Replace the placeholders with your own definitions.

Audit this coding-agent evaluation without changing its files.

Assigned tasks: [task IDs and original requirements]
Execution log: [attempt IDs, task IDs, model/tool charges]
Acceptance evidence: [checks, final revision, artifact locations]
Cost scope: [model charges, tool charges, exclusions]
Budget policy: [per-task caps and stopping rules]

For each workflow:
- Reconcile every assigned task with attempts and final evidence.
- Include failed attempts and reviewer/subagent costs.
- Count each accepted task once.
- Report total spend, accepted/assigned tasks, retries,
  elapsed time, and cost per accepted task.
- List unresolved tasks and missing billing or test evidence.

Do not infer success from an agent's completion message.
If costs are missing, label the total incomplete.
If no tasks pass, report cost per accepted task as undefined.
Separate observations from suggestions for another experiment.

This is an audit instruction, not an enforcement mechanism. The agent still needs trustworthy logs, and you need acceptance checks that cover the actual requirements. Where review labor or infrastructure costs are excluded, state that explicitly rather than calling the result the full cost of delivery.

For the next agent trial, keep one ledger row for every attempt and preserve every unresolved task. Then compare completion rates at the same spending caps. That gives you evidence for deciding whether a cheaper call, a stronger model, or another reviewer is worth paying for.

Taggs: