DEV Community

Dakota Wu
Dakota Wu

Posted on

Stop Pricing Coding Agents in Tokens. Price Them in Failed Attempts.

Picture a developer who just discovered a free 10-million-token allowance and immediately wired the agent into their editor. Six hours later the allowance is gone, the branch has forty commits, and none of the tests pass. The tokens were free. The hours were not.

This scene repeats every time a new model drops and every time a vendor announces a credit giveaway. We argue about benchmarks, badges, and context windows, but the argument that actually decides whether an agent pays for itself is about iterations: how many failed attempts does it take before the agent produces something that works? Tokens measure consumption; iterations measure progress. The two are not the same, and pricing agents in tokens is how developers end up with a free bill they cannot afford.

My position is simple: stop pricing coding agents in tokens and start pricing them in failed attempts. A free allowance is useful only if it funds a measurement of iteration cost, and the rest of this article shows how to run that measurement. This is not a semantic preference; it is a budgeting decision that changes which tools you keep and which you abandon.

Why token math lies to you

A token is a unit of text, not a unit of work. An agent can burn twenty thousand tokens on a confident refactor that compiles, fails one test, and gets rewritten from scratch. It can also solve a task in four hundred tokens with a single surgical edit. Token prices tell you what the vendor charges; they tell you nothing about how much the agent had to struggle to earn your trust.

Iterations are the honest currency because they map to the thing you actually spend: attention. Every failed attempt costs you a review cycle, a context refill, or a decision about whether to let the agent try again. The cost of a coding agent is not the token meter; it is the supervision meter, and supervision is priced in iterations.

The iteration ledger

The fix is to instrument the agent loop so every attempt is recorded. The artifact below reads a JSONL log of agent actions and reports the only number that matters: iterations per successful task. Each action in the log is one line:

echo '{"action":"edit","file":"src/parser.py"}' >> agent_actions.jsonl
echo '{"action":"test","passed":false,"error":"IndexError"}' >> agent_actions.jsonl
echo '{"action":"edit","file":"src/parser.py"}' >> agent_actions.jsonl
echo '{"action":"test","passed":true}' >> agent_actions.jsonl
Enter fullscreen mode Exit fullscreen mode

Then the ledger script turns that stream into a decision:

#!/usr/bin/env python3
"""iteration_ledger.py — price an agent in failed attempts, not tokens.

Each line in the JSONL log is one agent action:
{"action": "edit", "file": "src/parser.py"}
{"action": "test", "passed": false, "error": "IndexError"}
{"action": "test", "passed": true}
"""
import json
import sys
from pathlib import Path

def load(path: Path) -> list[dict]:
    rows = []
    for line in path.read_text().splitlines():
        line = line.strip()
        if line:
            rows.append(json.loads(line))
    return rows

def count_iterations(rows: list[dict]) -> dict:
    edits = sum(1 for r in rows if r.get("action") == "edit")
    tests = sum(1 for r in rows if r.get("action") == "test")
    failures = sum(1 for r in rows if r.get("action") == "test" and not r.get("passed", True))
    successes = sum(1 for r in rows if r.get("action") == "test" and r.get("passed"))
    iterations = min(edits, tests)
    return {
        "iterations": iterations,
        "failed_attempts": failures,
        "successful_tasks": successes,
        "iterations_per_success": round(iterations / successes, 2) if successes else None,
        "failure_rate": round(failures / tests, 3) if tests else 0.0,
    }

def main() -> None:
    path = Path(sys.argv[1]) if len(sys.argv) > 1 else Path("agent_actions.jsonl")
    if not path.exists():
        sys.exit(f"log not found: {path}")
    print(json.dumps(count_iterations(load(path)), indent=2))

if __name__ == "__main__":
    main()
Enter fullscreen mode Exit fullscreen mode

Run it with python3 iteration_ledger.py agent_actions.jsonl, and you get a number you can actually make a decision on.

What the numbers mean

The table below is a starting point, calibrated for small to medium refactors and bug fixes:

Iterations per success Verdict
1-3 Good fit; the agent converges quickly and supervision is cheap
4-8 Usable; budget for review time and occasional steering
9-15 Expensive; the agent is guessing and burning your attention
15+ Wrong tool or wrong prompt; stop and rework the approach

The threshold depends on your team and your task, but the shape of the decision is always the same: a free token allowance does not change the iteration count, and a tool that needs fifteen attempts per task is expensive even when the tokens cost nothing. That is the sentence to remember when a vendor's benchmark page looks impressive. Benchmarks measure the model; the ledger measures your workflow.

Using a free server to make the measurement

This is where MonkeyCode's offer becomes relevant rather than promotional. MonkeyCode is an open-source project that currently provides free access to 10 million tokens and a free server option. Disclosure: This article was prepared as part of MonkeyCode's product outreach. Verify the current terms before relying on them, because free offers change.

The free server matters for the iteration ledger because iteration data is only useful as a trend. A single session tells you whether the agent had a bad day; a week of sessions tells you whether the tool fits your codebase. The free server lets you schedule a nightly run of your top five recurring tasks, log the actions, and let the ledger accumulate. After five nights you have a distribution of iteration counts, not an anecdote.

Limitations and who should skip this

  • The 10 million token allowance and free server are operator-supplied claims; check the project documentation for current terms, model availability, and server limits.
  • The ledger measures iterations, not code quality. An agent can pass tests in two iterations and still produce a design you will regret in a month; review the diff, not just the log.
  • A free server is not automatically a private server. Read the terms before sending proprietary code through it.
  • If you are evaluating a single one-off task, the ledger is overkill. It pays off when you are comparing tools, onboarding a new agent, or deciding whether to renew a paid plan.

The takeaway

Tokens are a billing unit, and billing units are a terrible way to measure engineering progress. The next time a vendor hands you free credits, spend the first week counting failed attempts instead of counting tokens. If you want a concrete place to run that experiment, MonkeyCode's free tier — 10 million tokens and a free server — gives you enough runway to build an iteration trend line. Take the offer, verify the terms, and let the failed attempts decide.

MonkeyCode provides free models that can run this workflow.

Top comments (0)