The Cost and Capability of Multi-Agent Coding: A Practical Assessment

    A hands-on look at what multi-agent coding actually costs and where it delivers. Based on a real graphics library refactor, this article breaks down token consumption by agent role, explains why cost scales with context turnover rather than lines of code, and outlines practical strategies—role tiering, context minimization, and staged commits—for keeping multi-agent workflows within a predictable budget.

    1. Background: A Real Cost Revealed by a Graphics Library Refactor

    A developer used an AI coding tool to rework the algorithm in a self-built graphics library. The original strategy downsampled once; the new approach triggers re-sampling whenever the visual viewport changes, eliminating distortion after local zoom.

    The task itself was well bounded, but the execution used multi-agent collaboration: planning, retrieval, coding, review, and execution roles were all handled by model instances. Heavy work ran on a high-capability tier, light work on a low-latency tier.

    The result: the task completed, the code compiled and passed tests, and a version record was committed automatically—but token consumption reached the tens of millions, costing about 60 RMB. The value of this case is not the amount itself, but that it puts a long-overlooked issue on the table: once a coding task is decomposed into multiple rounds of agent dialogue, cost is no longer tied to “lines of code” but to “context turnover.”

    2. Capability Observations: On Par with Mainstream Solutions

    Judging by verifiable results, the model performed as expected on a medium-scale refactor: it understood the existing code structure, located the algorithmic flaw, produced compilable changes, and completed self-verification alongside the tests. This is common capability among first-tier models today and not a differentiating advantage.

    Three engineering details are what actually separate the experience:

    1. Instruction clarification quality. Whether the task requires multiple rounds of follow-up questions directly determines the rework rate.
    2. Long-context stability. When project files, dependency definitions, and commit history enter the context at the same time, does the model still hold to its constraints?
    3. Self-verification loop. Can it proactively run builds and tests, rather than only producing patches that “look right”?

    3. Cost Breakdown: Where the Money Goes

    Grouping tens of millions of tokens by role typically shows this distribution:

    • Repeated context billing: the same batch of files is read repeatedly during planning, coding, and review—the largest share.
    • Reasoning tier premium: high reasoning tiers cost more per unit; using them indiscriminately across the whole pipeline significantly inflates cost.
    • Ineffective exploration: retrieval roles return many low-relevance fragments, which adds to downstream processing.
    • Serial waiting: strong dependencies between roles stretch total duration, and the human waiting cost is underestimated.

    An illustrative tiered configuration (fields are generic examples, not a specific product interface):

    1. {
    2. "roles": {
    3. "planner": { "tier": "high", "reasoning": "enabled" },
    4. "coder": { "tier": "high", "reasoning": "enabled" },
    5. "reviewer": { "tier": "high", "reasoning": "enabled" },
    6. "searcher": { "tier": "low", "reasoning": "disabled" },
    7. "formatter": { "tier": "low", "reasoning": "disabled" }
    8. }
    9. }

    4. Optimization Strategies: Bringing Cost Back Within Budget

    1. Role tiering: use the high tier only for planning, core coding, and review; use the low tier for retrieval, formatting, and comment completion.
    2. Context minimization: dispatch a file whitelist per task and prohibit full-repository scans; split long documents into fragments loaded on demand.
    3. Staged commits: freeze a version at each verifiable milestone immediately, avoiding one long task