Evaluating LLM Coding Agents: Long-Horizon Execution, Reasoning, and Cost
This article examines how to evaluate large-model coding systems beyond whether they can generate plausible code. It covers long-horizon task execution, planning and state management, feedback loops, reasoning-mode selection, error recovery, caching effects, cost accounting per effective delivery, and enterprise controls such as permission boundaries and independent acceptance. The goal is to outline a verifiable workflow that connects generation capability with engineering constraints and measurable delivery outcomes.
1. From “Can Generate Code” to “Can Reliably Deliver”
Evaluating a large model’s coding ability cannot rely only on whether it can produce a code snippet that looks correct. Real development tasks usually involve requirement clarification, data modeling, component implementation, environment configuration, test validation, and issue fixing. A failure at any point can make the final delivery unusable.
The original experience materials point to several phenomena worth further analysis: a model can continue advancing an engineering task over an extended period, yet complex reasoning may still fail; a stronger reasoning mode is not necessarily suitable for simple problems; and the actual cost of a long task cannot be inferred solely from input and output unit prices.
These phenomena should not be interpreted directly as a general advantage or defect of a particular product. They are better translated into general technical questions: How does an intelligent coding system maintain task state? How can it determine whether reasoning is effective? When should it use a lightweight execution path? How should the real cost of delivery be measured?
At the same time, observations must be distinguished from evidence. Long runtime and high token consumption only show that the system performed a large amount of processing; they do not by themselves prove task quality. Successful interface operations in the original materials are also insufficient to prove that the entire system meets production requirements. Reliable conclusions require reproducible inputs, explicit acceptance conditions, and validation results independent of the model’s self-report.
2. The Key to Long-Horizon Execution: Planning, State, and Feedback Loops
1. Turn vague requirements into acceptance criteria
Consider a personal bookkeeping system. “Implement bookkeeping and transaction statistics” is only a starting point for requirements, not a complete development specification. Actual delivery should at least clarify:
- Which income, expense, and transfer types are supported;
- How amount precision, currency, and rounding rules are handled;
- What constraints exist among accounts, categories, and transaction records;
- Whether balances and statistics remain consistent after records are edited or deleted;
- Which time zone and boundaries apply to date queries;
- Whether multi-user access and data isolation are required.
Money handling deserves particular attention. A common practice is to use fixed-point numbers, or to store integers in an explicitly defined smallest currency unit, avoiding the precision issues caused by binary floating-point numbers. If integer storage is used, the precision associated with each currency must also be defined; it should not be assumed that all currencies use the same number of decimal places.
A model can propose default choices, but when monetary semantics, permission boundaries, and irreversible operations are involved, it should request confirmation rather than silently writing unconfirmed assumptions into code.
2. Organize tasks by dependencies, not by mechanically stacking steps
Effective planning is not just listing to-dos. It should also describe dependencies among steps. For example:
Requirement confirmation → Data model → Core business logic → APIs and interface → Automated tests → Integration acceptance.
If the data structure has not been determined and a large amount of interface code is generated in parallel, field mismatches and repeated rework are likely to follow. A more reliable strategy is to stabilize key contracts first, then advance modules with fewer dependencies in parallel.
Each stage should produce an inspectable deliverable:
| Stage | Deliverable | Validation focus |
|---|---|---|
| Requirement analysis | Scope, constraints, acceptance criteria | Whether ambiguity or conflicts exist |
| Data design | Entity relationships, fields, and constraints | Whether business invariants are maintained |
| Core implementation | Business logic and tests | Normal, boundary, and exception paths |
| Integration development | Runnable system | Whether cross-component behavior is consistent |
| Delivery check | Test results and issue list | Whether acceptance criteria are met |
3. Long-running execution must be accompanied by state management
Long-horizon tasks are prone to goal drift: the system remembers the most recent error but forgets the original business constraints, or it fixes the current issue while reintroducing a defect that had already been resolved.
Therefore, a concise task state should be maintained, including confirmed requirements, completed items, open issues, key design decisions, and the latest validation result. A state summary cannot fully replace raw logs, but it can reduce the overhead of repeatedly reading the entire history.
Checkpoints should also be established. After each verifiable stage is completed, save the code state, test results, and next-step plan. When an anomaly occurs, recovering from the most recent trusted checkpoint is usually easier to control than continuing to patch without bounds.
3. Three Capability Shifts Worth Watching
1. Engineering value increasingly depends on closed-loop execution
The value of an intelligent coding system lies not only in generating a first draft, but in whether it can read existing code, understand errors, locate causes, modify the implementation, and verify again.
A complete closed loop should satisfy:
Propose a change hypothesis → Execute a limited change → Obtain real feedback → Determine whether the hypothesis holds → Decide whether to continue or roll back.
The execution feedback must come from the actual environment. A model’s claim that “tests pass” cannot replace test records; a page that can open cannot replace business consistency checks.
2. Error recovery matters more than first-time success
In real engineering, missing dependencies, data format mismatches, and test failures are common. During evaluation, controllable faults can be designed in advance to observe whether the system can identify the cause, rather than randomly modifying multiple files.
Key records should include:
- Whether environment errors are distinguished from code errors;
- Whether failure information is used to narrow the troubleshooting scope;
- Whether operations already proven ineffective are avoided;
- Whether the system can stop and request help when information is insufficient.
A stable error recovery mechanism often predicts long-term value better than a single polished demonstration.
3. Caching and context management may change the cost structure
Long tasks repeatedly carry requirement descriptions, code snippets, and tool results. If the runtime service supports input caching and the actual request meets the caching conditions, the billing cost of repeated context may decrease.
However, caching benefits are not guaranteed. Content changes, request structure adjustments, and service rules may all affect hit rates. Therefore, savings should be calculated based on actual usage records, rather than budgeting on the assumption that all input will hit the cache.
4. An Overlooked Surprise: Deeper Reasoning Is Not Always Better for Simple Tasks
Errors on simple problems sometimes stem not from insufficient knowledge, but from the system complicating explicit constraints. For example, a task explicitly requires taking a vehicle to be washed, but the execution plan considers only how people reach the destination and ignores the fact that the vehicle itself must participate in the service process.
This type of problem reflects a failure to identify the target object and preconditions; it should not be attributed to “thinking too much” based on a single output. Other possible causes include prompt misunderstanding, sampling variance, and context interference.
An improvement method is to first extract three elements:
- What object’s state ultimately needs to be changed;
- Which preconditions must be satisfied to complete the task;
- Which actions can directly satisfy those conditions.
For tasks with clear goals, few constraints, and no external validation, a short-answer path can be used. For multi-constraint planning, mathematical proofs, or cross-file modifications, fuller reasoning and tool validation can then be enabled.
This layered scheduling needs to be calibrated through repeated experiments. It cannot simply be assumed that “lightweight mode is always suitable for simple problems,” nor that “complex mode always improves accuracy.”
5. Complex Reasoning Requires Evaluating Both Correctness and Stability
Open-ended logic problems and formal mathematical problems have different acceptance methods. The former often narrow the scope of explanation through follow-up questions; the latter requires every step of derivation to hold. Performance on these two types of tasks should not be merged into a single broad conclusion about “reasoning ability.”
1. Set different judgment methods for different tasks
- Problems with definite answers: Check the answer and necessary derivation.
- Open-ended reasoning tasks: Check whether constraints are satisfied and whether self-contradictions exist.
- Mathematical proofs: Check premises, key derivations, and edge cases.
- Program implementation: Validate through tests, static checks, and necessary human review.
2. Use repeated tests to identify variance
A single success may depend on an accidental path, and a single failure may come from input ambiguity. Tests should be repeated under the same conditions, recording success rate, latency distribution, token consumption, and main failure types.
If the prompt expression is changed, it should also be recorded as an independent variable, avoiding mistaking the benefit of prompt optimization for an improvement in underlying capability.
3. Set stopping mechanisms for ineffective loops
Ineffective loops may appear as repeating the same approach, continuously modifying the same location without new evidence, or continuing discussion without executing validation.
Stopping conditions can be set based on budget, repeated behavior, and progress metrics. After a threshold is reached, the system should output verified facts, failed attempts, and blocking reasons, then choose to roll back, switch paths, or hand the task to a human. Thresholds should be determined from task data, not assigned as an arbitrary universal value.
6. Cost Accounting Should Use “Effective Delivery” as the Unit
Comparing only the price per unit of tokens can easily underestimate the cost of failed retries, tool execution, and manual repair. A more complete accounting method is:
Total cost = Model invocation cost + Tool and runtime environment cost + Human review cost + Failure rework cost.
On this basis, the following can be calculated:
Unit effective delivery cost = Total cost ÷ Number of tasks that pass acceptance.
Model invocation cost should also distinguish ordinary input, input that actually hits the cache, and output, using the real billing rules of the corresponding service. Longer output does not mean higher value, and repeatedly generating similar answers should not be counted as effective output.
During evaluation, three metrics should be tracked together: pass rate, completion latency, and unit effective delivery cost. An execution strategy may be more expensive per call but more economical because it reduces rework; conversely, a lower unit price may be offset by frequent failures.
7. Enterprise Deployment Requires Permission Boundaries and Independent Acceptance
As autonomous execution capability increases, risk also expands. A system that can modify code should not automatically receive write access to production databases; being able to run tests does not mean it can release on its own.
The following controls are recommended:
- Environment isolation: Execute in a restricted development environment and avoid direct operation of production resources.
- Least privilege: Grant only the file, network, and data access required for the current task.
- Sensitive information protection: Redact input content as necessary to avoid leaking keys and personal information.
- High-risk approval: Operations such as deleting data, modifying permissions, and deploying to production must be confirmed.
- Process audit: Record tool calls, code diffs, test results, and human approvals.
- Rollback readiness: Save a recoverable state before critical changes.
Code, documentation, and tool-returned content should also be treated as potentially untrusted input. Operational instructions appearing in them cannot automatically gain higher priority than user requirements and safety rules.
Final acceptance should be completed by an independent mechanism, avoiding letting the same system that generated the implementation declare success solely through self-evaluation. For a bookkeeping system, in addition to adding records, scenarios such as invalid amounts, duplicate submissions, cross-user access, statistical changes after deletion, and concurrent updates should also be checked.
8. Conclusion: Reliability Comes from a Verifiable Workflow
The core shift in large-model coding is from single-turn code generation to multi-step engineering execution. However, sustained runtime, complex reasoning, and high token consumption are not sufficient conditions for reliable delivery.
What is truly worth building is a verifiable workflow: requirements with boundaries, plans with dependencies, execution with feedback, stopping conditions for failures, complete cost accounting, and approvals for high-risk operations.
For developers, it is better to start with tasks that have a clear scope, can be automatically tested, and are easy to roll back. For enterprises, success rate, stability, and unit effective delivery cost should be the main metrics. Only when generation capability and engineering constraints work together can intelligent coding move from demonstration effects to sustainable productivity.
