Evaluating AI Agents' Programming Capabilities: From Task Completion to Cost Governance

    This article explores a comprehensive framework for evaluating the programming capabilities of AI agents. Moving beyond simple code generation, it emphasizes assessing agents as complete working systems across four key dimensions: task understanding, cross-scenario generalization, long-process execution, and self-repair. The article highlights the importance of reproducible test environments, version-controlled acceptance criteria, and stability over single-run peaks. Finally, it outlines a cost governance model centered on successful delivery and engineering constraints to ensure predictable, maintainable, and verifiable production outcomes.

    I. Define the Evaluation Target: Agents vs. Single-Turn Generation

    Programming agents differ significantly from single-turn code generation. Single-turn generation primarily examines whether a model can produce reasonable code based on input, whereas an agent must continuously drive toward a goal: understanding requirements, reading the project, formulating a plan, calling tools, modifying files, executing verification, and fixing issues based on feedback.

    Therefore, an “accurate response” does not equal a “completed task,” and “runnable code” does not equal “deliverable.” Real-world projects require controllable modification scopes, constraint-compliant implementations, consistency across modules, and the absence of obvious security vulnerabilities.

    A more reasonable evaluation target should be a complete working system:

    Delivery Outcome = Model Capability + Runtime Environment + Tool Permissions + Context Management + Acceptance Mechanism.

    This means that when a task fails, we cannot immediately conclude that the model lacks the relevant capability; when a task performs well, we cannot instantly infer that it will be equally reliable in other projects. Evaluation must distinguish where the failure originates and whether the results can be consistently reproduced.

    II. Decompose “Version Progress” into Verifiable Capability Changes

    During model iterations, phased open testing and stable releases serve different purposes: the former exposes problems and collects feedback, while the latter usually indicates that developers have clearer expectations for capability boundaries, service stability, and usage constraints. However, the release phase itself does not constitute proof of quality.

    To determine whether capabilities have improved, we should break them down into at least the following four dimensions.

    1. Task Understanding

    Focus on whether the agent can identify the true delivery goal, rather than just responding to the most visible surface-level requirements.

    For example, “adding a data filtering page” is not just about adding input fields and buttons; it may also involve filter condition combinations, pagination state, empty result display, exception feedback, and consistency with existing page styles.

    During evaluation, distinguish clear requirements from reasonable engineering constraints beforehand. Do not temporarily add requirements after seeing the output that were not originally specified or reasonably derivable; otherwise, subjective preferences can easily be mistaken for capability defects.

    2. Cross-Scenario Generalization

    Excellent frontend UI performance does not directly indicate that an agent excels at backend transaction processing, data migration, or complex project maintenance.

    It is recommended to cover multiple task types:

    • Interface Development: Examine layout, interaction, state management, and visual consistency.
    • Bug Fixing: Examine problem localization, minimal modifications, and regression testing.
    • Server-Side Development: Examine input validation, exception handling, permission boundaries, and data consistency.
    • Project Refactoring: Examine behavior preservation, dependency relationships, and modification scope.
    • Unfamiliar Module Maintenance: Examine code reading, information retrieval, and adherence to existing conventions.
    • Test Completion: Examine boundary identification, assertion validity, and test maintainability.

    Truly valuable generalization is not just generating some code for each task type, but consistently forming verifiable and maintainable delivery results across different tasks.

    3. Long-Process Execution

    Some tasks start in the right direction but gradually deviate from the goal during continuous modifications. For example, expanding the refactoring scope to fix a local error, or repeatedly adjusting a specific page while forgetting that other pages rely on the same styling conventions.

    Therefore, it is necessary to check whether the agent can continuously maintain global constraints, including file modification scope, API compatibility, dependency limits, data processing rules, and acceptance criteria.

    4. Self-Repair Capability

    An incomplete initial result does not necessarily mean task failure. The key is whether the agent can find the cause based on test failures, execution logs, and clear feedback, and complete an effective fix.

    However, we must distinguish between two situations: one is autonomously locating the problem based on objective errors, and the other is relying on the evaluator to gradually provide the implementation plan. The latter should be recorded as human assistance and not conflated with independent completion.

    III. Build Reproducible Test Environments

    Agents are highly dependent on their runtime environment. Working directories, accessible files, terminal permissions, network status, dependency versions, and tool return formats can all affect results.

    A fair comparison requires fixing at least the following conditions:

    1. Same Project Starting Point: Launch from a consistent code snapshot each time to prevent modifications from previous runs from affecting subsequent tasks.
    2. Same Task Description: Unify the goals, constraints, deliverables, and acceptance methods.
    3. Comparable Resource Budgets: Clarify time, API call, output, or cost budgets.
    4. Consistent Tool Permissions: Do not allow one group to have test execution permissions while another can only read code.
    5. Clear Human Intervention Rules: Specify when follow-up questions are allowed and what level of hints can be provided.
    6. Complete Process Records: Save file changes, tool calls, test results, time consumption, and failure reasons.

    Two types of tests should also be distinguished.

    Controlled Tests keep the execution framework and tool environment as consistent as possible to analyze the capability differences of the underlying models.

    Real-World Usage Tests allow the system to use its common working methods to determine if the complete solution fits a real team.

    Both tests are valuable, but conclusions from one cannot be directly generalized to the other. Smoother real-world usage may stem from more mature context organization and tool orchestration, rather than just a stronger underlying model.

    IV. Establish Acceptance Criteria to Prevent Evaluation Drift

    As industry capabilities improve, evaluators’ expectations for “good results” also rise. A page previously considered sufficiently complete may later appear crude. This change is understandable, but without version records, scores before and after become incomparable.

    The solution is to version the acceptance criteria.

    1. Define Baselines Before Evaluating Refinements

    Tiered acceptance is recommended:

    • Baseline Items: Can the project start? Are the main flows usable? Are explicit constraints violated? Are there obvious security risks?
    • Functional Items: Are requirements covered? Are exception branches handled? Is the data state correct?
    • Engineering Items: Is the structure reasonable? Are modifications restrained? Are tests effective? Is the code maintainable?
    • Experience Items: Do layout, interaction feedback, visual consistency, and accessibility meet expectations?

    Baseline issues should not be entirely resolved through weighted averages. An implementation with severe permission defects cannot be deemed deliverable just because the UI is beautiful.

    2. Fix Standards and Retain History

    If standards need to be raised, publish a new scoring version and re-evaluate historical results if possible. When re-testing is impossible, explicitly state that old and new results are not directly comparable.

    For highly subjective items like visual quality, anonymous reviews and multi-person cross-checks can be used, replacing “feels not good enough” with specific problem descriptions. For instance, “the error message is not associated with the input field” is more actionable than “poor interaction.”

    3. Retain Failed Samples

    Showing only successful cases will severely overestimate system capabilities. A complete report should record failed tasks, timed-out tasks, and human-takeover tasks, explaining their failure types.

    Failed samples often reveal deployment risks better than successful ones, as they demonstrate the conditions under which the system requires additional constraints.

    V. Stability Over Single Best Performance for Production Value

    Generative systems are inherently random. The same task may show significant differences in implementation routes, tool call frequencies, and final quality across different runs.

    Therefore, a single high score only proves that the system once reached a certain level; it does not prove that its daily performance is reliable.

    For critical tasks, multiple independent runs should be scheduled, recording:

    • Deliverable success rate.
    • First-time completion rate.
    • Median and variance of result quality.
    • Median time consumption and performance in slower cases.
    • Number of human supplementary prompts.
    • Occurrences of severe constraint violations.

    Here, “deliverable” must be based on pre-defined acceptance criteria, not temporarily judged after the task ends.

    Testing can also be divided into two phases: Phase one provides no supplementary information to observe independent completion capability; Phase two allows limited, standardized feedback to observe repair capability. This prevents conflating “accurate initial understanding” with “remediation after prompting.”

    For enterprises, consistently reaching a usable level is usually more translatable into production value than occasionally producing stunning results.

    VI. Cost Evaluation Centered on Successful Delivery

    Comparing only unit call prices easily ignores the true cost of agent tasks. A system with cheap single calls might incur higher total costs due to repeated retrieval, redundant modifications, and multi-round failures.

    The following accounting framework can be used:

    Average Cost of Successful Delivery = Total Task Cost During Evaluation Period ÷ Number of Deliverable Tasks.

    Total task cost includes at least:

    • Model inference and context processing costs.
    • Tool execution, test environment, and compute resource costs.
    • Supporting costs for retrieval, storage, and networking.
    • Human review, supplementary explanation, and repair costs.

    Resources consumed by failed tasks must also be included. Otherwise, calculating only successful samples will systematically underestimate usage costs.

    For defect risks and delivery delays, separate risk assessments can be conducted, but they should not be converted into seemingly precise monetary amounts without solid evidence.

    Why “More Calls” Doesn’t Mean More Reliable

    An increase in tool calls might indicate more thorough system checks, or it might indicate repeated invalid operations. To judge the value of calls, observe whether each step produced new valid evidence:

    • Did it verify a clear hypothesis?
    • Did it reduce the uncertainty of the problem?
    • Did it discover previously unknown constraints?
    • Did it push the implementation closer to the acceptance goal?

    Valid verification is worth the investment; loops generating no new information should be terminated promptly.

    VII. Understand Output Limits vs. Logical Capability

    Output length, context capacity, and reasoning capability are different concepts.

    Output length limits may prevent long reports, complex patches, or complete execution logs from being generated at once, but this alone cannot justify concluding that a system lacks logical capability. Similarly, being able to generate very long content does not mean the reasoning is correct.

    During evaluation, first distinguish the reasons for task failure:

    • Was there an error in the derivation process?
    • Did necessary inputs fail to enter the context?
    • Was the result formed but the output truncated?
    • Did a tool execution failure prevent continued verification?
    • Or did the task design itself demand too much irrelevant output?

    For engineering tasks that allow phased delivery, methods like task decomposition, file writing, phase summaries, and local verification can reduce single-output pressure. However, if the test goal is to examine the ability to complete a long task in one go, retain the corresponding limits and explicitly state that the conclusion only applies to that condition.

    Failures constrained by API limits should not be directly generalized into a denial of overall capability.

    VIII. Improve Delivery Reliability via Engineering Constraints

    Evaluation is not just a tool for selection; it is a method for improving workflows. For agents that already possess basic usability, the following measures are usually more practically meaningful.

    1. Write Tasks as Verifiable Contracts

    Task descriptions should include goals, inputs, allowed modification scopes, forbidden items, and acceptance methods. For example, explicitly require maintaining existing API compatibility, not introducing unnecessary dependencies, and covering both normal and exception branches.

    Clear constraints do not complete the task for the agent; they reduce goal deviation between humans and the system.

    2. Adopt Short-Cycle Verification

    Rather than modifying a large number of files and checking them all at once, advance at the rhythm of “understanding—small-scope implementation—running verification—repair.” Short feedback cycles reduce the spread of erroneous assumptions in subsequent steps.

    However, splitting tasks also has management costs. Prioritize splitting around independently verifiable modules or behavioral boundaries, rather than mechanically dividing by file count.

    3. Set Approvals for High-Risk Operations

    When involving data deletion, permission changes, sensitive information access, or production configuration modifications, set clear human approvals and permission isolation. Passing tests does not mean skipping security reviews.

    Simultaneously, treat repository files, logs, and external retrieval content as data to be analyzed, not as inherently trusted operational instructions, to prevent the agent from being induced by non-task content to execute unauthorized operations.

    4. Make Critical Constraints Checkable

    Important rules should be implemented as automated checks wherever possible. For example, use tests to verify API behavior, use static analysis to find obvious issues, and use change manifests to confirm modification scopes.

    Natural language reminders help but cannot replace executable quality gates.

    IX. Formulate Deployment-Oriented Evaluation Conclusions

    A valuable evaluation report should not stop at broad judgments like “stronger” or “cheaper,” but answer four specific questions:

    1. Which tasks can be stably completed with minimal intervention?
    2. Which tasks require supplementary context, additional verification, or human collaboration?
    3. At what stage do failures typically occur, and can they be identified in advance?
    4. Is the total cost to reach the defined quality standard acceptable?

    For low-risk tasks with clear acceptance criteria, the scope of automated execution can be gradually expanded; for high-risk tasks with ambiguous requirements or high failure costs, stricter review and takeover mechanisms should be retained.

    The true value of a programming agent is not how much code it generates in a single run, or how complete a specific example looks, but whether it can continuously deliver verifiable, maintainable, and accountable engineering results within clear boundaries, at predictable quality and cost.