Million-Token Agent Coding: Practical Gains and Boundaries
Long-running coding agents can move from one-shot generation to multi-step engineering, but quality depends on goal consistency, verification, cost structure, and bounded permissions—not fluent output or token volume.
From model demos to engineering evaluation
When an agent can keep calling tools, editing code, and running tests, fluency and “complete-looking” code are no longer enough. What matters for development efficiency is whether it stays aligned with the goal over a long run, whether it can find and fix errors, and whether the final delivery meets verifiable business requirements.
Reference material describes an exploration totaling more than ten million tokens, covering autonomous coding, complex reasoning, simple questions, and invocation cost. It does not provide full task logs, repeated trials, or unified acceptance results, so it cannot support general performance claims.
A more useful approach is to abstract three capability gains and one failure mode worth watching:
- Agents may evolve from single-shot code generation to multi-step engineering execution.
- Putting verification into task planning can form an implement–check–fix loop.
- When context structure fits caching, long-task cost may not grow in proportion to cumulative input.
The failure mode: longer reasoning does not necessarily produce more correct answers, and simple problems can be wrongly overcomplicated.
These judgments need independent evaluation; they should not be treated as inherent properties of a given model.
Long-horizon autonomous coding is valuable when task state actually advances
Working continuously for tens of minutes is a process metric, not a delivery metric. An agent can keep running while repeatedly editing the same file or spending compute on a false assumption. Long-horizon ability should be judged by whether the work keeps moving toward acceptance criteria.
A manageable execution loop typically includes:
requirements confirmation → task breakdown → implementation → verification → failure analysis → repair → stage acceptance
Requirements set direction; verification determines whether results are trustworthy; stage acceptance prevents errors from accumulating until the end.
Take a bookkeeping system. “Implement bookkeeping and statistics pages” is not enough. Business constraints should include:
- Every income/expense record must have amount, timestamp, category, and owning account.
- Amounts should be stored as fixed-point values or integers in the smallest currency unit to avoid binary floating-point drift.
- Transfers must maintain both outbound and inbound relationships and remain atomic.
- Aggregations must distinguish income, expense, and transfers to avoid double counting.
- Users must be isolated; queries and updates must check authorization.
- After historical records are changed or deleted, statistics must stay consistent with details.
These conditions are closer to real system value than page count or lines of code.
For unspecified requirements, the agent should list assumptions and open questions—for example, whether multiple currencies need FX conversion, whether deleted records can be restored, and whether account balances may go negative. Choosing business rules without confirmation can produce a “feature-complete but wrong” system.
Use an acceptance matrix to constrain autonomous execution
The original material’s engineering tasks included planning and a verification checklist. That approach is worth keeping, but checks cannot stop at “pages open” and “records can be added.”
Acceptance can be split into four layers:
Layer 1: business correctness. Check categorization, balance changes, time-range statistics, and transfers against requirements. Use a small set of examples with unambiguous expected results so each aggregate can be checked by a person.
Layer 2: data consistency. Check whether failed operations leave partial state, whether resubmits create duplicate entries, and whether deleting related data corrupts history. For balance changes, verify transaction boundaries, not only a single happy-path request.
Layer 3: security. Check authentication, access control, input validation, and handling of sensitive data. In particular, a user must not read or modify another user’s data by changing record IDs.
Layer 4: runnability. The system should initialize in a clean environment, apply schema changes, run tests, and start from documentation. Success only in the agent’s current working directory is not reproducible delivery.
Example acceptance table:
| Acceptance goal | Check method | Pass criterion |
|---|---|---|
| Accurate statistics | Recompute from fixed sample data | Totals match expected results |
| User isolation | Cross-user access tests | Unauthorized requests are rejected |
| Complete transfers | Inject failure mid-operation | No one-sided balance change |
| Idempotent submit | Replay the same business request | No duplicate business records |
| Reproducible environment | Redeploy in a clean environment | Startup and verification follow docs |
Agent-generated tests can also be wrong. Critical business rules should be backed by independent human-provided samples so implementation and tests do not share the same false assumption.
Autonomy is not unlimited authorization
Long-running agents need to read files, run programs, and modify projects, which also expands the risk surface. Practice should separate what the model may propose from what the system is allowed to execute.
Permissions can be scoped by impact:
Low risk: reading project docs, editing code in an isolated directory, running local tests—auto-execute in a restricted environment.
Medium risk: installing dependencies, accessing the network, changing runtime config—restrict sources, log changes, and check task scope.
High risk: bulk deletes, production config changes, reading secrets, or sending sensitive data outward—require human confirmation. “Fully automatic” is not a reason to lift these controls.
The execution environment should also have time, call-count, and resource budgets. Log each tool call’s purpose, result, and error summary for audit and incident review.
“Unattended” should mean working inside a pre-approved envelope, not removing supervision and permission boundaries.
Complex reasoning highlights need stability evidence
Logic puzzles, math problems, and engineering debugging all involve reasoning, but they demand different skills: constraint consistency, rigorous proof, and using environmental feedback to discard hypotheses. Success on one task does not transfer automatically.
When evaluating complex reasoning, at least record:
- First-try accuracy, not only the best of many attempts
- Repeat performance on similar tasks, for stability
- Time and token cost before an answer, for compute investment
- Whether contradictions trigger correction instead of defending a wrong conclusion
- Whether uncertainty is acknowledged when information is incomplete
For math and constraint problems, use independent checks: substitution, boundary tests, counterexample search, or small executable enumerations. The more complete the explanation, the more important it is to separate narrative coherence from valid derivation.
For repeatedly failing tasks, design an exit: if consecutive repairs add no new passing tests, or the same error recurs, pause and emit a failure summary rather than keep spending budget.
Errors on simple questions are not only “overthinking”
Mistakes on simple tasks may come from intent misread, wrong premises, ignored real-world constraints, or generation variance. One answer is rarely enough to blame long reasoning.
For example, “Should I walk to a nearby car wash?” is not only a distance comparison. Car wash service typically requires a vehicle on site. Answering only about transport, even at length, misses the real problem.
Before reasoning, check three elements: the task object; what the user actually wants done; and non-omissible real-world conditions.
Applications can route accordingly: short path for simple, well-bounded requests; deeper processing for multi-constraint or tool-verified work; independent checks or human review for high-risk business. Routing should not be based only on question length. A short sentence can involve complex permissions or a high-stakes decision; a long format-conversion request may need little reasoning.
Million-token cost should be broken down by bill structure
Cumulative tokens show call volume, not true cost. Typically you need uncached input, cached input, output, plus compute and storage from tool execution.
With a defined billing model, a generic estimate is:
model cost = uncached input × unit price
- cached input × unit price
- output × unit price
Total task cost also includes execution-environment fees and human review/rework. What is billed and how it is measured depends on the actual service; do not assume every provider caches the same way.
Caching helps with repeated, stable context such as fixed rules, API contracts, and project notes. Cache hits do not mean better understanding and do not replace context management. Whether frequently changing content hurts hit rate depends on implementation and billing.
Three ways to cut wasted spend:
- Stabilize shared context and avoid pointless rewrites.
- Filter and summarize tool output instead of feeding large irrelevant logs back into the model, while keeping raw logs for traceability.
- Maintain stage state: completed work, current failure cause, and next plan, to reduce re-exploration.
Cost per accepted delivery matters more than unit price per call. A cheap path with frequent rework may be less economical than a more expensive path with higher success.
A reusable evaluation process
To turn exploratory experience into engineering evidence:
- Fix a task set covering short tasks, multi-file edits, constrained reasoning, and long-horizon engineering—not only showcase examples.
- Fix the environment: tool permissions, initial project state, budget caps, and acceptance criteria, so environment differences are not mistaken for model differences.
- Repeat runs. Record first-try success, final success, human interventions, time, cost, and key error types.
- Keep failure samples. Separate requirement misunderstanding, tool misuse, code defects, missing verification, and looping execution, then adjust process by cause.
- Choose rollout by business risk. Low-risk assistive work can automate earlier; tasks involving money, permissions, or irreversible actions need stricter review and rollback.
Conclusion: turn generation into verifiable delivery
Long-horizon planning, tool collaboration, and verification loops expand how agents can join development. Long runtime, large output, and detailed reasoning do not by themselves prove quality.
Reliable agent engineering needs clear requirements, independent acceptance, limited permissions, budget control, and failure exits. The goal is not to make the model work as much as possible, but to make every step produce inspectable progress and to deliver correct, safe, maintainable results at reasonable cost.
