Long-程 AI Agent Testing at 10 Million Tokens: Key Observations

    This article shares hands-on observations from running long-horizon AI agents past 10 million tokens, covering autonomous planning, self-correction, reasoning stability, overthinking on simple tasks, and cost control through context caching. It offers practical engineering guidance on validation checklists, step limits, model routing, and observability for teams deploying large language model agents.

    1. Why Run a 10-Million-Token Test?

    Small-sample evaluations only show whether a model can perform a task. They do not show whether it can keep performing correctly across long cycles and multiple tool calls. Once token consumption reaches the millions, the issues that surface are rarely about a single capability. They are about stability, cost structure, and the engineering around the model.

    This observation covered two workloads: long-horizon agentic coding, and complex reasoning compared against lightweight tasks. The findings come down to three positive changes and one unexpected weakness.

    2. Observation 1: Long-Horizon Tasks Show Autonomous Planning and Self-Correction

    In an open-ended database design task, the prompt deliberately avoided strict constraints and only described the business goal. The model first produced a design: 8 core functional modules and 6 data tables covering bookkeeping and transaction statistics. It then broke the development work into steps on its own and produced a 10-item verification checklist, folding “self-test after development” into the plan.

    Left to run, the model coded autonomously for nearly 60 minutes with no interruptions, no infinite loops, and no missing critical steps. The frontend was unremarkable, but the core functionality worked. This suggests the key to long-horizon capability is not single-step accuracy but three things:

    • Executable plans: work is decomposed into sub-goals with dependency ordering.
    • Closed-loop tool use: read and write files, run commands, inspect errors, then revise.
    • Recoverable errors: a failure does not end the flow; the agent falls back to the previous step and retries.

    In practice, make the verification checklist explicit, for example:

    1. Acceptance items:
    2. 1. Table structures and field types match the design
    3. 2. All CRUD endpoints are functional
    4. 3. Statistical calculations match manual verification
    5. 4. Invalid input produces clear errors

    3. Observation 2: Complex Reasoning Has Strengths, but Stability Needs Work

    The model performed well on situational reasoning questions and could pick up on implicit premises. However, on high-difficulty math problems and some lightweight tests, it fell into infinite loops or reached wrong conclusions. The usual causes are an overly large search space and a lack of intermediate checks, which lead the model to repeatedly justify itself on a wrong branch.

    Practical recommendations:

    • Set a “max steps / max retries” circuit breaker for hard reasoning tasks.
    • Require verifiable intermediate conclusions before the final answer.
    • Cross-check with external computation or unit tests rather than letting the model grade itself.

    4. Observation 3: Lightweight Tasks Can Trigger “Overthinking”

    On a simple question, the more capable version sometimes took a detour, over-complicated the conditions, and got the answer wrong. The lightweight version was more direct and was both faster and more accurate. The takeaway: model size should match task complexity.

    A routing strategy to consider:

    1. if task is simple classification or short text extraction:
    2. use a lightweight model
    3. elif multi-step tool calls or long context are required:
    4. use a high-capability model + planning and verification

    5. The Unexpected Part: Higher Unit Prices, but Caching Makes the Total Bill More Manageable

    Long tasks repeatedly bill for repeated system prompts, code context, and history fragments. Services with context caching can significantly reduce the cost of repeated input, so the total bill grows less than the unit price. Recommendations:

    • Put stable prefixes (specifications, interface conventions) first and variable content last.
    • Persist intermediate outputs in segments to avoid replaying everything.
    • Use logging services and monitoring alerts to track tokens and cache hits, and account for cost per task.

    6. Implementation Checklist

    1. Start with small samples, then move to long-horizon runs, with step and time limits.
    2. Separate planning, execution, and verification, and automate verification.
    3. Route simple tasks to the lightweight path and complex tasks to the high-capability path.
    4. Control cost with caching and context governance, and keep reviewing with an observability system.

    The value of 10 million tokens is not a score. It is turning “usable” into “predictably usable.”