Agent Coding at 10M Tokens: Long-Horizon Planning, Reasoning Stability, and Cost Lessons

    A ten-million-token agentic-coding test across open-ended database design, accounting-system implementation, reasoning tasks, and simple business Q&A reveals reusable patterns: long-horizon success depends on a planning-execution-acceptance loop; complex reasoning remains nonlinear and requires validation; caching can partly offset higher token prices; and lightweight tasks can suffer from overthinking. The article summarizes engineering practices for task contracts, acceptance criteria, observability, routing, and budget control.

    As agentic coding moves from code completion toward goal-driven execution, a model’s engineering value increasingly depends on whether it can decompose tasks, call tools, keep executing, and complete acceptance checks autonomously. This article is not a product recommendation or a review of a specific model. Instead, it distills a ten-million-token test into general capability observations: what reusable patterns emerge between high-performance and lightweight tiers of general-purpose models in agentic coding, complex reasoning, lightweight tasks, and cost structure?

    For the test method, we used open-ended database design and accounting-system implementation as long-horizon tasks, with logic puzzles, high-difficulty math problems, and simple business Q&A as controls. The observed metrics included planning completeness, execution continuity, error recovery, acceptance-checklist coverage, output accuracy, and billing changes at the ten-million-token scale. Note that the conclusions below apply only to the test configuration and task set; they do not represent how all models will perform in all scenarios.

    1. Long-Horizon Autonomous Coding: The Surprise Is the Planning-Execution-Acceptance Loop

    Long-horizon tasks best expose differences in agentic capability. In one open-ended database-design task, the prompt provided few constraints, so the model had to determine functional modules, table structures, development order, and validation methods on its own. The high-performance tier produced a relatively complete design covering core modules such as accounts, transactions, categories, and statistics, and it planned the development process and acceptance items. It then continued executing without intervention for nearly an hour, with no obvious interruption or infinite loop, and generally advanced according to the earlier plan.

    The core system functions could run, adding new data did not produce errors, and CRUD operations for categories and transactions formed a closed loop. The main weaknesses were front-end aesthetics and interaction details. This suggests that the key to long-horizon agentic coding is not just single-point code generation, but the combined ability to maintain state, call tools, recover from errors, and close the acceptance loop. From an engineering perspective, the task contract can be written as structured input, for example:

    1. task_spec = {
    2. goal: "build an accounting system",
    3. modules: ["accounts", "transactions", "categories", "statistics", "settings"],
    4. tables: ["users", "accounts", "transactions", "categories", "budgets", "logs"],
    5. milestones: ["design", "table creation", "APIs", "pages", "acceptance"],
    6. acceptance: ["adding transactions does not throw errors", "categories can be added, deleted, and edited", "statistics are consistent"]
    7. }

    For teams, a more reliable approach is to give the agent milestones, maximum execution steps, observable logs, and rollback points. Open-ended tasks can be delegated, but acceptance criteria must be defined in advance; otherwise, “it runs” does not mean “it is deliverable.”

    2. Complex Reasoning: Strengths and Stability Risks Coexist

    Complex reasoning showed clear nonlinearity. The model performed relatively well on logic puzzles that required multi-step constraint propagation, gradually eliminating conditions and providing a reasonable explanation. However, on high-difficulty math problems or some limit tasks, it could still spend a long time wandering, fall into loops, or produce incorrect answers. This indicates that reasoning ability does not simply scale linearly with task length; stability is closely related to task structure, prompt constraints, and validation mechanisms.

    In engineering practice, high-difficulty reasoning should not be left entirely to a single generation. More robust strategies include setting maximum reasoning steps and timeouts; introducing external validation or a rule engine for key conclusions; using multiple solution paths and consistency checks; and splitting large problems into verifiable subproblems. For deterministic business rules, rule-based computation should be preferred, with the model explaining the result rather than bearing the entire calculation alone.

    3. Cost Structure: Higher Unit Prices Are Partly Offset by Caching

    At the ten-million-token scale, cost is unavoidable. In the test, the per-token list price was higher than the previous generation, but long tasks contain a large amount of repeated context, and caching can reuse stable prefixes, so total bill growth was less pronounced than the unit-price increase. This suggests that cost optimization for agentic applications cannot focus only on unit price; it must also consider how context is organized.

    Actionable methods include placing stable content such as system prompts, tool descriptions, and fixed specifications in the prefix to improve cache reuse; splitting long tasks into phases to reduce repeated carrying of invalid context; monitoring cache hit rate, token consumption per task, and budget thresholds; and routing by task value, using the high-performance tier for high-value complex tasks and the lightweight tier for simple tasks. Caching is not “free,” but reasonable context layering can significantly improve the cost curve for long tasks.

    4. Unexpected Finding: Lightweight Tasks Can Also Trigger “Overthinking”

    The most notable surprise in this test was that the high-performance tier could fail to give a direct answer on simple questions because it expanded the analysis too much. For example, in simple business Q&A, the lightweight tier tended to give a conclusion quickly, while the high-performance tier could repeatedly analyze edge conditions, producing verbose output or even drifting from user intent. This is not a lack of model capability, but a mismatch between reasoning budget and task complexity.

    The solution is task tiering and prompt constraints: first use rules or a lightweight classifier to judge question complexity; route simple questions to the lightweight tier and require “conclusion first, followed by a one-sentence rationale”; route complex questions to the high-performance tier and allow extended reasoning. At the same time, set maximum reasoning steps, output-format constraints, and timeout fallback. For product teams, defaulting to the strongest model does not necessarily provide the best experience; routing strategy is often more important than single-model capability.

    5. Engineering Recommendations

    Overall, the usability of agentic coding depends on four things: whether the task contract is clear, whether the acceptance checklist is executable, whether the execution process is observable, and whether cost is controllable. Teams should establish a closed loop of “task tiering—prompt constraints—process monitoring—result acceptance”: give long-horizon tasks planning and milestones, give complex reasoning validation and timeouts, give lightweight tasks a concise mode, and give the cost side cache reuse and budget alerts. Only by placing model capabilities within engineering constraints can a ten-million-token investment turn into stable productivity rather than uncontrollable trial-and-error cost.