The Cost and Capability of Multi-Agent Coding: A Real-World Evaluation

    This article evaluates the cost structure and capability boundaries of multi-agent coding through a real engineering case: refactoring a downsampling algorithm in a graphics library. It explains why a single task consumed roughly 48 million tokens, how input tokens dominate the bill, and why current mainstream models perform at a similar level on structured engineering work. You will also find a layered model configuration template, a practical cost-control checklist covering instruction clarification, context compression, caching, budget gates, and observability, and guidance on treating tokens as a managed budget.

    1. The Problem: Handing a Coding Task to an Agent Cluster

    In a real medium-to-large engineering overhaul, a developer handed the refactoring of a downsampling algorithm in a graphics library to a multi-agent coding framework. Every stage was handled by the same family of newer-generation large models. The run consumed roughly 48 million tokens, translating to a cost of close to sixty yuan, and took about as long as cooking and finishing dinner.

    The task itself was a pure engineering problem. The existing implementation used one-shot downsampling, which produced visible distortion in locally zoomed regions after the visual window was scaled. It needed to be changed so that resampling is triggered as the viewport changes.

    The value of this case is not any specific product. It is that the case fully exposes a general question: what exactly are the capability boundaries and cost structure of multi-agent coding?

    Note that this article does not evaluate any specific vendor’s model. It abstracts the case into a general technical paradigm of “layered model orchestration plus multi-role collaboration” and discusses how that paradigm performs and what it costs in real engineering work.

    2. Task Profile: Why This Kind of Work Burns So Many Tokens

    Refactoring a downsampling algorithm looks local, but it actually pulls on the entire chain:

    • High context reconstruction cost: Agents must first understand the library’s layer structure, coordinate mapping, and viewport event model before they can decide where to insert the resampling trigger.
    • Long verification loop: Correctness in a graphics library depends on both compilation and visual checks. Agents must repeatedly compile, run, and compare, reloading context on every round.
    • Exploratory reads inflate the input: Locating relevant files, searching for call sites, and reading commit history are all “read” actions whose input tokens often far exceed the volume of code finally written.

    This explains a commonly misunderstood phenomenon: the 48 million tokens were not 40 million tokens of written code. The vast majority went into understanding, retrieval, and self-verification. When evaluating agent cost, the input token share is usually the dominant term.

    3. Capability Assessment: In the Same Band as Existing Approaches

    In terms of results, the newer-generation models performed roughly on par with the combination of tools used previously: they completed a cross-file refactor, passed compilation, passed tests, and committed version records automatically. This suggests that the capability of current mainstream large models on structured engineering tasks has entered a plateau. Differences show up more in style and stability than in whether the work can be done at all.

    Three engineering dimensions are what actually create separation:

    1. Quality of instruction clarification: High-quality clarification before the task starts directly determines how many rework rounds follow.
    2. Role division design: Separating planning, retrieval, implementation, and review significantly reduces wasted reasoning.
    3. Degree of verification automation: The more automated compilation and testing are, the more efficiently agents can correct themselves.

    4. Cost Breakdown: Where the Money Goes

    Breaking the bill apart yields an approximate formula:

    1. total cost ≈ Σ(input tokens × input price) + Σ(output tokens × output price) + extra rounds from retries and rollbacks

    The input side is usually by far the largest share. A multi-agent architecture multiplies this term: every sub-role has to carry its own copy of the necessary context, and passing summaries between roles generates new input on top of that. This is why “use the strongest model for every stage” is an expensive but simple strategy.

    5. Layered Configuration: A Model Matrix Instead of One-Size-Fits-All

    The configuration approach in the case is worth abstracting into a general template: tier the roles by cognitive load.

    1. {
    2. "roles": {
    3. "planning": { "tier": "strong", "variant": "high" },
    4. "review": { "tier": "strong", "variant": "high" },
    5. "implement": { "tier": "strong", "variant": "high" },
    6. "retrieval": { "tier": "light" },
    7. "exploration":{ "tier": "light" },
    8. "quick-fix": { "tier": "light" }
    9. },
    10. "categories": {
    11. "visual": { "tier": "strong", "temperature": 0.3 },
    12. "artistry": { "tier": "creative", "temperature": 0.8 },
    13. "unspecified-low": { "tier": "light" },
    14. "unspecified-high": { "tier": "strong" }
    15. }
    16. }

    Three points matter here. Retrieval and exploration work goes to lightweight models. Planning and review, which require long chains of reasoning, go to strong models with the high reasoning setting enabled. Creative and visual tasks keep a higher temperature. The temperature parameter is a general sampling setting: low temperature suits deterministic engineering, high temperature suits divergent expression.

    6. An Actionable Cost-Control Checklist

    • Clarify before starting: Write down acceptance criteria, scope of impact, and off-limits areas to cut down rework rounds.
    • Compress context: Feed in only relevant files and interface summaries instead of the whole repository.
    • Cache and reuse: Cache stable retrieval results locally to avoid repeated input.
    • Set budget gates: Give each task a token ceiling and a timeout, and escalate to a human once a threshold is crossed.
    • Layered fallback: Let a lightweight model fail twice before escalating to a strong model, rather than running everything on the strongest model from the start.
    • Observability: Wire in logging and monitoring with alerts, and track tokens and latency per role to locate cost hotspots.

    If you need elastic capacity for this kind of batch inference, you can scale out horizontally on a container platform, store intermediate artifacts in object storage, and distribute tasks with a message queue. These are all general cloud capability categories.

    7. Conclusion

    The core takeaway from this practice: newer-generation models sit in the same capability band as existing mainstream approaches for coding, with no significant difference in capability but a higher cost. For developers, the rational move is not to chase a single strongest model, but to build an engineering system with layered orchestration, strict clarification, automated verification, and budget constraints. Only when tokens are managed as a budget can multi-agent coding move from “it runs” to “it is sustainable.”