Long-Context AI Agents Tested at Scale: Capability Boundaries at Tens of Millions of Tokens
This article reports on a large-scale evaluation of long-horizon AI agents that consumed tens of millions of tokens across agentic coding, complex logical reasoning, and lightweight tasks. It examines long-run stability, self-correction from structured tool feedback, reasoning consistency, and cost behavior under repeated long-context calls. Key findings include a maturing plan-execute-verify loop, effective error recovery when feedback is structured, deeper reasoning that still needs budget guardrails, and signs of overthinking on simple tasks where lighter models perform better. The article closes with a practical engineering checklist covering task tiering, structured feedback, budget limits, context governance, consistency-based evaluation, and observability.
1. Why Test at the Tens-of-Millions-of-Tokens Scale
A single-turn question-and-answer session only shows whether a model can respond. It does not answer what engineering teams actually need to know: can the model keep pushing a task forward over long stretches without human intervention, can it recover from its own mistakes, can it hold its objective steady across a long context, and what do those capabilities cost on the bill.
This evaluation therefore pushed consumption into the tens-of-millions-of-tokens range and covered three scenario types: agentic coding, complex logical reasoning, and lightweight tasks. The token volume itself is not the goal. Its value is that it filters out occasional lucky results and lets capability gaps surface consistently across a large enough sample.
From an engineering perspective, deciding whether a model is ready for a production pipeline requires answering at least four questions:
- Long-horizon stability: does continuous execution over tens of minutes produce interruptions, infinite loops, or goal drift;
- Self-correction: when a tool call fails or a test does not pass, can the model locate and fix the problem;
- Reasoning consistency: for problems of similar difficulty, are answers reproducible;
- Cost structure: when a long context is called repeatedly, does the bill grow linearly with call volume.
2. Surprise One: Much Stronger Long-Horizon Planning and Execution
For engineering tasks involving database design and server-side development, the prompt was deliberately kept low-constraint. Only the business goal was given, with no prescribed table structure and no prescribed implementation path, in order to test the model’s autonomous planning.
The behavior breaks down into three phases:
- Planning: the model first produced a design covering core functional module breakdown and data table design, and additionally laid out a development step schedule;
- Execution: it kept producing code according to the plan, ran for a long time without interruption, and did not skip key steps;
- Verification: it autonomously generated an acceptance checklist covering key paths such as create, update, delete, and statistics.
One detail worth noting is the appearance of the acceptance checklist. It means the model was not just generating code but was folding verifiability into the plan, which closely matches the engineering habit of defining acceptance criteria before implementation. A representative checklist structure looks like this:
Acceptance items:- After creating a record, the list refreshes correctly- Statistics remain consistent after custom add/delete of categories- Deleting a record does not break referential data integrity- The statistics endpoint returns a valid structure on empty data- Invalid input is rejected with a clear error message
The conclusion is not complicated: what matters in long-horizon tasks is not how much code the model gets right in one pass, but whether it can sustain a stable plan-execute-verify loop. That becomes even more valuable when the model is plugged into an AI coding tool and the tool takes charge of compile and test feedback.
3. Surprise Two: A Closed Loop of Tool Calls and Self-Correction Is Taking Shape
The real difficulty in long tasks is error recovery. In real engineering, compile failures, missing dependencies, and unexpected API responses are the norm. Whether the model can read the error and back out onto the correct path determines whether it can be placed in an automation pipeline.
A more effective practice is to structure the feedback signal explicitly rather than handing the model an entire raw log:
{"stage": "test","passed": false,"failed_case": "statistics_empty_input","error_type": "NullPointer","file": "service/statistics","hint": "Empty data collection has no fallback handling"}
Structured feedback brings two benefits: it reduces interference from irrelevant information competing for attention, and it narrows the correction scope to a specific file and a specific branch. Combined with a strategy of small commits where every step is rollback-able, the cost of errors during continuous execution is significantly reduced.
4. Surprise Three: Deeper Reasoning on Complex Logic Problems
On reasoning tasks that require multi-step deduction and recognition of hidden conditions, the model showed fairly strong hypothesis enumeration and counter-argument awareness, listing possible cases first and then ruling them out one by one. The engineering value of this is that, faced with vague requirements, the model is more inclined to proactively clarify boundary conditions instead of rushing to a conclusion.
At the same time, deeper reasoning does not equal better stability. On hard math problems, there were still cases of long deduction that converged on a wrong answer, and on some problems the model fell into a loop of repeated self-checking. The engineering response is to set budget guardrails:
- Cap the maximum number of reasoning steps or the maximum token budget;
- Set a timeout that interrupts execution and returns the best intermediate conclusion available;
- Sample the same problem multiple times and judge by consistency rather than by a single result.
5. The Unexpected: Overthinking and Non-Linear Cost on Lightweight Tasks
The most counter-intuitive behavior showed up on simple tasks. For common-sense questions with an extremely clear definition, the more capable version sometimes introduced unnecessary complex assumptions and questioned itself repeatedly, drifting away from the obvious answer, while the lighter version, with a shorter path, returned the correct result directly.
This points to an important selection principle: model capability is not monotonically “the stronger the better” and should be matched to task complexity. For simple classification, format conversion, and field extraction, a lightweight model is often faster, more stable, and cheaper.
The cost side held a surprise as well. Compared with the previous generation, the new generation’s API pricing was raised somewhat, but in long tasks, because the context prefix is reused repeatedly, the caching mechanism significantly reduced billing for the repeated portion, so the final bill grew noticeably less than call volume did. It can be roughly understood as:
Total cost ≈ new content tokens × unit price + reused prefix tokens × discounted unit price
So the focus of cost optimization for long tasks is not fewer calls but a higher prefix reuse rate: keep the system prompt, project conventions, and API documentation in stable positions and avoid frequent changes that invalidate the cache.
6. An Actionable Engineering Checklist
- Task tiering: split tasks into lightweight, standard, and long-horizon tiers by complexity, and match each tier to a different model size;
- Plan first: require the model to produce the module breakdown and acceptance checklist before coding;
- Structured feedback: normalize compile and test results into fixed fields to improve correction efficiency;
- Budget guardrails: set triple limits on steps, duration, and tokens for both reasoning and execution;
- Context governance: keep the prefix stable and append incrementally to maximize cache hits;
- Consistency-based evaluation: run the same task multiple times and evaluate by pass rate rather than a single result;
- Observability: use logging services and monitoring alerts to record per-stage latency and failure reasons for each task.
7. Conclusion
The core conclusion from the tens-of-millions-of-tokens test can be compressed into one sentence: long-horizon agent capability has crossed the “usable” threshold, but stability and cost structure still need engineering backstops. For a team, the real competitive edge is not whether it uses the strongest model, but whether it has built a system of task tiering, budget guardrails, and observable evaluation. If a unified model access and operations pipeline has already been built on a platform such as Baidu AI Cloud, the practices above can be consolidated directly into reusable evaluation and scheduling standards.
