Are AI Coding Agents Actually Good? It Depends on the Model, the Engineering, and the Cost

    Choosing an AI coding agent is not about finding the single strongest tool. It is about finding the option with the lowest total cost under your own constraints. This article presents a vendor-neutral framework for evaluating coding agents across three multiplicative layers: model capability, engineering harness quality, and per-task cost. It covers a task autonomy ladder from L0 code completion to L4 long-horizon autonomous work, the difference between nominal and effective context windows, structured output reliability, six core harness design decisions, a cost formula, a reproducible evaluation workflow you can run on your own repository, and a checklist of common pitfalls including prompt injection and over-broad permissions.

    1. Ask the Right Question First: Not “Which Is Stronger,” but “Which Fits Better Under Which Constraints”

    Asking whether one coding agent is better than another is nearly impossible to answer in a real engineering context, because the question omits three necessary constraints: task distribution, resource and compliance constraints, and the cost of human involvement. The same agent may excel at adding comments to a single file yet fail repeatedly on a refactor spanning ten files; it may feel smooth with unlimited quota and become nearly unusable when rate-limited at peak hours.

    A more precise formulation is this: the practical usability of a coding agent ≈ model capability ceiling × engineering packaging quality × controllability of per-task cost. These three factors are multiplicative. If any one approaches zero, the overall experience collapses. An agent with a strong model that keeps failing to apply patches and requires a human to confirm every step will have its throughput locked by human waiting time. Conversely, no matter how polished the engineering is, if the model cannot follow a cross-file call chain, the agent is limited to completion-level work.

    The goal of this article is not to recommend a particular tool, but to offer a vendor-neutral evaluation and decision framework that helps teams reach verifiable conclusions against their own codebase, budget, and compliance requirements.

    2. Capability Tiers: Different Task Levels Demand Different Capabilities

    The first step in evaluation design is to group coding tasks by autonomy level:

    • L0 code completion: continuation from the current cursor context. Measures latency and local correctness.
    • L1 single-file Q&A and editing: explaining code, changing one function. Measures instruction following and patch accuracy.
    • L2 multi-file coordinated changes: adding an interface and updating its callers, changing a data structure and fixing serialization logic. Measures cross-file retrieval and dependency inference.
    • L3 repository-level tasks: fixing real defects, adding tests until they pass, performing standardized bulk refactors. Measures the “locate–modify–verify” loop.
    • L4 long-horizon autonomous tasks: multi-step work requiring repeated execution and rollback. Measures long-horizon consistency, error recovery, and termination judgment.

    Most evaluations go wrong for one reason: they infer L3 usability from an L1 demo. During selection, be explicit about which tier holds your team’s most frequent and most painful tasks, and weight the evaluation set toward that tier.

    3. The Model Layer: Four Variables That Set the Capability Ceiling

    3.1 Code Comprehension and Reasoning

    What truly separates models is not syntax completion but semantic localization: given an error, can the model infer that the real root cause is an overlooked null check in another file? When evaluating, watch for “does this require the human to hint at file paths.” A model that needs a lot of hinting has effectively shifted the work onto the person.

    3.2 Nominal Context vs. Effective Context

    “Supports million-token context” is a capacity metric, not a quality metric. The industry widely observes information-utilization decay in long contexts: key information placed in the middle is more likely to be missed, and as input grows, attention is diluted, reasoning steps lengthen, and prefill time and cost rise accordingly.

    Evaluating long context therefore requires testing at least three things:

    1. Needle retrieval: embed several unrelated facts in a long document and measure the distribution of recall positions.
    2. Multi-hop reasoning: tasks that require chaining two constraints located far apart to reach an answer.
    3. Long-task decay curve: how the pass rate for the same class of small task changes as conversation turns accumulate.

    A more reliable engineering practice than piling on context indefinitely is context budget management:

    1. # Illustrative: context budget allocation for a single request (vendor-neutral)
    2. budget = 200_000 # in tokens; reserve 60%~70% of the actual window
    3. allocation = {
    4. "system_and_rules": 4_000, # project conventions, output format constraints
    5. "task_statement": 2_000, # current task description
    6. "retrieved_code": budget * 0.5, # retrieved relevant file snippets
    7. "repo_index_digest": budget * 0.2, # directory structure and symbol index summary
    8. "history_summary": budget * 0.2, # compressed summary of prior turns
    9. "reserve_for_output": 8_000,
    10. }

    Combined with repository indexing and symbol retrieval, segmented summary compression, and on-demand tool reads (the agent opens files itself instead of stuffing everything in at once), this typically improves L3 pass rates more than simply enlarging the window, while significantly reducing cost.

    3.3 Instruction Following and Structured Output Stability

    Every agent step depends on machine-parseable output (patch content, tool call arguments). Evaluation must track a format violation rate: illegal escaping, misaligned line numbers, missing arguments, emitting natural language where a tool call was required. If this metric is poor, all downstream engineering optimization is moot.

    3.4 Consistency Across Multi-Turn Tool Calls

    Good behavior includes: correct argument values, not repeating the same failing call, changing strategy based on errors, and converging proactively within the step budget with a summary. Evaluation should record average step count and the proportion of wasted steps, not just whether the final result passed.

    4. The Engineering Layer (Harness): Six Design Decisions That Set the Capability Floor

    Once the gap between models narrows, engineering packaging becomes the dividing line in user experience.

    1. Tool set design: follow a minimal-sufficient-set principle covering “read file, search symbols, write patch, run command, run tests.” Too many tools dilute selection accuracy; too few force the model to express operations indirectly in natural language, reducing reliability.
    2. Patch application reliability: require changes to be submitted as patches in a unified diff format, validate context before writing, and on conflict automatically re-read the latest file and retry rather than overwriting the whole file. This is the main source of “it broke things” incidents.
    3. Permission tiers and sandboxing: distinguish four categories — read-only operations, writes within the repository, dependency installation, and destructive commands (deletion, force-resetting the repository). The last two should require explicit confirmation by default; isolate the execution environment in a container and restrict outbound network access.
    4. Failure recovery and replanning: feed a condensed summary of compile errors and test failures back to the model, and set maximum step and retry counts to avoid infinite loops burning quota.
    5. Verification loop: let the machine be the judge. After a change, automatically run relevant tests, type checks, static analysis, and the build, replacing “looks correct” with objective signals.
    6. Observability and replayability: fully record each step’s input summary, tool calls, elapsed time, and token consumption, and support replaying a task. Otherwise you cannot tell whether a problem lies with the model or with the packaging.
    1. # Illustrative: skeleton of an agent execution loop
    2. def solve(task, repo, limits):
    3. ctx = build_context(task, repo) # relevant context within budget
    4. for step in range(limits.max_steps):
    5. action = model.next_action(ctx) # structured output: tool name + arguments
    6. if action.type == "final":
    7. return verify(task, ctx)
    8. obs = sandbox.run(action, # controlled execution
    9. approvals=policy(action),
    10. timeout=limits.step_timeout)
    11. ctx.append(summarize(obs)) # compress observation, control context growth
    12. if is_looping(ctx):
    13. ctx.append(hint("Strategy is repeating; change approach or converge"))
    14. return failure_report(ctx)

    5. The Cost Layer: Translating “Good” Into “Dollars per Task”

    Cost evaluation cannot look at unit price alone; it must look at total cost per task:

    cost per task ≈ (average input tokens × input price + average output tokens × output price) × average turns × (1 + retry factor)

    Four key variables drive this number: context compression quality (which directly determines input token volume), prefix cache hit rate (if repeated system prompts and project conventions hit the cache, cost drops substantially), retry factor (raising the first-attempt success rate from 60% to 80% nearly halves retry cost), and concurrency and rate limits (queuing at peak hours turns “cheap” into “unusable”).

    For products that use subscription plans or trial credits, also convert to “the number of effective tasks completable per unit of time,” and amortize promotional factors such as quota bonuses and trial grants over the billing cycle rather than making long-term decisions based on experience during a promotional period.

    6. A Reproducible Evaluation Plan (A Workflow You Can Implement Directly)

    1. Build the task set: mine 30–50 real tasks from your own repository, covering L1–L4, each with automatically verifiable acceptance criteria (unit tests or static assertions). Real defect tickets and historical change records are the highest-quality source material.
    2. Freeze the environment: prepare a clean repository snapshot, a locked dependency manifest, and a deterministic build command for each task, all packaged into a container image so results stay comparable across time and tools.
    3. Define metrics: first-attempt pass rate (most important), eventual pass rate, average steps, average elapsed time, cost per task, patch precision (did it change only the lines that should change), dangerous command trigger rate, and human takeover rate.
    4. Automate the verdict: use test results as the sole judge to keep subjective scoring from contaminating conclusions.
    5. Persist observability data: pipe evaluation logs, metrics, and alerts into a unified logging and monitoring/alerting system. If your team already uses cloud development environments, you can build an isolated, reproducible, observable evaluation environment using general-purpose cloud capabilities such as container platforms, object storage, logging services, and monitoring/alerting services (for example, these general capability categories on Baidu AI Cloud), and archive evaluation artifacts to object storage for long-term comparison.
    6. Version the evaluation results: both models and tools drift. Re-run the baseline after every upgrade so that “it worked last week” does not turn into an unexplainable regression.

    7. Practical Points for Selection and Migration

    • Build a model-agnostic adapter layer: abstract model invocation into a unified interface for conversation and tool calls, and put model names, keys, and endpoints in configuration files so switching backends requires no business code changes.
    • Check a key-differences list: context window and effective context behavior, stability of the tool-calling protocol, structured output success rate, concurrency and rate-limit policies, logging and tracing capability, and data-egress and compliance requirements.
    • Roll out gradually rather than switching all at once: first run the new option in “shadow mode” (generate suggestions without applying them) and track first-attempt pass rate and the amount of human modification; once targets are met, trial with a small traffic share, then expand step by step.
    • Keep a rollback path: isolate any automated change on a version control branch and retain one-click rollback capability.

    8. Common Pitfalls and a Risk Checklist

    • Trusting only demos and leaderboards: demos usually cherry-pick L1 tasks and correlate weakly with the L3 experience.
    • Ignoring first-attempt pass rate: an option that eventually passes but needs three rounds of human edits on average costs more in labor.
    • Over-broad permissions: running commands without approval, connecting directly to production, or holding deletion rights are major risk sources.
    • Prompt injection: documentation, comments, and dependency descriptions in a repository may contain malicious instructions. After reading external content, its instruction priority must be lowered, and executed actions must pass a policy check.
    • Data compliance: hard constraints such as secret scanning up front and keeping sensitive code within your boundary belong in configuration, not in good intentions.
    • Dependency poisoning and supply chain risk: automatic dependency installation requires pinned versions, source verification, and restricted outbound network access.

    9. Conclusion: A Decision Checklist You Can Use Right Away

    Return to the original question: “Which coding agent is better” should be replaced by four testable questions. What is its first-attempt pass rate on my kind of task? Can its effective context cover my retrieval needs? Can its engineering packaging deliver reliable patches, controlled execution, and verifiable results? Is its per-task cost bearable under my quota and rate-limit constraints?

    Quantify the three layers — model, engineering, and cost — separately, then run them once against your own task set. The conclusion will be more reliable than any comparative review. Selection is not about finding the “strongest tool,” but about finding the option with the lowest total cost under your constraints — and that is exactly the starting point for turning subjective impressions into reproducible engineering decisions.