Evaluating AI Coding Agents: Pass Rate, Latency, and Cost Explained

    Learn how to evaluate AI coding agents for real-world engineering tasks. This guide covers how to define task boundaries and acceptance criteria, interpret four core metrics—pass rate, average completion, duration, and per-run cost—balance their trade-offs, and build a reproducible evaluation workflow for team-level tool selection.

    1. Why Task-Oriented Evaluation Matters

    AI coding ability has traditionally been measured with algorithm puzzles or function-level completion benchmarks. These tasks have clear boundaries and fixed inputs and outputs, so they demonstrate how well a model has mastered syntax, but they say little about how a model performs in real projects. Real development requires understanding existing code structure, making cross-file changes, handling dependency versions, completing configuration and tests, and ultimately delivering an application that builds, runs, and passes verification.

    Task-oriented evaluation therefore shifts the focus from “writing a piece of code” to “delivering a working outcome.” In mobile app development, for example, typical tasks include creating an application skeleton from scratch, adding a feature to an existing project, migrating to a new framework version or language feature, and converting one application type into another. Each task has explicit completion criteria, such as a successful build, key features running correctly, and existing tests not breaking.

    This evaluation approach has direct value for tool selection. It turns “the code looks decent” into reproducible, comparable numbers, allowing decision-makers to judge against their own task types.

    2. Defining Task Boundaries and Acceptance Criteria

    Whether evaluation results are meaningful depends on how the task set is designed. When designing one, clarify three things first.

    First, task sources. Tasks should ideally come from real requirements or anonymized historical tickets, covering creation, modification, migration, refactoring, and other task types. Avoid cherry-picking only easy examples.

    Second, context scope. Specify which files the agent can read, whether it can execute build commands, and whether it has network access. Results from different context scopes are not directly comparable.

    Third, acceptance criteria. Acceptance should be automated as much as possible—for example, a successful build, passing unit tests, and no blocking errors from static analysis—supplemented by a small amount of manual review to check whether the implementation matches the requirements. Relying solely on subjective human scoring reduces reproducibility.

    3. The Four Core Metrics

    1. Pass Rate

    Pass rate is the proportion of tasks that meet all acceptance criteria. It answers the question: can the agent independently bring a task to a deliverable state? Pass rate is highly sensitive to task difficulty—the same agent can score very differently on different task sets—so any report must state the task count and difficulty distribution alongside the number.

    2. Average Completion

    Completion measures how far failed tasks got, commonly defined as the ratio of satisfied acceptance criteria to total criteria. It complements the pass rate. An agent with a low pass rate but high completion may have finished most of the work and only needs minor fixes, which actually lowers the cost of human handoff.

    Note that the gap between completion and pass rate reflects the ratio of “almost there” to “completely failed.” A large gap suggests the agent is weak at finishing touches—edge cases, test fixes, and so on—which can be addressed with better prompts or tooling at that stage.

    3. Average Duration

    Duration is the time from task start to final output. It directly affects developer waiting time and determines whether the agent can fit into interactive workflows. Track duration by task type, since the time profile of a new project differs greatly from a local modification. Also record whether multiple rounds of human intervention were involved; otherwise the duration data is uninterpretable.

    4. Per-Run Cost

    Cost includes model API charges, compute resources, and tool invocation overhead. Use a consistent pricing unit and note the exchange rate date; otherwise numbers across time periods or currencies become distorted. Cost should also be read together with pass rate—a low per-run cost does not mean good value. What matters is how much each successfully delivered task costs.

    4. Trade-Offs Among the Metrics

    The four metrics constrain one another, and looking at any single one in isolation leads to one-sided conclusions.

    Pass rate and duration are usually positively correlated. Giving the agent more reasoning steps and retry attempts can raise the pass rate, but it also extends duration. Teams need to judge whether the extra waiting time buys enough quality improvement.

    Pass rate and cost also require balancing. An expensive solution is not necessarily better on all tasks—for simple modification tasks, a low-cost option may suffice. A sensible approach is to assign agents by task difficulty tier rather than using one solution for everything.

    Duration and cost are related too. Long runs typically mean more context reads and intermediate output, and costs rise accordingly. Comparing duration and cost in the same table makes efficiency problems easier to spot.

    5. Building a Reproducible Evaluation Workflow

    A reproducible workflow typically involves four steps: fix the task set and versions, isolate the runtime environment, run multiple times and take statistical values, and record results in a structured format.

    The runtime environment must stay consistent, including dependency versions, build tool versions, and operating system images. Run each task at least several times, because agent output is stochastic and a single run may deviate from the mean. When recording results, save raw outputs, build logs, and acceptance results for later review.

    The following example shows how to aggregate single-run records into commonly used team metrics. Field names can be adjusted to fit your own workflow.

    1. from dataclasses import dataclass
    2. from statistics import mean
    3. @dataclass
    4. class RunRecord:
    5. task_id: str
    6. passed: bool
    7. completion_ratio: float # Range: 0.0 to 1.0
    8. duration_hours: float
    9. cost_usd: float
    10. def summarize(records: list[RunRecord]) -> dict:
    11. if not records:
    12. raise ValueError("Evaluation records are empty; cannot compute metrics")
    13. total = len(records)
    14. passed_count = sum(1 for r in records if r.passed)
    15. total_cost = sum(r.cost_usd for r in records)
    16. return {
    17. "pass_rate": passed_count / total,
    18. "avg_completion": mean(r.completion_ratio for r in records),
    19. "avg_duration_h": mean(r.duration_hours for r in records),
    20. "total_cost_usd": total_cost,
    21. # Average cost per successfully delivered task; the key value-for-money metric
    22. "cost_per_pass_usd": total_cost / passed_count if passed_count else None,
    23. }

    Here cost_per_pass_usd is the metric that best reflects actual return on investment. It spreads total spending across successful tasks, preventing low-pass-rate solutions from being overvalued simply because their per-run cost is low.

    6. Cost Measurement Caveats

    Cost measurement should cover all runs, including failed ones. Counting only successful tasks underestimates the true cost. For tasks requiring multiple retries, include the cost of every attempt.

    Also distinguish one-time costs from recurring costs. One-time costs include the labor of setting up the evaluation environment and writing the task set, while recurring costs are incurred with each evaluation round. Both matter when planning a budget.

    Exchange rate conversions need dates too. If your team settles in a non-USD currency, record the exchange rate used for each evaluation round so results from different periods can be compared.

    7. Selection Advice for Different Team Scenarios

    Different teams are sensitive to different metrics, so clarify priorities before choosing.

    For budget-sensitive teams, focus on cost per successful delivery. If tasks are mostly local modifications, a low-cost solution can handle most of them, with a stronger solution reserved for the few complex tasks.

    For latency-sensitive teams, the duration distribution matters more than the average. Long-tail tasks can stall the whole pipeline, so track duration percentiles separately and set up a fallback path for timeouts, such as handing off to a human.

    For quality-focused teams, prioritize pass rate and completion, and make automated acceptance stricter. Even at higher cost, tiered review can reduce production risk.

    In practice, most teams end up with a tiered strategy: low-cost solutions for simple tasks, high-capability solutions for complex ones, and humans for final review. The tiers should be based on measured data from your own task set, not a single leaderboard.

    8. Limitations and Caveats

    Benchmark results have a clear scope of applicability. If the task set differs significantly from your team’s actual work, the results lose reference value. Regularly refreshing the task set with real tickets is essential to keep the evaluation valid.

    Evaluation data also risks leakage. If tasks or solutions have already appeared in training data, pass rates may be inflated. Use unpublished or anonymized, rewritten tasks where possible.

    Agent-generated code needs security and compliance review. Focus on dependency introductions, secret handling, permission configuration, and open-source licenses. Automated acceptance only proves the functionality basically works; it cannot replace a security audit.

    Finally, a single evaluation is just a snapshot in time. Changes in model versions, tool configurations, and service conditions all affect results. Make evaluation part of an ongoing process: rerun it after every significant change and keep historical records so you can observe trends.