Multi-Agent Collaborative Development in Practice: From Coding Assistant to Engineering Team
A practical guide to organizing multiple AI agents for software engineering work. It covers planning, execution, and acceptance roles; environment and configuration governance; a rate-limiting case study; dependency-based parallelization; automated validation; remote access controls; inference cost optimization; and a closed-loop delivery process. The goal is to show how clear task boundaries, controlled shared context, independent verification, and rollback-ready delivery make agent collaboration a reliable engineering capability.
1. From “Let the Model Write Code” to “Organize Models to Complete Engineering Work”
The real challenge of AI-assisted programming is not generating a few code snippets. It is making maintainable, verifiable, and rollback-ready changes in an existing project. A seemingly simple feature request often involves requirements analysis, dependency checks, interface design, implementation, test coverage, security review, and release validation.
If a single agent handles all of this work continuously, three problems tend to appear:
First, goals and details become mixed. While fixing a local error, the model may gradually drift away from the original business constraints.
Second, context keeps expanding. Search results, build logs, and historical discussions consume space, while important decisions become buried.
Third, there is no independent acceptance. Implementers usually validate results along their own design assumptions, which makes incorrect assumptions easy to miss.
The value of multi-agent collaboration is to split these activities into work units with clear responsibilities, inputs, and deliverables. However, adding more agents does not automatically improve efficiency. Parallel collaboration only makes sense when task boundaries are clear, shared information is controlled, and acceptance criteria are explicit.
This article discusses general engineering methods and does not depend on a specific programming environment. Whether a particular feature is available should be based on the actual capabilities, permissions, and version of the tools in use.
2. Establish Three Layers: Planning, Execution, and Acceptance
2.1 Planning Layer: Define the Problem, Not Own Every Change
A planning agent should first answer:
- How does the current system work?
- What business problem does the requirement solve?
- Which behaviors must remain compatible?
- Which design decisions require human confirmation?
- What outcome counts as complete?
Its main deliverables are not code, but design notes, a task dependency graph, a risk list, and acceptance criteria.
The planning layer should retain key decisions, such as why a particular rate-limiting dimension was chosen, why shared counting was adopted, and what strategy to use during failures. This information is better for long-term storage and handoff than a complete chat history.
2.2 Execution Layer: Implement Within a Defined Scope
Execution agents read relevant files, modify code, run checks, and report results. To prevent scope creep, the task description should explicitly define which directories may be changed, which modules must not be touched, and which interface contracts must be followed.
An effective task instruction can look like this:
Add rate-limiting checks to the existing request-processing chain. Modify only the request entry point, the rate-limiting module, and corresponding tests. Do not change the successful response structure. If the authentication flow needs adjustment, a new dependency is required, or the storage structure must change, pause execution and submit a proposal.
When executors encounter architectural conflicts, ambiguous core requirements, or assumptions they cannot verify, they should escalate to the planning layer instead of expanding the change scope on their own.
2.3 Acceptance Layer: Judge Completion Based on Evidence
Acceptance agents should check independently from requirements and interface contracts as much as possible, focusing on:
- Whether the functionality meets the agreement;
- Whether existing behavior was changed unexpectedly;
- Whether tests cover boundary and failure paths;
- Whether logs expose sensitive information;
- Whether there are unauthorized file or dependency changes.
Independent acceptance does not guarantee the elimination of errors. Multiple models may share similar blind spots, so critical operations still require deterministic tests and human approval.
3. Govern the Environment First, Then Migrate Configuration
3.1 Separate Interactive and Execution Environments
A visual interface is suitable for viewing tasks, diffs, and approval records. A command-line environment is suitable for scripted execution and batch checks. Whichever approach is used, it should be clear where agents actually work, which commands they can execute, and which credentials they can access.
Start with an isolated development environment and do not grant write access to production systems by default. Installation sources should be verified. For remote installation scripts, review the content and execution scope before running them rather than executing unreviewed scripts directly.
3.2 Divide Configuration into Tools, Workflows, and Rules
When migrating existing configuration, do not simply aim for a “copy as-is” approach. A more reasonable method is to review configuration by category:
Tool connection configuration determines which external data and services agents can access. Check identity credentials, network scope, read/write permissions, and call auditing.
Reusable task workflows describe the order of common operations, such as reading project instructions first, running baseline tests, and finally submitting a change summary.
Project rules define code style, directory boundaries, security requirements, and approval conditions. Rules should be short, explicit, and verifiable through checks.
Obsolete paths, invalid credentials, and constraints that no longer apply to the current project should be removed proactively. After migration, the first step should be a read-only check, not an immediate project modification.
3.3 Match Model Selection to Task Complexity
High-complexity reasoning is suitable for requirement clarification, architecture design, and cross-module issue localization. Well-bounded implementation, formatting changes, and simple test additions can use lower-cost execution configurations.
Do not set the highest reasoning level as the default for every task. Allocate resources based on the consequences of errors, ambiguity, and verification difficulty.
At the same time, the theoretical context length supported by a model is not the same as the usable length actually exposed by an application. Permissions, input limits, tool outputs, and historical messages can all affect effective space. Engineering practice should rely on concise context rather than assuming an extremely long window can hold all materials.
4. Case Study: Adding Rate Limiting to a Bookmark API
4.1 Define Business Semantics Before Writing Code
“Add rate limiting” is not a complete requirement. At minimum, clarify the following:
- For authenticated requests, should counting be by user identity or by source address?
- How should unauthenticated requests distinguish callers?
- Does the limit apply to a single endpoint or a group of endpoints?
- Who determines the time window and quota?
- What status and message should be returned after exceeding the limit?
- If rate-limit storage is unavailable, should requests be allowed or rejected?
- Can existing clients handle the new failure response?
The source address should not be taken directly from an arbitrary request header. Forwarded information should only be used when the trusted proxy chain is explicit and the application already has a trusted address-resolution mechanism; otherwise, it may be forged.
For authenticated requests, a stable user identifier can be preferred. For anonymous requests, recognize that shared network egress may cause multiple users to share a quota, and avoid treating the source address as an exact identity.
4.2 Choose a Rate-Limiting Algorithm Based on Requirements
A fixed window is simple to implement, but short bursts may occur near the boundary between adjacent windows.
A sliding window can more accurately reflect request volume over the recent period, but usually requires more state or computation.
A token bucket is suitable for controlling long-term average rate while allowing some short-term bursts. It is necessary to define the token refill rate, bucket capacity, and consumption per request.
When choosing an algorithm, focus on business needs rather than only comparing implementation complexity. Preventing occasional accidental operations, controlling resource consumption, and defending against malicious requests may require different strategies.
In multi-instance deployments, independent counting on each instance usually cannot provide accurate global rate limiting. If shared storage is used, ensure that count updates and expiration handling have the required atomicity, so concurrent requests do not distort quota decisions.
4.3 Isolate Implementation Details with an Interface Contract
You can define a general rate-limit decision interface first. The following is pseudocode only and does not correspond to any specific product API:
decision = limiter.check_and_consume(subject = trusted_identity,resource = route_group,timestamp = current_time)if decision.allowed:continue_request()else:respond(status = 429,retry_after = decision.retry_after_seconds)
This contract needs further clarification: whether a call has already deducted quota, how storage errors are represented, how wait time is calculated, and whether the time source is unified.
For normal rate limiting, exceeding the limit can return HTTP 429 and provide a wait hint according to the interface agreement. However, storage failures should not be disguised as normal rate limiting. The system should distinguish “quota exhausted” from “decision service abnormal” and log and handle them separately.
There is no universal answer for whether to allow or reject requests during failures. Ordinary read endpoints may prioritize availability; endpoints involving high-risk operations may prioritize protection. The decision must be confirmed by the business owner and reflected in tests.
5. Parallel Development: Split by Dependencies, Not by Evenly Distributing Files
5.1 Prioritize Tasks That Can Be Completed Independently
The rate-limiting feature can be split into the following work packages:
- Design task: determine identity rules, algorithm, error semantics, and acceptance criteria;
- Core implementation task: complete counting logic and concurrency handling;
- Integration task: call the rate-limiting module in the request-processing chain;
- Test task: write boundary, concurrency, and failure-scenario tests;
- Review task: check compatibility, security, and observability.
Core implementation and integration usually depend on the interface contract. Test design can start earlier, but integration tests must wait until implementation is ready. Reasonable parallelism should be based on these dependencies.
5.2 Define a “Task Contract” for Each Work Package
A task contract should include at least the objective, input materials, allowed modification scope, dependencies, completion criteria, and escalation conditions.
When delivering, do not only say “done.” Provide:
- What was changed;
- Which validations were run;
- Which checks passed or failed;
- Which issues remain unresolved;
- Whether other tasks need to coordinate.
This reduces the orchestrator’s cost of rereading all code and logs.
5.3 Isolate Changes and Control Merge Order
When multiple executors modify the same directory at the same time, overwrites, duplicate implementations, and semantic conflicts are easy to introduce. A safer approach is to use isolated working copies or independent change branches and assign a unified integration owner.
Merging usually follows the order of “contract first, foundational modules next, integration afterward, and integrated validation last.” Even when there is no textual conflict, check for semantic conflicts, such as whether two modules understand error responses, time units, or quota deduction in the same way.
6. Automated Acceptance: Base Conclusions on Reviewable Evidence
6.1 Record a Baseline Before Changes
Before development starts, run existing tests and build checks and record existing failures. Otherwise, it will be impossible to distinguish issues introduced by the current change from issues that already existed in the project.
Test failures should not simply be marked as “environment issues” and skipped. Explain the failure cause, impact scope, and alternative verification method. Without sufficient evidence, mark the result as unverified.
6.2 Cover Normal, Boundary, Concurrent, and Failure Scenarios
Rate-limiting tests should check at least:
- Requests within quota pass normally;
- Requests exceeding quota are rejected;
- Quota recovers after the window updates;
- Counts for different users are isolated;
- Quotas for different resources match the agreement;
- Concurrent requests do not exceed the allowed boundary;
- Storage timeout triggers the predefined failure strategy;
- Existing authentication, authorization, and successful responses remain compatible.
Tests involving time windows should use a controllable time source whenever possible instead of relying on real waiting. Concurrency tests should verify business constraints; the fact that all requests returned a response does not prove that counting is correct.
6.3 Check Whether the Tests Themselves Are Trustworthy
Review whether tests were skipped, whether key assertions are missing, and whether test doubles hide real concurrency or failure problems.
The final acceptance report should list the verification scope, execution results, residual risks, and release conditions. For checks that cannot be executed, explicitly state “not yet verified” rather than assuming they pass.
7. Mobile Remote Operations: Keep Convenience Within Permission Boundaries
Remote task progress checks can reduce dependence on a development machine while waiting, but full terminal access should not be enabled by default.
A reasonable approach is to divide remote capabilities into three levels:
- Read-only viewing: view task status, diff summaries, and test results;
- Restricted approval: approve predefined low-risk operations;
- High-risk execution: change permissions, delete data, deploy to production, and similar operations.
Level 3 operations should require stronger identity verification and explicit confirmation, and should not be triggered by a single natural-language message.
Remote access also needs to consider session expiration, device loss, notification leakage, and operation auditing. Notifications should not contain keys, complete business data, or sensitive logs. If the remote channel is interrupted, tasks should not gain additional permissions as a result.
8. Optimize Inference Cost: Reduce Repetition, Not Acceptance
8.1 Provide Different Context for Different Roles
Planners need system boundaries, requirement constraints, and risk information. Executors need relevant files and interface contracts. Acceptors need acceptance criteria, change diffs, and test evidence.
Copying the entire repository and all chat history to every agent often only increases consumption and comprehension noise. A better approach is to maintain concise design summaries and supplement necessary materials by task.
8.2 Limit Ineffective Retries and Repeated Exploration
Orchestration workflows should set retry budgets and escalation conditions. When the same error repeatedly appears, tests make no progress, or an established plan needs to change, pause and re-analyze instead of continuing indefinitely.
Logs should also be handled in layers: routine reports retain error summaries and necessary context, while detailed output is stored as auditable records to avoid repeatedly sending large amounts of irrelevant logs to the model.
8.3 Measure Cost by Delivery Quality
Token consumption is only part of the cost. It also includes execution time, test resources, human review, and rework.
A more reasonable metric is the total cost required to complete one accepted task. Reducing planning and testing may lower the cost of a single call, but it increases later rework. Too many parallel tasks can also reduce overall efficiency due to coordination overhead.
9. Close the Delivery Loop: Make Multi-Agent Workflows Truly Controllable
A reliable collaborative development process can be summarized as:
Requirement clarification → Environment and permission checks → Design review → Task breakdown → Isolated execution → Automated validation → Independent review → Human approval → Release observation → Rollback if necessary.
Before release, confirm whether the feature has a disable or rollback path, whether rollback involves configuration, data, or dependency changes, and whether post-release monitoring signals are sufficient to identify anomalies. Rate limiting especially requires observing rejection rate, decision latency, storage errors, and user complaints, so the protection mechanism does not end up affecting normal access.
Moving from a single assistant to a multi-agent team is not primarily about “running more models at the same time.” The core change is establishing clear responsibility boundaries and evidence chains. Developers remain responsible for goals, risks, and final delivery; agents take on planning, implementation, and verification within controlled scopes. Only when tasks can be described, processes can be traced, results can be reviewed, and failures can be recovered can collaborative development become a stable engineering capability.
