Code Agent Evaluation and Cost-Aware Selection in Practice
This article explains how to evaluate code agents for production when list prices are close. It covers measurable task sets, success criteria, budgets, failure classification, harness and sampling effects, true costs from caching and retries, API contract testing, a two-week comparison process, and the verifiable advantages to preserve when choosing a model.
When prices are close, selecting a code agent is no longer a single-point judgment about “who is cheaper” or “who ranks higher.” It becomes a decision that must consider the task, the harness, the billing basis, and engineering fit at the same time. Public benchmarks can indicate a capability ceiling, but they rarely match your repository, permission boundaries, and cost of failure. The following sections lay out an actionable approach so that numbers from a single release point are not treated as long-term conclusions.
Turn the Problem from Product Experience into Measurable Questions
A code agent usually has to complete multi-step actions: read the repository, locate the change, execute commands, revise based on errors, and finally produce a mergeable patch. The difference from single-turn question answering is that failures often occur in intermediate steps, not in the final sentence. At minimum, four things should be fixed when making comparisons.
First, the task set should come from real workflows, not only from public collections. Public problems are suitable for regression testing, but once the problem statement, tests, and reference solution have been optimized repeatedly, scores can rise without necessarily transferring to private code. A more reliable approach is to keep a small subset of public problems for comparison while building the main set from internal defect fixes, dependency upgrades, API changes, and documentation synchronization.
Second, success criteria should be automatically determinable. Tests passing, static checks passing, the patch being applicable, and no unauthorized changes are all more useful than “the answer looks reasonable.” For tasks that cannot be automatically judged, sample them separately for human review and record the review criteria to avoid drift between reviewers.
Third, the budget should be written as a constraint, not explained after the fact. Limit the maximum number of turns, maximum context, allowed tool types, and per-task cost cap. Otherwise, a model can raise its success rate by retrying more, and the comparison loses meaning.
Fourth, failures should be classified. Insufficient permissions, missing environment, hallucinated file edits, misunderstanding of tests, and premature declaration of completion all require different responses. Reporting only a total score hides whether you really need to improve the model, the tools, or the process.
The Evaluation Harness Changes the Score
The same model can differ by what looks like a full version iteration under different execution harnesses. The harness determines the system prompt, tool definitions, context trimming, retry policy, whether parallel exploration is allowed, and when to stop. If an official or third-party evaluation uses a “minimal mode” or a higher setting, that usually means more thorough search, looser temperature and sampling, and later stopping conditions. This can measure the capability ceiling, but it cannot be directly treated as the score of the default online configuration.
When comparing, report three sets of results at the same time.
- Fixed harness: all candidates use the same tool protocol, the same context strategy, and the same stop conditions, to look at the model itself.
- Recommended harness: each candidate uses the maintainer’s recommended default configuration, to look at out-of-the-box experience.
- Ceiling harness: allow higher sampling and more retries, but list cost and latency separately, to look at potential rather than daily performance.
Sampling parameters should also be written into the report. Higher temperature and looser nucleus sampling can sometimes increase the chance of finding a feasible patch, but they also increase instability and invalid calls. If one set of results uses higher temperature and higher top-p while another uses conservative decoding, the difference cannot all be attributed to a model update. Improvements from preview to general availability should be checked against training or alignment changes, evaluation harness changes, and whether the task set is consistent. If any of the three is missing, the conclusion can only be written as “an improvement was observed,” not “capability has stably exceeded a certain level.”
A simple record structure can prevent later misalignment:
task_id, model, harness, temperature, top_p, max_turns,cache_policy, success, tests_passed, tokens_in, tokens_out,wall_time, cost, failure_type
With this table, you can answer whether a score changed because of the model, the harness, or more spending.
Unit Price Tables Cannot Replace Real Cost
The list prices for input and output are only one layer of the bill. The real cost of a code agent is also affected by caching, peak and off-peak periods, and retries.
Cache misses and cache hits should be calculated separately. If long system prompts, repository summaries, and tool descriptions can be reused across turns, input costs drop noticeably; if tasks switch frequently and context is rewritten every time, the workload is close to full cache misses. During selection, track the hit rate instead of only citing “the cache-miss price per million tokens.” Output is usually more expensive, and multi-step agents tend to repeat generation across explanations, plans, and patches, so the output share is often higher than in single-turn conversations.
Peak and off-peak pricing changes the monthly bill for the same traffic. If batch evaluation, overnight indexing, or non-urgent fixes can be placed in lower-price periods, the average price will be below the list price; if failure fixes are concentrated at peak times, capacity planning should use peak prices. When comparing two options, replaying the same week’s real call curve is closer to a procurement decision than using a static price list.
Retries are a hidden multiplier. If success rises from 60% to 75%, but the average number of turns increases from 8 to 14, total cost may rise rather than fall. Look at both “average cost per successful task” and “average cost including failed attempts.” The latter is the online budget.
When prices are close, the advantage usually shifts to structural factors: whether caching is stable, whether output is restrained, whether failures stop early, and whether peak traffic can be diverted. When list prices differ only slightly, engineering differences often exceed the difference in list price.
Interface Shape Determines Migration Cost
Whether a model can complete coding tasks also depends on whether it fits the calling conventions you already use. Common differences include whether the response is one-shot text or recoverable multi-segment events; whether tool calls are structured fields or embedded in the body text; whether the context supports explicit cache markers; and whether error codes can distinguish rate limiting, context length overflow, and tool failure.
A contract test before migration is enough; you do not need to bind to any one vendor’s interface names. Use the same set of requests to cover normal completion, multi-turn follow-up, successful tool calls, failed tool calls, mid-stream cancellation, and very long context. Record whether fields are stable, whether streaming fragments can be concatenated, and whether billing fields match the gateway. If a separate proxy has to be written for a specific model, include that adaptation work in the three-month total cost of ownership rather than looking only at the token unit price.
At the gateway layer, keep only neutral fields so that business code does not depend on a specific response format:
request: messages, tools, max_turns, temperature, cache_hintresponse: text, tool_calls, stop_reason, usage, error_class
The business side consumes only these fields. When the model or region changes, change the adapter, not the agent’s main loop.
An Executable Comparison Process
It is better to spend two weeks completing a selection cycle than to change the default routing on release day.
In the first week, fix the harness. Select 30 to 50 internal tasks covering fixes, refactoring, test completion, and read-only analysis. All candidates use the same tools, the same turn limit, and the same decoding parameters. Output success rate, human acceptable rate, average cost, P95 latency, and failure type distribution.
In the second week, open up the recommended configurations. Allow each candidate’s default harness, but keep the cost cap unchanged. If a solution scores higher but exceeds the cap, record it as “ceiling capability” rather than “default deployable.” At the same time, replay one week of traffic and run sensitivity analysis at flat price, peak price, and assumed cache hit rates. If the conclusion flips when the hit rate moves up or down by ten percentage points, your advantage comes from caching rather than the model.
Roll out through canary releases rather than a one-time switch. Route low-risk, rollback-able tasks to the new route first, and keep the old route for permission-sensitive repositories or those with heavy legacy burden. Review failure types weekly. If a certain class of error keeps rising, improve tool descriptions, context trimming, or stop conditions before switching models again.
How to Read “General Availability vs. Preview” Improvements
An obvious score increase from preview to general availability may come from weights and alignment, but it may also come from the evaluation harness, task filtering, or a higher compute tier. When reading the material, focus on three questions: Is it the same task set? Is it the same execution harness? Is it the same level of decoding and retry budget? If any answer is no, the improvement should be reported in parts. When retesting internally, prioritize reproducing the “fixed harness” rather than matching the other party’s highest score, because what you are buying is repeatable daily performance.
It is also unwise to interpret a single price adjustment as the long-term price gap disappearing or widening. Billing rules, cache discounts, and regional capacity all change. Write the comparison conclusion as “relative position on a certain billing basis and task set,” and note the retest date. That is more reliable than writing a permanent ranking.
Advantages Worth Preserving in Decisions
When list prices are already close, the differences still worth preserving are usually not slogans but verifiable items: success rate and variance under a fixed harness; per-task cost including failed retries; effective input price after cache hits; queueing and rate limiting during peak hours; stability of the tool-call format; and adherence to your repository’s permission model. Whichever gap is largest is where engineering investment should go.
Increased competition benefits users, but the benefit lies in replaceability and measurability, not in chasing every release note. Fix the tasks, scaffold, budget, and billing basis, and when prices are close you will still know where to route traffic and when to spend money on the harness rather than the model.
