The Cost and Capability of Multi-Agent Coding: A Practical Evaluation
This article evaluates the cost and capability of multi-agent coding through a real task: refactoring a plotting library's downsampling strategy. It breaks down where token consumption comes from, explains why context expansion—not model pricing—drives the bill, and shows how tiered model scheduling, context trimming, automated verification, and budget limits improve efficiency. Readers will find a reusable cost-governance checklist and the technical points of viewport-driven resampling. The key takeaway is to judge models by cost per unit of effective output rather than token price alone.
1. The Problem: Handing a Coding Task to a Multi-Agent Cluster
A real engineering exercise offers a useful observation sample. One day after a new generation of general-purpose large models was released, a developer handed an algorithm refactoring task for a plotting library to an AI coding toolchain, using a multi-agent orchestration pattern. Every stage was handled by two model sizes from the same model family. The run consumed roughly 48 million tokens, produced a bill close to 60 RMB, and took about as long as a full cycle of cooking and eating a meal. The task itself was to change the downsampling strategy: the original implementation used one-shot downsampling, which tended to produce distortion when a region was locally magnified after the visual window was scaled. The goal was to trigger resampling as the viewport changed.
The value of this case is not how a particular model scores on benchmarks. It puts a long-underestimated issue on the table: the capability and cost of AI coding must be evaluated on the same chart.
2. Where the Cost Comes From: A Structural Breakdown of Token Consumption
48 million tokens for 60 RMB means the unit price is actually low; the real cost comes from the order of magnitude. To understand this, break the consumption into four categories:
- System prompts and tool descriptions: carried again on every call, a fixed overhead that scales linearly with the number of rounds.
- Repository context: file contents, dependency declarations, build scripts—large in size and transmitted repeatedly.
- Reasoning and intermediate artifacts: the model’s thinking process, plan checklists, and assumption-validation records.
- Tool returns: compiler output, test logs, and diff patches, often the longest part of a single round.
Multi-agent mode multiplies these overheads by a factor. The planner, retriever, reviewer, and executor each maintain an independent context and synchronize through message passing, so the same piece of information may appear repeatedly across multiple contexts. Therefore, context expansion rather than model unit price is the main driver of the bill.
A rough mental model:
total cost ≈ Σ(context length per round × number of rounds × number of participating agents)
If any one of the three terms gets out of control, cost rises non-linearly.
3. Capability Observations: Coding Performance in the Same Band as Existing Solutions
In terms of results, all the code passed compilation and test verification, and a version commit was completed automatically. This shows the model has a usable engineering closed loop for long-chain tasks: it can read existing implementations, locate defects, propose changes, and verify itself. Subjectively, its coding performance was on par with another model combination the developer had used before, but at a higher cost.
A more rigorous conclusion is needed here: a single task is not enough to support a horizontal ranking of model capability. Task difficulty, how context is organized, orchestration strategy, and verification strictness all significantly affect results. A reliable evaluation should fix the task set, fix the verification scripts, repeat multiple times and take averages, and record both quality metrics (pass rate, number of reworks) and cost metrics (tokens, duration).
4. Tiered Scheduling: Using Strong Models Where They Matter
One design in the original exercise worth borrowing is model tiering: core reasoning and execution use a strong model at a high reasoning tier; light tasks such as retrieval, document lookup, and quick classification go to a lower-tier small model; visual understanding runs on a separate multimodal size; and more creative-style stages keep a high-temperature configuration. A sketch:
{"reasoning_heavy": { "tier": "large", "effort": "high" },"lookup_and_scan": { "tier": "small" },"visual_input": { "tier": "large", "modality": "multimodal" },"creative": { "temperature": 0.8 }}
The logic is that task value determines the model tier, rather than using the strongest configuration uniformly for every stage. In practice, retrieval and formatting work accounts for many rounds but is low in difficulty; pushing it down to a small model can significantly cut the total. The temperature parameter should also be set per stage: implementation tasks need a low temperature for stability, while naming and copywriting tasks are the ones that need diversity.
5. Viewport-Driven Resampling: The Technical Core of the Task
Setting aside the tooling layer, this algorithm requirement is a common one. The flaw of one-shot downsampling is that sampling density is uniform over the data domain, but after the viewport is scaled the visible range shrinks, and the original sampling interval may become larger than the pixel spacing, causing loss of detail and visual distortion. Viable approaches include:
- Derive the target sampling step from the current viewport interval and pixel width;
- Preserve the extreme points within the interval (extrema-first) so that spikes are not averaged away;
- Recompute only when the viewport changes beyond a threshold, and cache the previous frame’s result;
- Set invalidation conditions for the cache to prevent jitter when zooming and panning alternate.
// Pseudocode: decide sampling density dynamically based on the viewportsize_t target = static_cast<size_t>(viewportWidth / pixelPerSample);if (std::abs(target - cachedCount) < threshold) return cached;return resampleByMinMax(data, viewportRange, target);
This kind of requirement is well suited to agents, because the acceptance criteria are clear and automatically verifiable—which is precisely the key prerequisite for controlling cost.
6. A Reusable Cost-Governance Checklist
- Clarify before starting: ambiguous requirements get amplified repeatedly in long tasks, and the payoff of upfront clarification far exceeds rework after the fact.
- Set budget and round limits: define hard thresholds for tokens and rounds per task; pause and report when exceeded.
- Trim context: feed only relevant files and necessary logs, and avoid scanning the whole repository.
- Automate verification: script compilation, unit tests, and static checks so the model proves itself rather than relying on manual review.
- Commit in small steps: split commits by verifiable units to make rollback easier and to locate cost black holes.
- Keep records and review: log consumption at each stage to build your team’s own cost baseline.
For stronger elasticity and observability, you can run the execution environment on a container platform, collect per-round consumption with logging services and monitoring alerts, and archive artifacts and diffs in object storage, turning cost management based on “gut feeling” into measurable, optimizable engineering metrics.
7. Conclusion
The core judgment from this exercise is that the new generation of models already has capability on par with mainstream solutions for coding tasks, but the cost under default configurations is not competitive. Real efficiency gains come from engineering the orchestration layer—tiered scheduling, context governance, automated verification, and budget constraints. When evaluating models, replace the token unit price with “cost per unit of effective output”; that is the sustainable basis for technology selection.
