AI Agent Coding at Ten-Million-Token Scale: Capabilities, Limits, and Engineering Practices

    This article examines what ten-million-token AI agent coding sessions reveal about long-horizon task execution, autonomous repair, state management, verification, cost control, and evaluation. It argues that the key question is not how long an agent can run, but whether tasks are truly completed, supported by evidence, and safely stopped when failures occur.

    I. From “the model can write code” to “the system can deliver tasks”

    When coding models can continuously call tools, modify files, run tests, and keep fixing errors, evaluation shifts from single response quality to stable task completion.

    The source material describes a usage process consuming over ten million tokens, including nearly one hour of unattended coding and tasks such as complex logic puzzles, math problems, and everyday common-sense questions. These observations point to three capability directions: long-horizon task planning, feedback-driven autonomous repair, and cost optimization from repeated context. A counterintuitive question also appears: systems that invest more reasoning may not be more reliable on some simple tasks.

    However, high token consumption does not mean sufficient evaluation. Ten million tokens may be concentrated in a few engineering tasks, or include repeated inputs, tool outputs, and failed retries. Without task distribution, repetition counts, runtime configuration, and acceptance records, universal performance conclusions cannot be drawn.

    A more useful approach is to turn these phenomena into general engineering questions: how to design agents that can execute sustainably, how to determine whether work is truly done, and how to control failure risk and resource consumption.

    II. Core of long-horizon autonomous coding: planning, state, and feedback

    Agentic coding is not about generating all code in one shot. It is an iterative execution loop:

    Understand the goal → decompose tasks → call tools → inspect results → update state → continue.

    How long this loop can run depends not only on model capability but also on tool environment, context management, permission configuration, and verification mechanisms. System performance should not be attributed entirely to the model.

    1. Turn vague requirements into acceptance-ready goals

    Take a bookkeeping system as an example. “Build a complete system” lacks clear boundaries. Reliable planning should first confirm number of users, account types, currency requirements, report granularity, permission scope, and data recovery needs.

    If the user cannot provide more information immediately, the agent may adopt reasonable assumptions, but it must record them. For example, the first version may support only a single user and single currency, without complex settlement across multiple accounts. This keeps development moving while preventing default assumptions from becoming hidden defects later.

    Planning outputs should include deliverables and acceptance criteria, not just a feature list. For example:

    Account management: create and disable accounts, and display balances correctly.

    Income and expense records: add, modify, and query transactions, with traceable modifications.

    Reports: aggregate by time and category, with results consistent with underlying transactions.

    Exception handling: invalid amounts, missing categories, and duplicate submissions do not corrupt data.

    These criteria turn “looks finished” into “can be verified as finished.”

    1. Use persistent state to reduce drift in long tasks

    Long tasks are prone to goal forgetting, repeated modifications, and skipped verification. Relying only on conversation history is not stable.

    In practice, maintain task lists, design decision records, and verification logs. Each stage should state:

    What the current goal is;

    What has been completed;

    What known defects remain;

    What conditions the next step depends on;

    Which decisions require human confirmation.

    Such state records should be concise, structured, and synchronized with actual code and test results. If records only express the model’s judgment without corresponding evidence, incorrect conclusions may be locked into later workflows.

    1. Turn tool feedback into valid evidence

    Successful compilation only shows that code passed specific checks; it does not prove business correctness. Passing tests only cover the tests that were written.

    Therefore, feedback should be layered: syntax checks locate basic errors, unit tests verify local logic, integration tests check component interaction, and business acceptance confirms final behavior. For database changes, constraints, migration processes, and rollback paths should also be checked.

    Working continuously for nearly one hour may show some continuity in the execution chain, but it alone cannot prove production readiness. True delivery quality requires defects, test coverage, amount of human revision, and operational risk.

    III. Bookkeeping system practice: data design before UI stacking

    Database tasks are suitable for evaluating agents because they involve requirement understanding, structural design, business constraints, and verification.

    1. Number of tables is not a design-quality metric

    The engineering plan in the source material includes multiple functional modules and data tables, but “how many tables were designed” has limited evaluative meaning.

    A basic bookkeeping system can organize data around accounts, transactions, categories, budgets, and operation logs. Whether separate entities for tags, attachments, or recurring tasks are needed should be decided by actual business needs. Over-splitting increases query and maintenance complexity; over-merging may cause redundancy and missing constraints.

    The key is to identify business invariants, such as:

    Every transaction must be linked to a valid account;

    Amounts and currencies must follow explicit rules;

    Account balance changes must remain consistent with transactions;

    Historical categories used in reports should not be deleted arbitrarily;

    Duplicate submissions of the same business request should not create duplicate transactions.

    These rules reflect design quality more than table names or field counts.

    1. Amounts, time, and consistency need explicit conventions

    Amounts should generally use fixed-point numbers, or integers representing the smallest currency unit after currency and precision rules are defined, to avoid binary floating-point errors entering accounting calculations.

    Time fields should distinguish business occurrence time from system write time. For cross-time-zone reporting, storage strategy should be unified, and reports should specify which business time zone is used.

    When writing transactions and updating balances, transaction boundaries must be clear. If the system dynamically calculates balances from transactions, query cost must be evaluated. If summary balance values are maintained, consistency between summaries and details must be handled. Each approach has suitable conditions; there is no single answer independent of business scale.

    1. Verification should cover “what happens after failure”

    In addition to normal entry and queries, tests should cover duplicate requests, concurrent writes, cross-month reporting, transaction rollback, and historical data migration.

    For example, simulate a case where a transaction is written but the balance update fails, and check whether the system rolls back the entire operation. Simulate a retried request and check whether duplicate records are created.

    Such tests reveal whether the agent truly understands system behavior, rather than merely generating runnable pages and APIs.

    IV. Strengths and weaknesses in complex reasoning: do not mix evaluation standards

    Logic puzzles, math proofs, and everyday decisions may all seem like “reasoning,” but they require different capabilities and verification methods.

    Open-ended logic problems rely more on hypothesis generation, information clarification, and constraint updating. Strict math problems require valid derivation chains; any missing condition can invalidate the conclusion. Common-sense questions usually require quickly identifying the real intent and avoiding irrelevant assumptions.

    Therefore, good performance on one type of logic problem does not directly imply equal stability in math proofs or daily decision-making.

    1. Add external verification for complex problems

    Engineering calculations can be checked with independent computation; code behavior can be verified through tests; proof-like tasks should check premises, applicability, and logical connections at each step.

    Repeated sampling can reveal inconsistent answers, but agreement among multiple answers is not proof of correctness, because different attempts may share the same error. External verification should use evidence sources different from the original generation process.

    1. Establish exit mechanisms for repeated failures

    Repeated attempts may appear as repeatedly modifying the same code, switching among similar hypotheses, or running tests that provide no new information.

    Agent systems should set budgets for time, tokens, tool calls, and retries. More importantly, they should monitor progress: whether errors decrease, test status improves, or new valid evidence appears.

    When consecutive attempts show no substantial progress, the system should pause the current strategy, narrow the problem scope, restore a checkpoint, or request human intervention. Stop conditions are part of reliability design, not a denial of autonomy.

    V. Unexpected lightweight-task failures: over-reasoning can obscure direct constraints

    For some simple problems, the key is not to search more possibilities but to identify one decisive condition.

    For example, if a user plans to go to a nearby car wash and is choosing transportation, the first consideration should be that the vehicle must arrive, rather than judging only whether walking is convenient based on distance. If the system spends extensive analysis on distance, health, and parking costs but misses the task purpose, even a long answer does not solve the problem.

    Such failures should not be attributed to “overthinking” based on a single case. Prompt ambiguity, context interference, output randomness, and task misidentification may all contribute.

    A more reliable practice is:

    First extract the user’s goal and hard constraints;

    Answer directly when information is sufficient;

    Ask a brief clarification when decisive information is missing;

    Increase reasoning investment only when there are multi-step dependencies or clear risks.

    Task routing should also be based on actual testing, not a simple rule such as “short questions use lightweight models and long questions use high-capability models.” A short question may involve major safety risks, while a long text may be a mechanical organizing task.

    VI. Caching and cost: focus on complete delivery, not single-call price

    The total cost of agent tasks comes not only from code generation but also from repeated input context, reading tool outputs, running tests, failed retries, and human review.

    In services that support input caching and meet the relevant rules, repeated context may be billed differently. Conceptually:

    Total token cost = cost of input tokens not served from cache + cost of input tokens served from cache + output cost.

    Whether caching actually applies depends on service rules, content consistency, cache lifetime, and request organization. Repeated content does not automatically receive a discount. Reducing the billing cost of repeated input also does not mean longer context is better; irrelevant history can still affect judgment and consume effective context space.

    For enterprise applications, tool execution, storage, runtime environment, and human processing costs should also be included. A more meaningful metric is:

    Average cost per accepted task = total cost of all attempts ÷ number of tasks that pass acceptance.

    This metric prevents focusing only on cheap single calls while ignoring many failed retries. Completion time and amount of human revision should also be reported to avoid obtaining a lower bill by sacrificing efficiency or quality.

    VII. Build a reusable evaluation and launch framework

    To turn scattered experiences into technical decision evidence, use the following process.

    Step 1: Build a layered task set. Cover common-sense Q&A, structured output, local code modification, multi-module development, strict reasoning, and fault repair. Each category should have clear acceptance criteria.

    Step 2: Fix runtime conditions. Record prompts, tool permissions, context content, runtime configuration, budgets, and test environments so results are comparable.

    Step 3: Run repeated evaluations. Avoid showing only the most successful run. Record failure modes and result variance. When samples are small, state the scope of conclusions.

    Step 4: Preserve process evidence. Collect code changes, tool calls, test logs, state records, and reasons for human intervention so claims of “autonomous completion” can be audited.

    Step 5: Set safety boundaries. Development should preferably occur in isolated environments with least privilege. Operations such as deleting data, modifying critical configurations, and executing irreversible migrations should require human approval and recovery plans. Tool outputs, project files, and external documents should be treated as untrusted input; instructions within them must not be allowed to escalate privileges on their own.

    Step 6: Route based on quality and cost. Simple tasks should prefer low-latency paths, complex tasks should receive sufficient verification budgets, and high-risk tasks should retain human review. Routing rules should be adjusted continuously based on real business results.

    Conclusion

    The main lesson from ten-million-token investment is not how long a system can “work continuously,” but that agentic coding is turning model calls into an engineering process that requires state management, result verification, and risk control.

    Long-horizon planning, autonomous correction, and cache utilization do have practical value, but they all require verifiable boundaries. Failures on simple tasks remind us that resource investment and answer quality are not linearly related.

    Reliable deployment should always return to three questions: Is the task truly completed? Is the result supported by evidence? Can failures be stopped in time and recovered safely? Building systems around these standards is more meaningful than pursuing longer reasoning or larger token consumption.