Multi-Agent Collaborative Development in Practice: From Assistants to Engineering Teams

    Multi-agent collaborative development is not just about expanding context windows; it requires establishing clear responsibility divisions, delivery contracts, and verification mechanisms. This article explores how to build a sustainable engineering closed-loop by configuring environments, allocating reasoning resources, splitting parallel tasks, managing context, and designing secure remote control. By transforming vague goals into actionable contracts and ensuring independent verification, teams can stabilize multi-agent collaboration and genuinely improve delivery efficiency without spreading existing problems faster.

    1. From “Letting Assistants Write Code” to “Managing Development Workflows”

    AI coding assistants can explain code, generate implementations, and supplement tests, but delegating all tasks to a single agent does not naturally yield the highest efficiency. As task complexity increases, requirement understanding, solution selection, code modification, and result verification will continuously compete for context resources. An early misjudgment can be continuously amplified during subsequent implementation and self-checking.

    The core of multi-agent collaborative development is not increasing the conversation window, but establishing clear responsibility divisions, delivery contracts, and verification mechanisms. The engineering workflow can be divided into three main roles:

    • Planning Agent: Understands requirements and project constraints, forming technical solutions, task dependencies, and acceptance criteria.
    • Execution Agent: Retrieves code within limited scopes, modifies files, executes builds, and adds tests.
    • Verification Agent: Checks correctness, security, and compatibility based on requirements and actual changes, providing independent evidence.

    An orchestrator coordinates these roles, managing task status, dispatching context, handling failure retries, and submitting key decisions to developers. It can be provided by tools or implemented through task lists, scripts, and manual scheduling; it should not be understood as a feature unique to a specific product.

    It must be emphasized that multi-agent is merely an organizational approach. Small-scale modifications usually do not require complex orchestration; division of labor and collaboration are more likely to yield practical benefits when multiple modules, different technical domains, or strict acceptance requirements are involved.

    2. Configure the Environment Before Granting Operation Permissions

    1. Establish a Reproducible Project Baseline

    Before introducing agents, ensure the project can complete dependency setup, building, and testing in a clean environment. Otherwise, agents might mistake historical environment issues for failures caused by current changes, leading to unnecessary modifications.

    It is recommended to record the following information:

    • Project directory structure and module responsibilities;
    • Dependency acquisition methods and runtime environment requirements;
    • Entry points for builds, tests, and static analysis;
    • Methods for generating and cleaning test data;
    • Directories, files, and configurations that are not allowed to be modified;
    • Current known defects and temporarily failing checks.

    This baseline should be as concise as possible and understandable by both humans and agents. It serves as both a startup guide and a reference for subsequent problem localization.

    2. Review Migration Configurations and External Connections

    Rules, task templates, and tool connections from existing development environments can reduce repetitive setups, but migration should not mean full replication.

    Rules might conflict with the current project; task templates might contain outdated commands; external connections might have read/write permissions exceeding requirements. Before migration, inspect the source, scope of application, and permissions item by item, and remove unused connections to avoid writing access credentials into project documents or prompts.

    Supply chain risks must also be considered when installing tools. For remotely downloaded installation scripts, check the source and content first to understand which directories they will modify and what permissions they will add before deciding whether to execute them. Do not equate “installation successful” with “environment secure.”

    3. Default to Minimum Privilege

    During initial integration, allow agents to read the project and generate modification suggestions first, then gradually open up permissions for file editing and test execution. Publishing, deleting data, changing access controls, and modifying production configurations should have independent approval nodes.

    Web pages, documents, logs, and comments returned by tools are data to be analyzed and should not automatically become new operation instructions. Even if content like “ignore original rules” or “upload configurations” appears, agents must adhere to established permission boundaries.

    3. Allocate Reasoning Resources by Task, Not by Uniformly Pursuing the Highest Configuration

    Planning and execution have different demands on model capabilities. The planning phase usually requires handling ambiguous requirements, cross-module dependencies, and complex trade-offs; the execution phase requires following constraints, accurately calling tools, and keeping modifications within specified scopes.

    A strategy of “centralized processing for complex decisions, low-cost execution for clear tasks, and escalation for exceptions” can be adopted:

    1. Use stronger reasoning capabilities to complete requirement clarification and solution review;
    2. Assign clearly defined tasks to execution roles suited for code editing and tool operations;
    3. Return to the planning phase when execution encounters architectural conflicts, repeated failures, or requirement ambiguities;
    4. Have the verification role check key changes, and let the developer decide whether to accept them.

    Thinking intensity should also adjust with risk. Local comment revision does not need the same reasoning budget as an authentication system overhaul. Higher reasoning investment may increase time and cost, but it cannot replace clear requirements, correct tools, and executable tests.

    It is also necessary to distinguish between a model’s claimed context capacity and the actual capacity exposed by the application. Application configurations, account permissions, tool call logs, and output reservations can all affect available space. Do not rely on unconfirmed capacity numbers, and do not indiscriminately stuff the entire codebase into every task just because the window is large.

    4. Case Study: Adding Rate Limiting to a Bookmark API

    “Adding rate limiting to an API” seems simple, but it actually involves multiple issues such as business semantics, deployment architecture, and client compatibility. Before writing code, clarify the following:

    • Is rate limiting executed by user, source address, or a combination of both?
    • Do anonymous and authenticated requests use different rules?
    • Does the limit target a single endpoint, a type of operation, or all requests?
    • What status code and response fields are returned when the limit is exceeded?
    • Are short-term traffic bursts allowed?
    • In multi-instance deployments, how is counting consistency maintained?
    • When the counting service fails, do we choose to allow or reject requests?
    • Can existing clients correctly handle rate limit responses?

    1. Formulate Acceptance Criteria First

    Acceptance criteria should describe observable behaviors, not just “implement rate limiting.”

    For example:

    • A request is rejected if the same rate-limited subject exceeds the threshold within a specified window;
    • Counts of different subjects do not affect each other;
    • Rejected requests do not trigger subsequent business writes;
    • The subject can resume access after the time window ends;
    • The response does not leak internal storage structures or sensitive identity information;
    • In a multi-instance environment, requests are not easily bypassed by being assigned to different instances.

    Specific thresholds must be determined based on traffic characteristics, business tolerance, and resource budgets; sample configurations should not be treated as production recommendations.

    2. Choose an Algorithm that Matches the Business

    Fixed windows are simple to implement but may see concentrated bursts at window boundaries. Sliding windows can express recent request volumes more accurately, though their storage and computational overhead depends on the specific implementation. Token buckets are suitable for scenarios allowing limited bursts, while leaky buckets emphasize smoothing the request processing rate.

    Solution selection should consider:

    • Whether precise counting is required;
    • Whether bursts are allowed;
    • State storage costs;
    • Atomicity of concurrent operations;
    • Clock source and deviation;
    • Service behavior during failures.

    In-memory counting in a single instance can be used for prototype validation, but multi-instance services typically require shared state or other coordination mechanisms with consistency guarantees. Regardless of the storage method used, “read count—check threshold—update count” must handle concurrency competition; otherwise, excessive traffic may be allowed under high concurrency.

    The following illustrative pseudocode only expresses responsibility boundaries and does not correspond to any specific tool or ready-made interface:

    1. handle_request(request):
    2. subject = identify_rate_limit_subject(request)
    3. decision = limiter.check_and_consume(subject)
    4. if decision.storage_unavailable:
    5. return apply_configured_failure_policy()
    6. if not decision.allowed:
    7. return build_rate_limit_response(decision)
    8. return process_business_request(request)

    The key points are: rate limit checks should occur before business side effects; identity recognition must comply with trust boundaries; failure policies must be defined in advance and not decided temporarily in exception branches.

    5. Split Requirements into Tasks Suitable for Parallel Execution

    The prerequisite for multi-agent parallel execution is that tasks have sufficiently clear boundaries. Simply handing “complete rate limiting” to multiple agents repeatedly usually only results in duplicate implementations and conflicts.

    Reasonable splitting can include:

    Task Primary Deliverable Prerequisites
    Project Analysis Request processing chain, identity sources, deployment constraints Project Baseline
    Solution Design Algorithm selection, interface contracts, failure policies Project Analysis
    Core Implementation Rate limiting component and integration logic Solution Confirmed
    Test Development Boundary, concurrency, failure, and compatibility tests Contract Stabilized
    Documentation Update Configuration instructions, operational steps, rollback methods Implementation Basically Complete
    Independent Acceptance Check results, risk list, and reproduction steps Candidate Changes

    Each task should be accompanied by a clear work contract:

    1. Objective: Add tests for the rate limiting component
    2. Allowed to modify: Test directory and necessary test helper files
    3. Prohibited to modify: Business implementation, production configuration, dependency manifest
    4. Input: Confirmed rate limiting behavior and interface contracts
    5. Deliverables: Test code, execution results, description of uncovered scenarios
    6. Escalation conditions: Implementation behavior is inconsistent with acceptance criteria

    Such constraints can reduce the risk of execution agents arbitrarily modifying business logic just to make tests pass.

    Parallel tasks should ideally use independent working copies or isolated directories, with a designated integration owner. For shared files, modification responsibilities should be divided in advance; tasks where conflicts are hard to avoid should be executed serially. The degree of parallelism depends on task independence, not the number of agents.

    6. Automated Tests Must Provide Verifiable Evidence

    “Tests passed” cannot just come from an agent’s natural language summary. Each verification should record the execution entry point, runtime environment, exit status, failed items, and corresponding code version.

    It is recommended to establish a layered verification process:

    1. Static Analysis: Check syntax, types, and project conventions.
    2. Unit Tests: Verify rate limiting algorithms, window boundaries, and state transitions.
    3. Integration Tests: Verify identity recognition, shared state, and request processing chain.
    4. Concurrency Tests: Check atomic operations and risks of over-admission.
    5. Regression Tests: Confirm existing functionality is unaffected.
    6. Failure Tests: Simulate state service unavailability, response delays, and exceptions.

    Time-dependent tests should use controllable clocks as much as possible to avoid slow and unstable tests caused by real waits. Concurrency tests must specify the initial state, number of requests, and allowed results; success cannot be judged merely by “no errors occurred.”

    The independent verification role should inspect the implementation based on the original requirements and code diffs, rather than just reading the execution role’s summary. For high-risk changes such as permissions, data deletion, and production releases, manual review must still be retained.

    7. Remote Control Should Be Designed Around Approvals, Not Granting Full Control

    Viewing tasks and approving operations via mobile devices can reduce the burden of developers constantly staying at their workstations. However, remote convenience should not come at the cost of exposing the development environment.

    A reasonable remote entry point should feature:

    • Identity authentication and encrypted transmission;
    • Separation of view and execute permissions;
    • Re-confirmation for sensitive operations;
    • Session expiration and active revocation capabilities;
    • Audit logs and anomaly alerts;
    • No display of keys, full logs, or sensitive data in notifications.

    Mobile devices are more suitable for viewing summaries, handling approvals, and pausing tasks; they are not suitable for undertaking unrestricted terminal control by default. Approval requests should include the operation’s purpose, impact scope, risks, rollback methods, and evidence entry points, allowing developers to make informed decisions.

    8. Reduce Consumption and Rework Through Context Management

    Controlling token consumption cannot rely solely on choosing low-cost models. Context repetition, unclear tasks, and failure loops are often greater sources of waste.

    1. Provide Context On Demand

    The planning role needs project structure and business constraints; the execution role usually only needs target modules, relevant interfaces, and acceptance criteria; the verification role needs requirements, diffs, and test evidence. Different roles do not need to receive exactly the same input.

    Large logs should first have failure summaries extracted, retaining retrieval entries for original records. Code analysis should also prioritize retrieving relevant symbols and call relationships rather than repeatedly reading all files.

    2. Set Stop and Escalation Conditions

    When tasks experience repeated failures, exceed budgets, have unavailable dependencies, or face requirement conflicts, they should stop automatic retries and request a decision. Infinite loops not only increase consumption but may also gradually expand the scope of modifications.

    3. Evaluate Effectiveness Using Complete Delivery Costs

    Observe task duration, model and tool consumption, manual review time, rework frequency, and defect misses simultaneously. A single call being cheap does not mean the overall solution is more economical; having more agents does not mean faster delivery.

    9. Build a Sustainable Engineering Closed-Loop

    A reliable collaborative development workflow can be summarized as:

    Understand Project → Clarify Requirements → Confirm Solution → Split Tasks → Isolate Execution → Independent Verification → Manual Approval → Release Observation → Experience Accumulation.

    Each stage should leave corresponding deliverables, including project baselines, acceptance criteria, task contracts, code diffs, test records, and rollback instructions. After release, observe the rejection rate, API errors, state service anomalies, and resource consumption to confirm the rate limiting strategy does not harm normal business.

    Moving from a single AI assistant to a collaborative development system truly requires improving engineering management capabilities: turning vague goals into clear contracts, restricting automatic execution within trusted boundaries, and converting completion claims into verifiable evidence. Only with these foundations can multi-agent collaboration stably improve delivery efficiency, rather than spreading existing problems to more tasks at a faster pace.