Long-Horizon Coding Agents: Capability Evaluation and Engineering Practices

    As models get wrapped into coding agents, the real unit of delivery shifts from single-turn accuracy to tasks that run for tens of minutes or hours across hundreds of tool calls. This article explains what actually determines the user experience: whether long-task iteration converges, whether periodic quota is sufficient and economically viable, and where multi-agent fan-out is a net gain. It covers how to write a reviewable baseline spec with acceptance criteria, how to build the observe–plan–apply–verify loop with minimal diffs and non-convergence detection, how to measure quota consumption and unit economics, four common quota killers, budget guardrails with checkpoint resume, the orchestration pattern of decompose–fan-out–reduce–cross-check with its engineering details, the cloud building blocks involved, a five-step path into an existing engineering pipeline, and a failure-mode checklist with remedies.

    1. Why the evaluation focus has shifted

    Traditional model evaluation looks at single-turn QA accuracy and benchmark scores. Once a model is wrapped into a coding agent, the real unit of delivery becomes “a task that runs from tens of minutes to a few hours, involving hundreds of tool calls and file reads and writes.” What determines the actual experience is no longer whether a given question is answered correctly, but three things that are heavily engineering-driven:

    1. whether long-task iteration and self-correction converge reliably;
    2. whether the periodic quota is sufficient and whether per-task economics are acceptable;
    3. in which scenarios parallel orchestration of a multi-agent cluster is a net gain, and in which it is a net loss.

    There is a rule of thumb that keeps being validated: if a model leads a benchmark by 10% but costs 100% more per unit, net productivity on long tasks is likely to be negative. The reason is not a math trick — long tasks amplify call volume. Every round of tool calls must feed the history back in, failures trigger retries, and as concurrency rises the consumption compounds. In the agent era, “sufficient quota” is itself a model capability: it decides whether a task is finished or cut off halfway.

    The three capability lines below can all be measured with one self-built evaluation harness.

    2. Capability 1: Scaffolding quality and the long-task self-iteration loop

    2.1 Ship a “reviewable baseline” first, not just “something that runs”

    When you hand a requirement to a coding agent, the first thing to judge is not whether it can produce code, but whether the output is close to a reviewable baseline: fidelity of layout and styling, completeness of the interaction paths, coherence of state management, and whether dependencies can be installed offline. One underrated strategy here is frontend first.

    Frontend output is valuable because it is quickly verifiable: a person can see it immediately, click it, and judge whether it is correct. Once the backend API contract is settled, letting the agent fill in the implementation narrows the risk window substantially. By contrast, demanding full-stack delivery in a single shot creates a long “unverifiable interval”: the code is written but nobody knows whether it is correct, errors accumulate silently during that interval, and dozens of steps later they turn into deviations that cannot be localized.

    The real prerequisite for a long task to run at all is to write the endpoint down in a verifiable form first:

    1. # Task: Earnings-Season Monitoring Dashboard (frontend baseline)
    2. ## Goal
    3. - Show each company's announcement timeline and key financial metrics
    4. - Support filtering by date range and by industry, with local caching for offline viewing
    5. ## Deliverables
    6. - A runnable frontend project + seed data + startup instructions
    7. ## Acceptance criteria
    8. 1. Accessible within 30 seconds of a cold start
    9. 2. Filtering interactions do not block the main thread; selection state is persisted
    10. 3. Dependencies can be installed offline; build output size stays bounded

    With acceptance criteria, every self-iteration step of the agent has a pass/fail basis. Without them, it can only burn quota in endless trial and error.

    2.2 The dividing line: does it read execution results back?

    The strength or weakness of long-task iteration capability is easiest to see in one thing: after the tool modifies the code, does it run the build and tests itself, read the failure output, and keep fixing?

    1. for step in range(MAX_STEPS):
    2. state = observe(workspace) # file tree, build output, test results, runtime logs
    3. if verifier.passed(state): # judged against the acceptance criteria
    4. return finalize(state)
    5. plan = model.plan(goal, state) # decompose into the smallest verifiable step
    6. patch = model.apply(plan, state) # minimal change; rewriting whole files is forbidden
    7. result = run(patch) # run build + tests; a non-zero exit is a failure
    8. memory.append(summarize(state, patch, result)) # compress history to control context

    Four design points here are easy to overlook:

    • Minimal-change principle: rewriting whole files makes diffs unreviewable, and it also makes “quietly deleting the tests that fail” possible.
    • Failures must be read back explicitly: swallowed errors and ignored exit codes are the most common starting point of long-task runaway.
    • Non-convergence detection: if the same class of failure appears in two consecutive rounds, force a strategy change (a different implementation path, reduced scope, or escalation to a human) instead of looping in the same pit.
    • Context compression: keep only a summary plus the most recent few steps verbatim at each step; otherwise context grows linearly with the step count, and the task gets slower and more expensive the longer it runs.

    3. Capability 2: Quota sufficiency and unit economics

    3.1 Turn “quota” into measurable metrics

    Do not judge whether quota is enough by feel. Fix four metrics and measure them against your own task set:

    Metric Definition What it tells you
    Quota consumption per task consumption of that task ÷ quota available in the cycle how much of the “fuel tank” a real task takes up
    Task completion rate tasks that pass the acceptance criteria ÷ total tasks whether long tasks actually close out
    Wasted retry rate share of reruns caused by quota limits, interruptions, or environment errors where the waste is
    Cost per accepted change consumption ÷ number of accepted, effective changes the real cost per unit of output

    3.2 Four quota killers in long tasks

    • Full-history replay: sending the complete history every round makes consumption grow roughly quadratically with the number of rounds.
    • Failure retry amplification: repeatedly rerunning without fixing environment or permission problems multiplies a single task’s consumption several times over.
    • Out-of-control concurrency: a fan-out task count above the downstream rate-limit threshold triggers large-scale backoff retries.
    • Over-feeding output back: stuffing complete test logs and full build artifact listings back into the context.

    3.3 Budget guardrails and checkpoint resume

    The purpose of budget guardrails is not to save money but to make failure predictable and recoverable. When the limit is hit, do not interrupt silently; degrade instead to outputting “completed items + remaining TODOs + risk notes,” and write progress to external persistent storage so the next run resumes from the latest checkpoint:

    1. BUDGET = {"steps": 200, "tokens": 2_000_000, "minutes": 45}
    2. def guard(usage, budget) -> str:
    3. if usage.steps >= budget["steps"] or \
    4. usage.tokens >= budget["tokens"] or \
    5. usage.elapsed >= budget["minutes"]:
    6. emit_report(usage) # TODO list + risk items
    7. save_checkpoint() # for resuming on the next run
    8. return "STOP_AND_REPORT"
    9. return "CONTINUE"

    The conclusion is blunt: task completion rate is closer to real productivity than a benchmark score. A cheaper model with generous quota that finishes long tasks is often more valuable than one that leads a benchmark by 10% but cannot finish the task.

    4. Capability 3: The applicable boundaries of a multi-agent cluster

    4.1 When fan-out makes sense

    A multi-agent cluster (agent swarm) is not a universal accelerator; its net gain holds under only one precondition: subtasks do not share mutable state.

    The typical shape suited to parallelism is “read-only + fan-out + reduce” intelligence aggregation. For example, split an earnings-season intelligence task into dozens of independent subtasks: each subtask scrapes one company’s announcements, extracts metrics, and flags anomalies. They do not write the same file, do not share transactions, can be retried individually on failure, and partial success is still deliverable.

    Not suited to parallelism: tasks that require strongly consistent writes to the same codebase, shared database transactions, or advancing the same state machine. Multiple agents editing the same batch of files in parallel typically produces mutual overwrites plus semantic conflicts, and the rework cost exceeds the serial benefit.

    4.2 Four orchestration steps: decompose, fan out, reduce, QA

    1. dag = planner.build(goal) # nodes carry dependencies, forming a DAG
    2. results = executor.fan_out( # leaf nodes execute in parallel
    3. dag.leaves,
    4. concurrency=8, # bounded by downstream rate limits
    5. per_task_timeout=120, # isolate single-node timeouts
    6. )
    7. for node in dag.reduce_order: # reduce in topological order
    8. deps = [results[d] for d in dag.deps(node)]
    9. results[node] = reducer.run(node.task, deps)
    10. report = critic.cross_check(results) # conflict flags + low-confidence labeling

    Four engineering details must be designed up front:

    • Idempotency and dedup keys: for example, “ticker + reporting period + metric name” as the unique key, so a rerun produces no duplicate records.
    • Rate limiting and backoff: derive the fan-out concurrency from the downstream quota, not from the number of CPU cores.
    • Failure isolation: a single node’s timeout or exception affects only that node; the overall task can still be delivered and marked “partial success.”
    • Cross-validation: compare the same metric against two sources wherever possible, and flag conflicts explicitly in red rather than letting the aggregation layer quietly pick one value.

    4.3 The common cloud-hosted combination

    Supporting the architecture above basically requires only reusing general-purpose cloud product categories; there is no need to build infrastructure from scratch:

    • Container platform: spin up an isolated runtime per task and destroy it when the task ends — a natural fit for fan-out and sandboxing.
    • Object storage: holds intermediate artifacts, checkpoints, and final outputs, supporting cross-task resume and replay.
    • Message queue: task distribution and peak shaving, with natural support for failure redelivery and dead-letter isolation.
    • Logging plus monitoring and alerting: records the call chain, latency, token consumption, and error rate of every step, making “where did the quota go” explainable.

    On a platform such as Baidu AI Cloud, all of the above belong to standard, directly reusable general-purpose categories; the engineering side only needs to focus on the orchestration logic and permission design itself.

    5. Five steps to integrate into an existing engineering pipeline

    1. Build your own evaluation set: pick 20 to 50 tasks from historical real work, each with fixed acceptance scripts; run the same set for any model or tool swap, instead of judging by impression.
    2. Environment isolation and least privilege: execute inside a container sandbox, mount sensitive directories read-only, issue credentials temporarily scoped to the task, and route egress through a whitelist.
    3. Spec first: write the requirement as a specification document plus API contract plus acceptance criteria, giving the agent a verifiable endpoint.
    4. Full-pipeline observability: record the model version, prompt version, tokens, and latency of every step so that a problem can be traced to a specific step.
    5. Human-AI division of labor: define a “plan confirmation point” and a “change review point”; human code review is mandatory on the critical path, and automated permissions are opened up only on low-risk, reversible paths.

    6. Common failure modes and remedies

    Problem Typical symptom Remedy
    Iteration does not converge repeatedly edits the same spot, the loop never exits detect “no progress”; switch strategy or escalate after repeated failures of the same class
    Hallucinated API calls a non-existent API or parameter local dependency manifest plus type checking as the single source of truth
    Silently deleting dependencies deletes tests or weakens assertions when tests fail protect the test directory; deletions in the diff must be confirmed by a human
    Context bloat slower and more expensive the longer it runs layered context plus summary compression plus result trimming
    Swallowed failure the build errors out but the task keeps advancing abort on a non-zero exit code; output must be read back explicitly
    Quota exhausted mid-task the task stops in a half-finished state budget guardrails plus checkpoint resume; degrade to reporting TODOs and risks

    7. Conclusion

    Three conclusions are worth remembering. First, the delivery completion rate of long tasks is closer to real productivity than a single-turn benchmark score. Second, quota sufficiency and unit economics are an invisible capability in the agent era — they decide whether a task finishes or stops halfway. Third, multi-agent parallelism is a net gain only when subtasks share no mutable state; otherwise the rework cost eats up the entire gain.

    Methodologically, there is no need to rely on other people’s evaluation conclusions. A/B test with your own evaluation set and use completion rate, cost per task, and human rework time as the only judges; the conclusions are usually more reliable than any single benchmark.