AI Coding Agents on Long-Horizon Android Tasks: Evaluation Metrics and Production Deployment
This article examines how AI coding agents are measured and deployed on long-horizon tasks in Android development. It explains why mobile apps are a high-value testing ground, defines the four core benchmark metrics (pass rate, average completion, wall-clock time, and per-run cost), and contrasts two typical agent profiles that trade exploration depth against time and cost. It then shows how teams can build reproducible internal benchmarks from historical tickets, enforce multi-layer acceptance checks, and integrate agent output into the R&D workflow through task routing, cost guardrails, and human review gates. Readers will learn how to interpret benchmark numbers correctly and turn evaluation methods into an everyday engineering practice.
1. Long-Horizon Tasks: Code Generation Evaluation Is Approaching Real Engineering
In recent years, generative models have been used to write business functions, add unit tests, and locate defects. The way these capabilities are evaluated has shifted from “completing a snippet of code” or “solving a standalone algorithm problem” toward “working within a real repository, around a well-defined requirement, to close the full loop from modification and build to verification.” The industry refers to tasks that require an agent to keep advancing over many turns of action, gradually approaching the goal with the help of tools, as long-horizon tasks.
Mobile application development is a high-value scenario for testing long-horizon capability, for three main reasons:
- Large engineering scale: A medium-sized app often contains multi-module projects, declarative build scripts, local dependency and signing configuration, and multiple file types such as resources, manifests, and obfuscation rules.
- Long verification chain: “The build passes” is only the starting point. Real acceptance also includes unit tests for managed-language code, UI automation, and device-compatibility checks; any step that fails may force the agent to roll back and re-locate the root cause.
- Strong modification constraints: UI layout, navigation behavior, background scheduling, and the permission model all have explicit lifecycle and compatibility rules. Changing one part can ripple across the whole system, so the model must understand the existing architecture before acting.
Typical long-horizon tasks can be grouped into four categories:
- App creation: Starting from an empty project or template, setting up a layered structure, dependency injection, theme styles, and basic navigation.
- Feature development: Implementing new features within existing modules, reusing the project’s existing components and coding conventions.
- Code migration: Switching an old implementation wholesale to a new approach (for example, migrating from imperative to declarative UI, or from legacy async callbacks to coroutines) while keeping external behavior unchanged.
- App conversion: Rewriting code or interfaces in other forms into adapted versions that follow the target platform’s conventions.
These tasks share one trait: the requirement describes only “what is wanted,” not “how to do it,” and success counts only after a complete build and passing verification. When evaluating an agent, therefore, you must look at both the final outcome and the quality of its behavior over long time spans.
2. Four Core Metrics: What Each Number Actually Answers
Mobile-oriented long-horizon benchmarks usually publish four core metrics. Understanding the definitions matters more than memorizing the numbers.
| Metric | Meaning | Key interpretation points |
|---|---|---|
| Task pass rate | Share of tasks that fully satisfy acceptance criteria | Whether a task truly succeeds end to end |
| Average completion | Ratio of completed requirements or acceptance checks to all checks | “How far off” a failure is; reflects the capability boundary |
| Average wall-clock time | Mean elapsed wall-clock time to complete a task | Iteration pace, plus build and device-waiting time |
| Per-run benchmark cost | Mean model and tool-call cost to run the entire task set | Budget constraints at scale |
Pass rate is the strictest metric. A task counts as passed only when the agent’s changes build successfully and pass all predefined checks. Pay particular attention to the denominator: “20%” over 30 tasks and “20%” over a hundred tasks are not comparable — the smaller the sample, the more a single outcome disturbs the result. Common optimization tactics include breaking key constraints out in the requirement description, proactively running tests and letting failure logs drive corrections, and rolling back and redoing when changes grow too large. These behaviors typically lower the failure rate but significantly raise time and cost.
Average completion is the most valuable metric for interpreting failures. Pass rate answers only “did it or not”; completion quantifies “where it falls short”:
- Completion that approaches the passing line but falls short is often due to details such as build environment, permission configuration, or device compatibility — a small amount of human correction can close the loop.
- Completion that stays low over a long period usually indicates a systematic bias in the model’s understanding of the project structure or platform conventions, which prompt tuning alone can hardly solve.
Note that benchmarks do not measure “completion” the same way: some compute it as requirement-point coverage, some as the proportion of tests passed, and some as reviewer scores against a rubric. When comparing completion across leaderboards, align the definitions first, or you risk drawing wrong conclusions.
Time and cost together determine the engineering feasibility of long-horizon tasks. Completing one such task can take hours or even longer, and a substantial part of that time is spent on steps that are unrelated to “thinking” yet cannot be skipped:
- Full builds and dependency downloads;
- Emulator startup, installation, and screenshot checks;
- Repeated “modify–build–read log–modify again” loops.
Cost comes mainly from model calls, as long conversation histories and code context are carried along repeatedly; failure retries further multiply the number of calls and make cost grow non-linearly. When evaluating, also confirm whether the cost basis is complete: a number that counts only model-call fees often underestimates infrastructure overhead such as build clusters, device instances, and image storage.
3. Two Agent Profiles: The Essence of the Engineering Trade-off
Observing how different agents perform on the same benchmark usually surfaces two typical profiles:
| Dimension | Profile A: High completion, long time | Profile B: Low time, low cost |
|---|---|---|
| Pass rate | Relatively high | Relatively low |
| Average completion | High; failures mostly in details | Low; may deviate at the requirement-understanding stage |
| Time | Long (can reach ten-plus hours or more) | Short (as low as a few hours) |
| Per-run cost | High (hundreds of dollars) | Low (within ten dollars) |
| Fit | One-off, high-value, high-complexity migrations and refactoring | High-frequency, standardized, budget- and response-sensitive tasks |
This difference is not simply “strong versus weak” but the result of different design orientations:
- Exploration depth sets the ceiling. Agents willing to spend more turns reading code, running tests, and checking acceptance criteria one by one have a better chance of pushing completion up to the passing line; fast agents typically converge in fewer turns and tend to stop early on complex tasks.
- Long time is the price of a “reliability premium.” If one overnight batch migration can replace days of manual rework, then tens of hours and hundreds of dollars may still be worth it.
- The cost-effectiveness of the low-cost profile hides in how failures are handled. Fast agents often produce clear, easy-to-review output, so failures can be retried cheaply or handed to humans; but if reaching the same pass rate requires repeated reruns, that “cheap” advantage is diluted.
The right way to compare is therefore not to rank agents on a single leaderboard, but to map each profile onto a four-dimensional space of “task difficulty × frequency × budget × delivery deadline”:
- One-off, cross-module, high-complexity tasks whose results can be fully verified suit the high-completion profile.
- Tasks run many times a day with clear boundaries and verifiable within minutes (such as adding a UI page, supplementing unit tests, or fixing a specific crash) suit the low-cost fast profile.
A repeatedly confirmed rule: for high-frequency everyday tasks, the total cost of “cheap per run but often needing rework” may exceed that of “expensive per run but right the first time.” Conversely, in scenarios with vague requirements that are hard to verify automatically, the completion advantage of a high-cost approach may not translate into real gains.
4. Turning External Benchmarks into Internal Evaluation: A Reproducible Approach
The value of a leaderboard lies not in the ranking but in the measurement methodology it offers for reference. Most teams cannot directly reproduce public benchmarks, but they can follow the same approach and build a lightweight long-horizon evaluation set from their own repositories. The key is to turn “model capability assessment” into a measurable, reproducible engineering experiment.
4.1 Building the Task Set: Mining Real Requirements from Historical Tickets
Prioritize extracting tasks from historical requirement tickets, defect tickets, and code-review records. Such tasks are naturally close to the business and come with clear before-and-after states for comparison. Follow four principles when building the set:
- Snapshot: Record the repository snapshot identifier (such as a commit hash) for each task to avoid drift as the code evolves.
- Isolation: Create an independent workspace for each task to prevent tasks from contaminating one another through caches or the file system.
- Stratification: Sample across the four categories — app creation, feature development, code migration, app conversion — to keep the difficulty distribution reasonable.
- Verifiability: Every task must have automated acceptance criteria; tasks that cannot be judged automatically do not enter the benchmark.
4.2 Acceptance: Build Success ≠ Task Complete
This is the most error-prone step in long-horizon evaluation. The common practice of “count as passed if compilation succeeds” significantly overestimates agent capability. A more robust approach uses multi-layer acceptance:
- Layer 1 — Build: All modules compile, with no new accumulation of warnings.
- Layer 2 — Static checks: Code conventions, dependency compliance, and complete permission declarations.
- Layer 3 — Automated tests: Unit tests for added or modified logic pass, and all existing tests still pass on regression.
- Layer 4 — Behavior verification: Run UI automation cases across multi-version emulators or real devices via device-debugging bridge commands, checking key paths and screenshots.
- Layer 5 — Human sampling: Review passing items by proportion, focusing on opportunistic behaviors such as “writing tests just to pass tests,” deleting assertions, or tampering with configuration.
A typical acceptance configuration can be written as follows (illustrative):
# eval_task.yaml — long-horizon task evaluation config (illustrative)task_id: "feature-login-flow" # unique task identifierrepo_snapshot: "a1b2c3d" # fixed repository snapshot for reproducibilitymax_wall_clock_s: 86400 # wall-clock limit: 24 hoursmax_cost_usd: 350 # cost guardrailacceptance: # acceptance criteria: all must pass to count as passed- name: buildcmd: "./ci/build.sh --variant debug"- name: unit-testcmd: "./ci/test.sh --suite unit"- name: ui-smokecmd: "./ci/device-test.sh --matrix api28,api35"- name: static-checkcmd: "./ci/lint.sh"forbidden_edits: # prohibited edits, to prevent "gaming the score"- "app/src/test/**"- "ci/**"metrics: [pass, completion, wall_clock_s, cost_usd, tool_calls, retries]
The accompanying evaluator can be described by the following pseudocode for its control flow:
def run_eval(task, agent, cfg):ws = prepare_workspace(task.repo_snapshot) # isolated sandbox + fixed snapshott0 = time.monotonic()try:result = agent.solve(task.prompt, workspace=ws,budget_wall_clock=cfg.max_wall_clock_s,budget_cost=cfg.max_cost_usd)except BudgetExceeded:result = None # timed out or over budget: record as failed, keep partial artifactsfinally:diff = git_diff(ws) # record change scope, verify prohibited editspassed = all(check(ws, step) for step in cfg.acceptance)return {"pass": passed,"completion": passed_checks(cfg, ws) / len(cfg.acceptance),"wall_clock_s": time.monotonic() - t0,"cost_usd": result.cost if result else cfg.max_cost_usd,"tool_calls": result.tool_calls if result else 0,}
4.2.1 Sandbox Isolation: A Prerequisite for Reproducibility
- Each task runs in an independent container with a read-only repository snapshot mounted.
- Network access uses a whitelist that opens only necessary dependency image registries and model service endpoints.
- On the device side, use an emulator cluster or a real-device pool, assigning an independent instance to each task to avoid installation conflicts.
- After the run, reclaim the environment while retaining complete logs and artifacts for failure analysis.
4.2.2 Metric Collection and Statistical Conventions
- Record the input and output size of model calls, the number of tool calls, the number of retries, and key timestamps throughout, for later diagnosis of time bottlenecks.
- Repeat each task at least several times (for example, 3–5 runs) and report the mean, standard deviation, and confidence interval rather than a single result.
- The timeout threshold for long tasks must be stated explicitly; otherwise a “low pass rate” may simply mean tasks were cut off too early.
- Cost accounting must separate “model-call fees” from “infrastructure fees.” The two have different bases, and mixing them distorts cross-solution comparisons.
5. Engineering Deployment: From Benchmark Metrics to the R&D Workflow
Evaluation results ultimately have to land in daily R&D. Five strategies are worth referencing in practice.
1. Task routing: Let each agent profile do what it does best
Automatically split tasks by their characteristics rather than applying one rule to all:
task enters -> assess complexity (files changed / cross-module / touches platform capability)|- low risk, verifiable in seconds -> fast low-cost agent -> auto-merge (must pass all gates)|- medium risk -> fast agent drafts -> human review -> merge|- high risk, cross-module -> high-completion agent + strict gates + human final decision
2. Context engineering: Reduce time and cost from “wasted exploration”
Most of a long-horizon task’s overhead comes from repeated trial and error. You can inject structured engineering context before the task starts:
- Repository structure and module-responsibility descriptions;
- A playbook of common build commands and handling for frequent failures;
- A summary of task-relevant historical defects and review comments.
Store this context in the team knowledge base and update it periodically as the code evolves.
3. Cost guardrails: Turn “budget” into an enforceable constraint
- Per-task cost limit and wall-clock limit; abort on breach and retain partial artifacts.
- Maximum tool-call rounds per task to avoid falling into meaningless loops.
- Build caching and incremental compilation to reduce repeated dependency downloads and full builds.
- Attribute cost by team, project, and task type to form an observable cost dashboard.
4. Human-machine gates: Agent output must go through the standard review process
- Forbid direct merges into the main branch; all changes enter through merge requests.
- The pipeline automatically runs builds, static checks, unit tests, and UI automation.
- Human reviewers focus on architectural consistency, security compliance, and maintainability, rather than only whether tests pass.
5. Platform support: Carry evaluation infrastructure on general-purpose cloud capabilities
Long-horizon evaluation is essentially a “large-scale, long-duration, isolatable” compute task, which can be supported by general-purpose cloud capabilities:
- Container platform: Hosts the agent runtime and build environment with elastic scaling.
- Object storage: Stores repository snapshots, evaluation artifacts, and complete logs.
- Logging and monitoring/alerting: Tracks task success rate, time, and cost metrics, and raises alerts on anomalies.
- Message queue: Decouples task submission from execution and supports queuing and retries for long-running tasks.
6. Common Anti-Patterns and a Pitfall Checklist
- Looking at pass rate only: Ignoring completion loses the key “how far off” signal, and the optimization direction loses focus.
- Drawing conclusions from a single run: Agent output is stochastic, so you must run multiple times and report dispersion.
- Counting build success as completion: Without behavior verification, this amplifies misjudgments of agent capability.
- Letting acceptance criteria drift with the task: Acceptance standards must be frozen before the task begins and placed under version control.
- Ignoring “acceptance leakage”: If an agent can read the test code or acceptance scripts, it may “customize” the implementation against the assertions.
- Ignoring long-tail time: A few extremely long tasks can significantly raise the average, so report the median and percentiles alongside the mean.
- Comparing across leaderboards directly: Task sets, acceptance bases, timeout thresholds, and cost accounting methods differ, so the numbers cannot be aligned directly.
- Ignoring security and compliance: Agent changes must pass dependency vulnerability scanning, license-compliance checks, and secret-leak detection.
7. Conclusion
The emergence of long-horizon engineering benchmarks marks a shift in how AI coding capability is measured — from “whether it can write correct code” to “whether it can reliably deliver within a real engineering context.” The two typical profiles published around this benchmark — the high-investment approach with high completion and long time, and the fast approach with low time and low cost — have no absolute superiority. The difference lies in the trade-off between exploration depth and resource consumption.
For R&D teams, three pragmatic actions stand out:
- Build your own long-horizon evaluation set and measure continuously with a unified basis.
- Use task routing and cost guardrails to let each agent profile take on the tasks it is best at.
- Ensure controllable output quality with strict human-machine gates and an observable cost system.
Leaderboard data should serve as an input to selection, not a conclusion in itself. What truly determines returns is whether a team can internalize evaluation methods as part of its everyday R&D workflow.
