Evaluating AI Coding Agents for Mobile Development: Task-Level Metrics and Trade-Offs
This article explains why task-level evaluation is necessary for AI coding agents in mobile development, outlines common task types, defines four core metrics (pass rate, average completion, average duration, per-round cost), and discusses their trade-offs. It also provides practical guidance for building reproducible evaluation pipelines and notes limitations of benchmark scores.
Why Task-Level Metrics Matter for Evaluating Coding Agents
Mobile app development involves far more than generating a few lines of code. A typical task may require creating a project, building a UI, integrating network requests, handling permissions and lifecycle events, adapting to different screen sizes, and finally verifying the result through compilation and runtime checks. Single-shot code completion benchmarks cannot capture such long-chain workflows. As a result, the industry is shifting toward evaluation at the granularity of complete tasks: given a requirement and a code repository, an agent autonomously makes changes, and a set of acceptance tests determines the outcome.
The core value of this approach is that it simultaneously exercises planning, code editing, tool invocation, and self-correction. The cost is that evaluation is expensive, time-consuming, and sensitive to the runtime environment and randomness.
Common Task Types in Mobile-Focused Benchmarks
Evaluation for mobile applications typically covers four categories:
- App creation: Generating a runnable project from a blank template or a natural-language requirement.
- Feature development: Adding new pages, API calls, or local storage logic to an existing project.
- Code migration: Upgrading legacy language versions, frameworks, or dependencies to newer ones.
- App conversion: Re-implementing an app in a different technology stack while preserving behavior.
Each category has distinct failure modes. Creation tasks often fail in dependency configuration; migration tasks often fail on deprecated APIs. Evaluations should report results by category rather than masking differences with a single overall score.
Four Core Metrics
Pass Rate
Pass rate is the proportion of tasks that fully satisfy all acceptance tests. The formula is: pass rate = (number of passed tasks) / (total number of tasks). It is the strictest metric, but it is insensitive to results that are “almost correct.”
Average Completion
Completion measures the proportion of acceptance items that are passed within a single task. For example, if a task has 10 checks and passes 8, the completion is 80%. Completion captures the value of partially correct results and is useful for determining whether an agent can handle most of the work, leaving final cleanup to a human.
Average Duration
Duration is the wall-clock time from task launch to result production. It includes model inference, tool execution, compilation, and retry waiting, and it is affected by queueing and network variability. When reporting duration, specify the hardware environment, concurrency level, and timeout settings; otherwise, numbers from different teams are not comparable.
Per-Round Evaluation Cost
Cost refers to the total financial expenditure for a complete evaluation round, typically including model invocation fees and runtime environment costs. Different pricing units and currency conversions make direct comparisons difficult; unify the cost into one currency and note the conversion date.
Trade-Offs Among the Metrics
The four metrics often constrain one another. Three common patterns emerge:
- High completion with long duration: The agent may perform more self-checks, multiple compile-and-fix loops, or more careful edge-case handling. Quality increases, but waiting time also increases. This profile suits scenarios where correctness is critical, such as migration or pre-release refactoring.
- Short duration and low cost: The agent responds quickly and makes fewer calls, making it suitable for prototyping, template-based pages, and small-scope changes. However, it may terminate early when encountering complex dependencies.
- Large gap between pass rate and completion: The model often gets close to correct but fails at the final step. This pattern usually relates to end-of-task verification or environment configuration, and can be improved by adding extra checking steps.
A common practice is to assign a weighted score based on business priorities. The following is an example formula; weights should be determined by each team according to its own context:
Composite score = 0.4 × pass rate + 0.3 × average completion + 0.2 × speed score + 0.1 × cost score
Here, the speed score and cost score are derived by normalizing duration and cost respectively and then inverting them. Once weights are fixed, they should remain consistent across all candidate solutions.
Building a Reproducible Evaluation Pipeline
Reproducibility determines whether evaluation conclusions are trustworthy. The following points are recommended:
- Fix the task set version and record the initial code snapshot for each task.
- Run each task multiple times and report the mean and the range of variation.
- Unify timeout, retry count, and concurrency limits.
- Isolate acceptance tests from the agent so the agent cannot modify the tests themselves.
- Save complete logs for failure analysis.
Below is an example code snippet for aggregating metrics:
from dataclasses import dataclassfrom statistics import mean@dataclassclass TaskResult:task_id: strpassed: bool # whether all acceptance tests passedcompletion: float # proportion of passed acceptance items, 0~1duration_h: float # wall-clock duration in hourscost_usd: float # cost for this task in USDdef summarize(results: list[TaskResult]) -> dict:n = len(results)return {"pass_rate": sum(r.passed for r in results) / n,"avg_completion": mean(r.completion for r in results),"avg_duration_h": mean(r.duration_h for r in results),"total_cost_usd": sum(r.cost_usd for r in results),}
This function only aggregates results; it does not handle task scheduling. In a real evaluation, scheduling, timeout control, and log collection should be handled by a separate execution framework, with each result stored in a structured format for later review.
Practical Recommendations
- Match model selection to task complexity: Use high-completion solutions for high-risk changes; use low-cost, fast solutions for routine small edits.
- Set budget and timeout limits to prevent long tasks from consuming resources indefinitely.
- Keep human review in the loop, especially for code involving permissions, privacy, and payment logic.
- Complement public benchmark sets with proprietary business tasks. Public tasks may not cover the technology stack and coding standards used by your team.
Limitations and Caveats
Benchmark scores only reflect performance on a specific task set; they do not guarantee effectiveness in a production environment. When the number of tasks is small, individual results amplify statistical noise. Public task sets may also leak into model training data, leading to inflated scores. Use evaluation results as a reference for model selection, not as the sole decision factor.
