Multi-Agent AI Development in Practice: From Single Agent to Multi-Agent Workflows
A widely shared story claims one person built hundreds of thousands of lines of code in five days for about $200 in API costs—but such numbers are hard to verify. This article focuses on what is actually reusable: how to evolve from a single AI agent to a multi-agent setup, covering territory boundaries, contract-first design, orchestration, a four-phase workflow, cost estimation, automated verification, architecture memory, and the areas where human judgment must remain in the loop.
Be Skeptical of the Headline Numbers
Sharing sessions often cite a striking comparison: a traditional team of six people taking 18 months and roughly $4 million, versus an AI-assisted approach with one person, 5 days, and about $200 in API fees, producing hundreds of thousands of lines of code. These figures come from the presenter’s own account, with no published methodology or raw records, so they should not be treated as reproducible results.
Before using such numbers, confirm three things. First, does the cost figure include the developer’s time, environment setup, rework, and test fixes? Second, does the line count include auto-generated boilerplate, dependency lock files, and test code? Third, what were the acceptance criteria, and has the project been validated by real users or in production? If these questions have no answers, the efficiency multiplier is only a reference point.
The rest of this article focuses on reusable methods, not on specific multipliers.
From Single Agent to Multi-Agent
The Single Agent Stage
The earliest usage pattern is having one agent complete a well-defined task, such as “add a login endpoint to the user module and write unit tests.” The agent reads relevant files, modifies code, runs tests, and iterates based on errors. Two bottlenecks appear at this stage: the model’s limited context window means that as the project grows, the agent tends to miss existing conventions; and in long sessions, early decisions get forgotten, causing the same module to be rewritten repeatedly.
The Multi-Agent Stage
When a project contains multiple relatively independent modules, tasks can be distributed to several agents working in parallel. For this to be reliable, three prerequisites are needed.
First, territory boundaries. Each agent is responsible only for fixed directories or files—for example, one agent owns models/, another owns routes/, and a third owns web/. File ownership should be stated explicitly when tasks start, to prevent two agents from modifying the same file.
Second, contracts first. Before parallel work begins, a human or a coordinating agent writes an interface contract file defining data structures and API signatures. Here is a minimal example:
# api_contract.md## User- id: string, unique identifier- email: string, format must be validated- created_at: ISO8601 timestamp string## POST /api/users- Request body: { email: string, password: string }- Success: 201, returns User- Failure: 400 (invalid parameters), 409 (email already exists)
Third, a shared blackboard. Information such as database table structures and agreed enum values is written to shared files, for example schema.sql. Other agents simply read these files instead of reading each other’s full conversation history.
Orchestration and Concurrency Control
Below is a simplified orchestration flow to illustrate the idea; the concrete implementation depends on the interfaces of your tools:
1. The coordinator reads the requirements and generates api_contract.md and schema.sql2. A human reviews both files and freezes them after approval3. Create an independent branch per module, e.g. agent/models, agent/routes4. Each agent works on its own branch, modifying only the directories it owns5. Each agent runs its module's tests and submits a merge request after they pass6. The coordinator merges branches and runs integration tests7. If any agent fails, discard its branch and re-dispatch the task without affecting other branches
Start with a concurrency level of 2 to 3 agents. Watch two indicators: the frequency of merge conflicts, and how often a single agent repeatedly modifies the same file. If conflicts are frequent, the territory boundaries are unclear—adjust the boundaries before increasing concurrency.
Permission isolation matters too. Agents should only have write access to their own directories and must not modify contract files. Contract changes must be confirmed by a human and then distributed uniformly.
A Four-Phase Workflow
Phase 1: Structuring Requirements
Vague ideas need to be converted into structured task descriptions. Use a template like this:
- Feature list: one sentence per feature, e.g. “users can register with an email address.”
- Technical constraints: language version, database type, authentication protocol, deployment environment.
- Non-goals: what is explicitly out of scope this iteration, e.g. “no multi-tenancy.”
- Definition of done: acceptance criteria per feature, e.g. “the registration endpoint returns 409 for duplicate emails, with a corresponding test.”
A useful rule of thumb for task granularity: each agent’s task should be completable and verifiable within a bounded number of steps. Tasks that are too large lead to logical confusion once context is lost; tasks that are too small drive up call counts and integration overhead. Vertical slices by feature are usually easier to manage context-wise than horizontal slices by technical layer.
Phase 2: Context and Cost Control
Costs mainly come from the number of model calls and the token volume per call. A rough formula:
Cost = (calls × average input tokens × input price) + (calls × average output tokens × output price), multiplied by a retry factor.
The following are hypothetical numbers to demonstrate the calculation, not real prices from any provider:
- Calls: 500
- Average input: 20,000 tokens
- Average output: 3,000 tokens
- Assumed input price: $3 per million tokens
- Assumed output price: $15 per million tokens
- Retry factor: 1.5
Input cost: 500 × 20,000 × 3 / 1,000,000 = $30. Output cost: 500 × 3,000 × 15 / 1,000,000 = $22.50. Total: $52.50, or roughly $79 after the retry factor.
For real estimates, substitute the actual prices of the models you use and gather real call counts and token usage from logs. Common cost reductions include reusing cached file reads, putting only relevant files into context, and retrying only failed steps rather than the whole task.
Phase 3: Automated Verification and Review
Tests generated by agents usually catch type errors, null-value access, and obvious interface inconsistencies, but assertions may not be strict enough and coverage may be incomplete. Design tests in layers:
- Unit tests: cover logic branches of individual functions or classes.
- Contract tests: verify that request and response formats match the contract file.
- Integration tests: verify call chains between modules.
- Security scanning: check for dependency vulnerabilities, hardcoded secrets, and common injection risks.
Human review should focus on the diff, not a line-by-line read-through. Checklist items:
- Are all new conditional branches covered by tests?
- Does exception handling swallow errors, or leak too much internal detail?
- Has code touching permissions, encryption, or data deletion been manually confirmed?
- Were any files modified outside the task’s scope?
- Are the versions and licenses of new dependencies acceptable?
Phase 4: Maintaining Architectural Memory
Agents do not automatically remember decisions from previous sessions. The solution is to maintain an ARCHITECTURE.md in the project root. A minimal template might include these sections:
# ARCHITECTURE.md## Architecture Decisions- Decision: use PostgreSQL as the primary database- Rationale: team familiarity, need for transactional support- Date: 2026-10-01## Interface Contracts- See api_contract.md## Technical Debt- User module lacks pagination; planned for the next iteration## Do Not Change- The auth module's password hashing algorithm must not be downgraded- Database migration files must not be modified once merged
After each major change, the agent or a human updates this file. At the start of a new session, have the agent read it before executing tasks.
Where Humans Must Stay in the Loop
Product and Aesthetic Judgment
Agents can generate syntactically correct UI code, but cannot judge whether interactions feel smooth or whether copy matches the brand’s tone. These judgments belong to humans and should be done in a focused review after the interface is complete, rather than letting the agent decide on every change.
Security and Compliance
Code involving permission checks, SQL queries, password storage, or sensitive data encryption should be manually reviewed before merging. When dispatching tasks, this can be written explicitly: “This module requires human review before merging.” For systems handling user data, also run penetration testing or at least a targeted security review.
Architecture Decisions
Monolith vs. microservices, relational vs. document databases—these decisions affect long-term maintenance cost and should be made by the team based on the existing tech stack, operational capabilities, and expected scale. Agents can list the pros and cons of each option, but the decision should stay with humans.
Basic Operational Hygiene
Before letting agents modify code at scale, confirm the following:
- The repository has complete version history and critical branches are protected.
- The database is backed up before migrations, and backups can actually be restored.
- Rollback steps are documented and rehearsed at least once.
- API keys and database credentials are stored in environment variables or a secrets management service—not in code, prompts, or logs.
- Licenses of new dependencies have been checked to avoid incompatible open-source terms.
Frequently Asked Questions
How do I get started with multi-agent collaboration?
Begin with two modules that have clear boundaries, such as the data models and the API layer. Write the contract files first, then have two agents work on their own branches. Expand to more modules and higher concurrency once this works.
How do I calculate cost?
Multiply call counts by average input/output tokens per call, then by the prices of the models you use. Use real data from logs rather than estimates.
What are common mistakes?
One: letting multiple agents modify the same file simultaneously. Two: starting parallel development without contract files. Three: only checking whether tests pass, without verifying the logic meets requirements. Four: merging security-sensitive code without review.
Which scenarios fit, and which don’t?
Well-suited: legacy system refactoring, rapid prototypes, personal tools, and internal scripts. High-risk: core systems with strict security requirements, no automated tests, frequently changing requirements, and no maintainers—fill in testing and review processes first before handing such systems to agents.
Conclusion
The value of multi-agent collaboration lies in splitting tasks clearly, defining boundaries explicitly, and making verification solid. It reduces repetitive work but does not replace requirements analysis, architectural judgment, or security review. Judge whether a method works by whether it consistently saves time, controls cost, and preserves quality in your own project—not by a publicly promoted multiplier.
