Long-程 AI Agent Benchmark at 10 Million Tokens: Key Findings and Engineering Lessons

    This article reports on a hands-on benchmark of long-horizon AI agents that consumed tens of millions of tokens across three workload types: long-horizon agentic coding, complex logical reasoning, and lightweight everyday Q&A. It summarizes what held up and what broke, including a full task loop in agentic coding, reasoning failures such as infinite loops and overthinking, and a counterintuitive case where a lighter model outperformed a stronger one on simple tasks. It also explains why context caching kept the total bill manageable despite higher token prices, and closes with a reusable evaluation and deployment checklist covering layered test sets, stop conditions, external plan management, budget constraints, and model routing. The methods described apply to agent engineering built on general-purpose cloud products, including those on Baidu AI Cloud.

    1. Why Benchmark at the 10 Million Token Scale

    Single-turn Q&A evaluations only capture how a model performs in short interactions with single-step reasoning. Real-world AI agent workloads are different: the model operates across dozens of tool calls, hundreds of file reads and writes, and continuous unattended execution lasting tens of minutes or even hours. These workloads have three distinct characteristics:

    • Context keeps expanding as historical messages and tool results accumulate.
    • Failures do not happen once; they compound along an error path.
    • Cost is determined by input tokens, output tokens, and repeatedly read context combined.

    Only by pushing consumption into the tens-of-millions-of-tokens range can you observe a model’s stability, self-correction ability, and real billing structure on long-horizon tasks. This benchmark covered three workload types—long-horizon agentic coding, complex logical reasoning, and lightweight everyday Q&A—while recording token consumption and call-chain characteristics.

    2. Finding 1: Long-Horizon Agentic Coding Has Matured Significantly

    Given only a goal and no detailed constraints, the model demonstrated a complete task loop. Its typical behavior chain was as follows:

    1. Requirement clarification and solution design: It first produced a module breakdown and database schema. For an accounting system, it delivered an initial design of 8 functional modules and 6 data tables, covering core scenarios such as bookkeeping and transaction statistics.
    2. Execution plan and acceptance checklist: It proactively broke down development steps and listed about 10 self-verification items, forming a develop-then-self-test loop.
    3. Extended autonomous execution: It coded continuously for nearly 60 minutes without interruption, infinite loops, or missing key steps.
    4. Result usability: Core features ran successfully, and inserting test data produced no errors. The UI was only average in appearance, indicating the model is currently better at functional correctness than visual design.

    Engineering takeaway: The key to long-horizon tasks is not whether the model writes everything correctly on the first attempt, but whether it can maintain a stable plan and continuously align with it during execution. In practice, externalize the plan as a task checklist file that the model reads and updates each round; this significantly reduces long-horizon drift.

    1. plan.md # modules, data tables, acceptance items
    2. progress.json # completed / in progress / blocked
    3. verify.sh # one-click self-verification script

    3. Finding 2: Complex Reasoning Shows Both Strengths and Breakpoints

    On logical reasoning problems, the model performed well, handling multi-round conditional constraints and implicit premises. However, on high-difficulty math problems and some lightweight tests, two typical failures appeared:

    • Infinite loops: repeatedly verifying the same branch without converging on a conclusion.
    • Overthinking: introducing unnecessary assumptions on simple problems and drifting away from the correct answer.

    Engineering takeaway: Reasoning stability requires external constraints. A dual mechanism of budget plus reflection works well: cap the maximum number of reasoning rounds and the token budget, and require the model to output its current best answer and points of uncertainty when the limit is exceeded, rather than continuing to dig deeper.

    1. def bounded_solve(prompt, max_rounds=3, max_tokens=8000):
    2. state = {"round": 0, "answer": None}
    3. while state["round"] < max_rounds:
    4. out = call_model(prompt, state)
    5. if out.confident:
    6. return out.answer
    7. state["round"] += 1
    8. return {"answer": state["answer"], "uncertain": out.open_questions}

    4. Finding 3: Overthinking on Lightweight Tasks and Model Tiering

    A counterintuitive observation: on extremely simple problems, a more capable model version was sometimes less direct and efficient than a lighter version. The reason is that stronger models tend to expand longer reasoning chains and overcomplicate simple problems, while lighter versions deliver usable answers faster.

    Practical recommendation: build a routing layer that dispatches by task complexity:

    • Simple Q&A, format conversion, field extraction → lightweight model.
    • Multi-step tool calls, code generation and refactoring → strong reasoning model.
    • High-risk decisions → strong model + rule validation + human review.

    5. Unexpected Finding: Prices Rose, but Caching Kept the Total Bill Moderate

    In long-horizon tasks, a large amount of context is read repeatedly (the same requirements, the same set of files, the same specification). The context caching mechanism widely adopted in the industry reduces the billing weight for repeated prefix portions, so the total bill grows much less than the unit price increase. Optimization measures include:

    • Stable prefix: place unchanged system prompts and specification documents at the very front of the context.
    • Append rather than rewrite: avoid frequently reordering historical messages, which invalidates the cache.
    • Persist results to disk: write large tool outputs to files and return only summaries and paths.
    • Observability first: use logging services and monitoring alerts to track token distribution per task and locate abnormal consumption.

    6. A Reusable Evaluation and Deployment Checklist

    • Layer the evaluation set: allocate proportions to long-horizon tasks, complex reasoning, and lightweight tasks.
    • Track three metrics: success rate, number of human interventions, and token cost per task.
    • Set stop conditions for models to prevent infinite reasoning.
    • Put key artifacts under version control for rollback and auditing.
    • Use container platforms and object storage to host the runtime environment and artifacts, ensuring reproducibility.

    Overall conclusion: Long-horizon agent capabilities are now usable as productivity tools, but they need external plan management, budget constraints, and model routing to fill stability gaps. On the cost side, caching-friendly design and full-chain observability make spending controllable. These methods also apply to agent engineering systems built on general-purpose cloud products, including those on Baidu AI Cloud.