Lessons from a 10-Million-Token Test of Long-Horizon LLM Agents
This article shares hands-on findings from a long-horizon agent test that consumed over 10 million tokens. It explains why single-turn evaluations fall short, then covers three surprises—autonomous planning and execution, efficiency gains from tool collaboration, and how prefix caching changes cost structure—along with an unexpected issue around reasoning stability and overthinking. It also provides practical guidance on task constraints, tiered model routing, termination conditions, and an evaluation and model-selection checklist for building observable, rollback-capable, and measurable agent workflows.
1. Why 10-Million-Token Testing Matters
Single-turn Q&A evaluations only reflect how a model performs in short interactions. Real engineering work is usually a long chain of steps involving multiple tools and state changes. To judge whether a model is capable of acting as an agent, the observation window has to be extended to the full task lifecycle, which inevitably leads to a jump in token consumption. A test that accumulates more than 10 million tokens is essentially validating three things: goal retention in long contexts, recovery after failures, and the shape of the cost curve as task duration grows.
It is worth stressing that token consumption does not scale linearly with task complexity. In long-horizon tasks, the model repeatedly reads code, compares logs, and rolls back changes. This overhead often accounts for the bulk of total consumption. So the evaluation design must define boundaries up front: whether the task allows network access, whether it allows writing files, and whether multiple rounds of self-verification are permitted.
2. Surprise One: Long-Horizon Autonomous Planning and Execution
In open-constraint tasks such as database design, giving the model overly detailed step-by-step hints actually makes it harder to assess its planning ability. In the test, the model first produced a structured plan: a breakdown of functional modules, the database table design, and the development order. It also proactively added a verification checklist that separated “done” from “correct.” It then moved into nearly an hour of continuous coding with no interruptions, no infinite loops, and no missed critical steps.
The engineering implication is that the bottleneck in agent capability has shifted from single-step generation quality to plan consistency. Reusable practices include:
- Have the model produce a plan and acceptance criteria before execution, to avoid goal drift caused by writing and revising at the same time;
- Set checkpoints for long tasks, and require the model to restate the current goal and remaining steps at each checkpoint;
- Make tool calls idempotent to avoid state pollution from repeated execution;
- Automate result verification as much as possible, using runnable test cases instead of subjective judgment.
An illustrative task constraint description can be written as:
Goal: Build an accounting system with category management and transaction statisticsConstraints: Use only local files and the built-in database; run self-tests after each module is completedAcceptance: Add, delete, modify, and statistics operations all return without errors
3. Surprise Two: Efficiency Gains from Tool Collaboration
Pairing a strong reasoning model with an intelligent coding tool is currently a mainstream way to organize engineering work: the former handles the plan and difficult decisions, while the latter handles file operations, command execution, and runtime feedback. The test showed that this division of labor significantly reduces the number of human interventions. When putting it into practice, pay attention to the completeness of context handoff. The handoff information should at least include the goal, completed items, failure reasons, and assumptions for the next step; otherwise, “amnesia on handoff” is likely to occur.
4. Surprise Three: Caching Changes the Cost Structure
In long tasks, repeated prefixes make up a high proportion. After a prefix cache hit, the actual billed tokens diverge noticeably from the original tokens. This means the focus of cost optimization is not compressing a single output, but increasing context reuse: keep the system prompt and project description stable, place volatile content later, and avoid needlessly rewriting entire blocks of background. In engineering terms, you can combine logging services with monitoring and alerting to track cache hit rate and per-task cost, forming a sustainable cost dashboard.
5. The Unexpected: Reasoning Stability and “Overthinking”
On extreme reasoning problems, the model may fall into circular argumentation or repeatedly overturn its conclusions across multiple rounds of self-verification. On extremely simple problems, a stronger model sometimes drifts away from the obvious answer because it considers too many branches, while a lightweight model is more direct. This is not a matter of capability level, but a mismatch between the reasoning budget and task difficulty.
The corresponding engineering strategy is tiered routing:
if the task is simple extraction or formatting:use a lightweight model and limit the number of reasoning roundselif the task involves multi-step reasoning or code generation:use a strong model and set maximum iterations and a timeout threshold
Hard termination conditions should also be in place: maximum iteration count, per-step timeout, and repeated-output detection, to prevent infinite loops from consuming the budget.
6. An Actionable Evaluation and Selection Checklist
- Build a tiered task set: simple, medium, and extreme, and measure accuracy and consumption for each tier;
- Record process metrics: number of interruptions, number of rollbacks, and tool call success rate;
- Present cost metrics alongside effectiveness metrics, and avoid looking only at unit price;
- Introduce manual spot checks for long tasks, focusing on goal drift and missed steps;
- Automate verification, and make “runnable” the delivery threshold.
7. Conclusion
The core conclusion from the 10-million-token test is not mysterious: long-horizon tasks test plan consistency and self-correction, extreme reasoning tests stability and termination strategy, lightweight tasks test specification matching, and cost depends on context reuse efficiency. Only by incorporating these points into a unified evaluation framework can you avoid being misled by a single leaderboard or a one-off demo. To host such agent workloads in the cloud, you can build an observable, rollback-capable, and measurable engineering loop by combining general-purpose capabilities such as container platforms, object storage, message queues, and log monitoring.
