AI Agent Long-Horizon Test: A Retrospective After 10 Million Tokens
This article reports on a long-horizon AI agent evaluation that ran for hours and consumed roughly 10 million tokens. It explains why short, single-turn benchmarks are not enough to judge agent readiness, then shares four findings: long-horizon autonomy depends on a closed planning loop, complex reasoning still lacks stability, lightweight tasks can suffer from overthinking, and context caching can offset price increases on long-running jobs. It closes with practical engineering advice on tiered model routing, external verification, and building a small, observable benchmark set.
1. Why Run a 10-Million-Token Long-Horizon Test
Short prompts and single-turn question answering only show how a model performs “within one step.” Real engineering and business work is usually a long chain of multiple turns, multiple tools, and changes across files. To judge whether a model is actually usable as an agent, you have to stretch the evaluation to hours and scale consumption to the tens of millions of tokens. Only then do three problems surface: whether planning is self-consistent, whether execution converges, and whether cost stays under control.
The core method here can be summarized as “three openings, one record”: open up task constraints (give the goal, not the steps), open up execution time (allow continuous runs of tens of minutes), and open up tool use (allow reading and writing files, running commands, and retrieving information). At the same time, every step’s input and output, tool calls, and token consumption are recorded in full so the run can be reviewed afterward.
2. Finding 1: Long-Horizon Autonomy Hinges on a Closed Planning Loop
The strongest result was long-horizon agentic coding. Given only a business goal, with no fixed tech stack or prescribed steps, the model first produced a structured plan: functional module breakdown, data table design, development order, and a self-verification checklist to run after implementation. It then executed without intervention for close to an hour, with no interruptions, no infinite loops, and no skipped critical steps.
The capability that actually matters here is not “writes code fast” but that a loop was formed:
goal understanding -> plan breakdown -> dependency ordering -> component-by-component implementation -> self-verification -> fix and regress
A reusable engineering practice is to put the acceptance criteria into the prompt up front, have the model generate its own executable verification checklist (for example, API connectivity, data consistency, exception paths, performance baselines), and require a verification run after each component is completed. This localizes failures in long-horizon tasks instead of letting everything collapse at the final step.
3. Finding 2: Complex Reasoning Is Still Unstable
On logic puzzles, the model’s reasoning chain was clear and its conclusions were correct. On harder math problems and some lightweight tests, however, two typical failures appeared: it fell into self-repeating loops of reasoning, and it produced conclusions that looked plausible but were wrong.
There are usually three causes. First, long reasoning chains lack external validation, so an early error gets amplified by later steps. Second, the model tends to “keep thinking” rather than switch approaches. Third, if the problem constraints are ambiguous, the model fills in its own assumptions.
The corresponding engineering fix is to add external constraints and termination conditions: cap the maximum number of reasoning steps, add repetition detection, require the model to explicitly list known conditions and assumptions, and independently re-check key conclusions with code or a tool. The logic looks like this:
if steps > MAX_STEPS or repeated(sub_trace):return fallback_or_ask()verify(answer, by="independent_tool")
4. Finding 3: The Overthinking Trap on Lightweight Tasks
A counterintuitive observation: the simpler the task, the more likely the model is to answer incorrectly because it reasons too far, while a lighter model version answers directly and efficiently. This suggests model selection should not be based only on “the strongest” but on matching task complexity against cost and benefit.
The practical recommendation is tiered routing: short-chain tasks such as intent recognition, format conversion, and summarization or classification go to lightweight models; multi-step planning, cross-file refactoring, and complex debugging go to more capable models. Also keep a “answer briefly when the task is simple” prompt constraint to suppress unnecessary elaboration.
5. Finding 4: Prices Went Up, but Caching Pulled Long-Running Bills Back Down
Token consumption in long-horizon tasks is highly repetitive: the system prompt, project context, and prior tool outputs get carried in again and again. Services with context caching can significantly dilute the cost of that repeated input, so the total bill often rises less than the unit price does.
Optimization checklist: keep the position and wording of the system prompt and tool descriptions stable; put large blocks of static material into a cacheable prefix; summarize retrieval results before injecting them; split context by session to avoid useless growth; and use logging services plus monitoring alerts to continuously track tokens and latency per task.
6. Implementation Advice
To evaluate and adopt this kind of capability in your own business, fix a small baseline set (several long-horizon engineering tasks, complex reasoning problems, and lightweight tasks), and track four metrics: success rate, number of human interventions, duration, and token cost. Then isolate the execution environment with a container platform, store artifacts in object storage, and decouple long-running tasks with a message queue. On general-purpose cloud infrastructure such as Baidu AI Cloud, this is enough to land agent engineering that is controlled, observable, and reusable.
