Evaluating AI Agents for Mobile App Development: Trade-offs and Metrics

    This article explores the evaluation of AI agents in handling real-world mobile app development tasks. It covers four core metrics—pass rate, average completion, wall-clock time, and cost per run—along with the engineering trade-offs between them. The article also details how to calculate cost per successful task, design effective evaluation task sets, select solutions based on business scenarios, and implement key engineering practices such as environment isolation and security. Finally, it highlights the limitations of benchmark evaluations.

    I. The Starting Point

    Increasingly, teams are attempting to let AI coding agents take on real-world engineering tasks, such as building applications from scratch, adding feature modules, migrating legacy code, and refactoring existing projects. Unlike single-line code completion, these tasks require the model to understand project structures, adhere to platform specifications, coordinate cross-file modifications, and pass build and runtime validations. Therefore, determining whether an agent is viable requires evaluating its overall performance in multi-step, long-duration tasks, rather than just its ability to write seemingly correct snippets.

    Mobile OS application development is a quintessential scenario. UI layout, lifecycle management, permission declarations, dependency versions, and build configurations are deeply interconnected. A single oversight can lead to compile-time failures or runtime exceptions. This makes the field an excellent testbed for assessing an agent’s engineering capabilities.

    II. Four Core Metrics and Their Meanings

    Evaluations typically focus on four dimensions:

    1. Pass rate: The proportion of tasks that ultimately pass all acceptance test cases. It reflects deliverability and is the most direct quality signal.
    2. Average completion: Even if not fully passed, the percentage of acceptance criteria met by the agent. It reflects progress and helps distinguish near-successes from complete failures.
    3. Average wall-clock time: The total time from receiving a task to producing a result. It determines whether the agent can fit into the daily iteration rhythm.
    4. Cost per run: This includes model invocation fees, sandbox compute resources, and retry overhead. It dictates the economic viability of large-scale usage.

    These four metrics are not interchangeable. A low pass rate with high completion suggests the agent frequently gets stuck at the final step, indicating issues with final validation or boundary conditions. High completion and pass rate but long wall-clock time suggest the agent might waste time on ineffective explorations.

    III. Engineering Trade-offs Between Metrics

    In practice, high completion rates and long durations often co-occur. This phenomenon typically stems from the following mechanisms:

    • More planning and self-verification steps to achieve a lower error rate, at the cost of increased inference time;
    • More frequent reading of the codebase and execution of build commands, increasing context-gathering overhead;
    • Repeated fix cycles after failures, where each round requires recompiling, running, and comparing results.

    Therefore, simply maximizing a single metric is unreasonable. Teams need to set priorities based on task nature. For core modules requiring highly reliable delivery, longer durations may be acceptable; for prototype validation or bulk boilerplate code generation, speed and cost are more critical.

    There is also a trade-off between cost and speed. Lighter models or simpler execution strategies often have lower per-run costs and faster responses, but they tend to stop prematurely on complex tasks, requiring human intervention. The time cost of human remediation must be factored into the total cost; otherwise, incorrect conclusions will be drawn.

    IV. Cost and Time Calculation Methods

    When comparing different solutions, the primary metric should be the cost per successful task and the human wait time per successful task, rather than the superficial price of a single run. A cheap solution with a low pass rate might require more retries, resulting in higher actual costs.

    The cost per successful task can be expressed as:

    Cost/Success = Total Cost / Number of Passed Tasks

    If the number of passed tasks in an evaluation is zero, this metric is undefined and should be marked separately, not treated as zero.

    The following sample code demonstrates how to summarize these metrics from run records:

    1. from dataclasses import dataclass
    2. @dataclass
    3. class RunRecord:
    4. task_id: str
    5. passed: bool
    6. completion: float # Completion rate, ranging from 0 to 1
    7. hours: float # Actual duration in hours
    8. cost: float # Cost per run, in a unified currency unit
    9. def summarize(records: list[RunRecord]) -> dict:
    10. if not records:
    11. raise ValueError("records cannot be empty")
    12. n = len(records)
    13. passed = [r for r in records if r.passed]
    14. total_cost = sum(r.cost for r in records)
    15. return {
    16. "pass_rate": len(passed) / n,
    17. "avg_completion": sum(r.completion for r in records) / n,
    18. "avg_hours": sum(r.hours for r in records) / n,
    19. "cost_per_pass": total_cost / len(passed) if passed else None,
    20. }

    cost_per_pass returns None when there are no passed tasks, leaving it to the caller to decide how to display it.

    V. Designing the Evaluation Task Set

    The reliability of evaluation results depends on how closely the task set resembles real-world work. A reasonable task set usually covers the following types:

    • Creating a complete project skeleton from requirements;
    • Adding new features to an existing project while keeping original tests passing;
    • Migrating legacy code to a new language or framework version;
    • Refactoring one application form into another, such as adding an adaptation layer.

    Each task should include clear acceptance criteria, a fixed initial codebase, and reproducible environment configurations. Acceptance criteria should be automated as much as possible, differentiating between build success, functional correctness, and no regression, to facilitate locating failure points.

    Task descriptions must be clear; otherwise, the evaluation results reflect prompt quality rather than model capability. The same task should be run multiple times to record the fluctuation range of results, avoiding treating accidental successes as stable capabilities.

    VI. Scenario-Based Solution Selection

    Selection should start from business constraints, not leaderboards.

    • Core business modules and security-sensitive code: Prioritize pass rate and no-regression capability. Longer durations and higher costs are acceptable, and full human review must be retained.
    • Prototypes and internal tools: Prioritize duration and cost. Lower pass rates are allowed, with developers making quick fixes.
    • Bulk repetitive refactoring: Focus on the number of successes per unit cost and establish automated acceptance to reduce manual, task-by-task checks.

    Teams must also evaluate data compliance requirements. Whether code can be sent to external services should be confirmed by security and legal departments, and policies should explicitly state which repositories are permitted to connect to agents.

    VII. Key Engineering Implementation Steps

    1. Isolated execution environment: Agents run in isolated containers, mounting only the required directories, with restricted network access and sensitive credentials.
    2. Secret management: Model access keys are injected via environment variables or secret management services, never written into code or logs.
    3. Result retention: Run logs, generated patches, and acceptance reports are stored uniformly in logging services and object storage for auditing and review.
    4. Monitoring and alerting: Set alert thresholds for exceeded durations, over-budget costs, and consecutive failures.
    5. Human review loop: Code produced by the agent must pass code review and automated testing before being merged into the main branch.

    These steps may seem unrelated to model selection, but they determine whether the evaluation data can be trusted and whether the agent can run safely in production.

    VIII. Limitations and Considerations

    Benchmark evaluations only reflect performance under a specific task distribution. The complexity, historical baggage, and team conventions of real projects often exceed those of evaluation sets. Evaluation results should serve as a reference for selection, not the sole basis.

    Model versions iterate quickly, and the same solution may perform noticeably differently at different times. Teams should fix evaluation versions and retest periodically. When citing external evaluation data, verify the test conditions, including agent configuration, task versions, run counts, and cost accounting methods, to avoid directly comparing figures with inconsistent metrics.