Large Language Model Agents in Long-Horizon Tasks: Lessons from a 10-Million-Token Test Run
This article reports on a hands-on evaluation of large language model (LLM) agents in long-horizon scenarios that consumed more than 10 million tokens in total. It covers four dimensions: agentic coding, complex reasoning, lightweight tasks, and cost structure. Key findings include the model's ability to run autonomously for close to 60 minutes without stalling, two recurring reasoning failure modes, the "overthinking" trap on simple tasks, and why higher per-token prices do not necessarily translate into proportionally higher bills for long tasks. The article closes with a reusable evaluation checklist that teams can turn into regression tests to track model iterations independently of any specific vendor.
1. Why a 10-Million-Token Test Is Necessary
Single-turn question-and-answer benchmarks mostly reflect how a model behaves in short interactions. They rarely expose stability problems that only surface in long-chain tasks. In real engineering work, an agent has to call tools repeatedly, read and write files, run verification, and roll back and retry after errors. Token consumption at this scale naturally reaches the millions, sometimes tens of millions. Only when an evaluation is stretched to that scale do three normally hidden issues become observable: whether long-horizon planning stays internally consistent, whether error recovery converges, and whether cost remains controllable.
The goal of this test was to build an evaluation method that is independent of any specific product. It spans four dimensions—agentic coding, complex reasoning, lightweight tasks, and cost structure—and consumed more than 10 million tokens in total.
2. Long-Horizon Agentic Coding: What Matters Over 60 Minutes of Continuous Execution
For tasks such as database design and mobile emulator development, we deliberately avoided giving the model overly detailed constraints. We described only the business goal, in order to test its ability to break the problem down on its own.
A typical prompt structure looked like this:
Goal: Build a usable bookkeeping systemConstraint: Provide only the business goal; do not specify the table schema or APIsExpectation: Output a plan first, then implement autonomously, then self-verify
The model first produced a plan containing several core feature modules and data tables, then laid out its own development workflow and verification checklist. It then entered a long autonomous execution phase, running for close to 60 minutes without interruption or infinite loops, with no key steps skipped.
From an engineering perspective, three observable metrics stand out:
- Planning consistency: whether the modules, data tables, and verification items in the plan reinforce one another;
- Execution continuity: whether long-running sessions show meaningless repetition or context drift;
- Self-correction: whether the model can locate an error and roll back, rather than repeatedly tweaking the same spot.
The conclusion is not mysterious. Long-horizon capability ultimately depends on stable state management, clear tool-calling boundaries, and verifiable intermediate artifacts. The frontend may look mediocre, but a usable core path with data that can be written and read is the passing bar for agentic coding.
3. Complex Reasoning: Both Strengths and Weaknesses
On logic puzzle tasks, the model performed consistently. On harder math problems and some lightweight tests, however, two typical failure modes appeared: first, circular reasoning, repeatedly re-confirming the same premise; second, conclusions that look plausible but are wrong.
This suggests that reasoning stability cannot be judged by “accuracy on hard problems” alone. You also need to look at:
- Whether it converges within a limited number of steps;
- Whether it can clearly express uncertainty when it fails;
- Whether it produces a reproducible reasoning path that a human can review.
The engineering response is to decouple reasoning from verification: have the model produce intermediate conclusions, then let an external check (unit tests, constraint checks, a rules engine) make the call, instead of fully trusting a single output.
4. The “Overthinking” Trap in Lightweight Tasks
A counterintuitive pattern: the simpler the task, the more likely the model is to “think too much.” For example, on basic logic questions, a more capable version sometimes introduces unnecessary assumptions and drifts away from the correct answer, while a lighter version takes a shorter path, states the conclusion directly, and performs more efficiently.
This has clear implications for model selection:
- For simple classification, extraction, and rewriting tasks, prefer smaller, lower-latency models;
- Reserve strong reasoning models for long-chain planning and cross-tool collaboration;
- Use a routing strategy that dispatches by task complexity to balance cost and quality.
Illustrative routing logic:
if task.complexity == "low":return light_model.generate(prompt)else:return strong_model.plan_and_execute(prompt)
5. Cost Structure: A Higher Unit Price Does Not Mean a Proportionally Higher Bill
In long-running tasks, repeated context makes up a very high share of the total. If everything is recomputed in full every turn, cost grows linearly with the number of turns. Caching mechanisms reuse already-computed context and significantly cut that duplicated overhead. As a result, even if the per-token price goes up, the total bill for a long task may rise well below the price increase.
Three practical recommendations for keeping cost under control:
- Stable prefix: put the unchanged system prompt and specifications up front to improve cache hit rate;
- Segmented artifacts: split long tasks into reusable intermediate results to reduce repeated generation;
- Bill observability: attribute token consumption per task using logs, monitoring, and alerts.
6. A Reusable Test Checklist
- Long-horizon tasks: continuous execution time, number of interruptions, verification pass rate;
- Reasoning tasks: steps to convergence, distribution of error types, reviewability;
- Lightweight tasks: first-answer accuracy, average latency, rate of unnecessary assumptions;
- Cost: cache hit rate, total tokens per task, bill growth.
Turn this checklist into a regression suite, and you can quickly tell during model iterations whether a model has actually gotten stronger or has just become more verbose. For a team, the real payoff is not chasing leaderboards but owning a vendor-independent evaluation and tuning method that can be reused over the long term.
