Multi-Agent Collaborative R&D: From Code Generation to Systems Engineering

    The discussion around AI-driven software development is shifting from single-turn code generation to multi-agent collaboration for delivering complex systems. This article explores this transition, detailing how to define delivery boundaries, decompose tasks based on dependencies, establish layered collaboration mechanisms, and manage shared context. It also covers enforcing quality gates, implementing closed-loop scheduling, evaluating effective delivery costs, ensuring permission isolation, and adopting a phased approach for enterprise implementation, providing a comprehensive guide to building robust multi-agent engineering loops.

    1. From “Generating Code” to “Delivering Systems”: What Actually Changes?

    The discussion around intelligent R&D is shifting from how much code an AI can write in a single query to whether multiple agents can continuously collaborate to deliver complex systems. Operating system prototypes often become the focus of these discussions because they simultaneously involve boot processes, memory management, device access, file storage, and graphical interaction. An error in any single component can block the entire system from running.

    However, when discussing such cases, it is crucial to distinguish between experimental descriptions, reproducible results, and mature engineering capabilities. Claims regarding the number of agents, continuous runtime, and system completeness cannot be directly accepted as performance conclusions without reproducible code, test records, runtime environments, and independent verification. A system booting on a specific device does not equate to broad hardware compatibility, security, or long-term operational stability.

    Therefore, the more valuable question is not “how many agents can write a system in how many days,” but rather: How are complex tasks decomposed? How do multiple execution units share constraints? How are errors discovered? And how do the final deliverables prove they meet the requirements?

    This means the core of intelligent R&D is shifting from code generation to building an engineering loop around executable deliverables.

    1. Define Delivery Boundaries Before Discussing Automation

    The most common failure in complex system R&D is not an inability to write code, but rather an inconsistent understanding of “completion” among participants.

    Taking an OS prototype as an example, the engineering difficulty of the following goals varies significantly:

    1. Booting in a controlled environment and outputting diagnostic information.
    2. Completing basic memory management and task scheduling.
    3. Supporting input, display, and persistent storage for specific devices.
    4. Providing simple window interactions and an installation process.
    5. Running stably long-term across multiple hardware types with a security update mechanism.

    These goals cannot be lumped together. A prototype capable of displaying a desktop might still have unresolved issues with concurrent access, power failure recovery, privilege isolation, and device exceptions.

    Before a project begins, a testable delivery contract should be established, including at least the target runtime environment, supported device scope, essential features, performance constraints, explicitly excluded capabilities, and acceptance methods. For features intentionally left unimplemented, the alternative behavior must be clearly documented—such as returning a specific error rather than silently skipping the process.

    For enterprises, scope definition also has direct budget implications: prototype validation aims to eliminate critical uncertainties quickly, while production delivery assumes responsibility for compatibility, operations, and security. The two should not share the same progress expectations.

    1. Decompose Tasks Around Dependencies, Not Simple File Allocation

    Distributing a large number of files to different agents does not naturally create efficient collaboration. Files are merely storage units for code; what truly determines the degree of parallelism is the dependency relationships and interface stability.

    A more robust approach is to first establish a task dependency graph:

    Requirements & Constraints -> System Architecture -> Interface Contracts -> Module Implementation -> Integration Validation -> Release Acceptance

    Modules can be further divided internally, but critical paths must be identified. For example, the storage module depends on stable block device access conventions, the file access layer depends on how storage errors are expressed, and upper-layer applications depend on file access semantics. If underlying interfaces change frequently, upper-layer agents might just be repeatedly redoing work even if they continuously generate code.

    Tasks suitable for parallel progression typically include: implementing independent modules based on clear interfaces, writing tests for established behaviors, analyzing runtime logs, and checking documentation against implementation. Tasks involving global state, underlying data layouts, and shared protocols require more centralized governance.

    Therefore, the scale of agents should be determined by the number of independently executable and independently verifiable tasks, not simply “the more, the better.”

    1. Establish Layered Collaboration Mechanisms to Prevent Execution Units from Overwriting Each Other

    An actionable multi-agent workflow can be divided into several logical roles. These do not necessarily correspond to different models; the same model can assume these roles under different contexts and permissions.

    • Planner: Responsible for maintaining goals, dependencies, and priorities. It must not only track whether a task is “submitted” but also monitor whether the critical path is genuinely unblocked.
    • Architect: Responsible for public interfaces, data structures, error conventions, and compatibility requirements. Cross-module changes must be assessed for impact first to avoid situations where local implementation is convenient but global integration is difficult.
    • Implementer: Modifies code within defined limits and submits tests, assumptions, and unresolved issues simultaneously. Task completion reports should explain what problem the changes solved and how it is proven effective.
    • Verifier: Independently checks results against acceptance criteria. “Independently” means not just having a different executor reiterate the implementation logic, but using different evidence as much as possible, such as external behavioral testing, abnormal inputs, and runtime logs.
    • Integrator: Responsible for merge sequencing, conflict resolution, and baseline maintenance. Any candidate change should be derived from a verified version and capable of clear rollback upon failure, rather than leaving the shared codebase in an unbuildable state for extended periods.

    The value of this layered mechanism lies in reducing implicit decisions, ensuring every change has clear accountability and traceable evidence.

    1. Govern Shared Context Instead of Infinite Accumulation

    The longer a complex project runs, the more historical information accumulates. Repeatedly providing all discussions, source code, and logs to every agent not only increases resource consumption but also risks drowning critical constraints in noise.

    A more rational approach is to organize context hierarchically:

    • Global Layer: Stores project goals, inviolable constraints, architectural decisions, and common terminology.
    • Module Layer: Stores interfaces, dependencies, data invariants, and common failure modes.
    • Task Layer: Retains only the code, tests, and error records necessary for the current modification.

    Architectural decisions, in particular, must record the “why.” Simply recording what an interface looks like cannot explain why it cannot be arbitrarily modified. For instance, a buffer’s ownership rules might stem from concurrent access requirements; if subsequent executors only see the function signature, they might mistakenly assume the copy or release strategy can be freely adjusted.

    Shared knowledge should also be bound to code versions. If a document describes an old interface, even if the text itself is entirely correct, it can become a source of errors in the current implementation.

    1. Quality Gates Must Cover Build, Behavior, and Exception Scenarios

    Code generated by agents often appears structurally complete on the surface, but engineering quality cannot rely on how confident the language expression is. An effective validation system should include at least the following layers:

    • Layer 1: Build and Static Checks. Used to discover syntax, typing, dependency, and partial resource usage issues. Passing a build only proves the code meets some formal constraints and does not prove behavioral correctness.
    • Layer 2: Module Testing. Tests should focus on input/output, boundary conditions, and state changes. For example, a storage module should not only test normal read/write operations but also check out-of-bounds requests, invalid parameters, and how underlying failures propagate.
    • Layer 3: Interface Contract Testing. Two modules might pass their respective tests yet still fail to collaborate due to differing units of length, ownership conventions, or error semantics. Contract testing should directly validate these shared assumptions.
    • Layer 4: End-to-End Testing. Taking a system prototype as an example, it is necessary to validate the complete path from booting, device initialization, to file access and user interaction, rather than stitching together several isolated demos and calling it “overall usable.”
    • Layer 5: Exception and Recovery Testing. Includes scenarios such as insufficient resources, device timeouts, duplicate requests, unexpected restarts, and data corruption. For persistent data, it is especially critical to verify whether necessary consistency is maintained after an operation is interrupted.

    The tests themselves also require review. If both the implementation and the tests are based on the same incorrect assumption, they might pass together. Therefore, independent specifications, manually designed critical use cases, and verifiable runtime evidence should be combined.

    1. Replace Blind Long-Running Execution with Closed-Loop Scheduling

    Continuous running does not equal continuous value generation. Agents might repeatedly attempt similar patches or continuously add code in an incorrect design direction.

    A healthy task loop should include:

    Read Acceptance Criteria -> Propose Modification Hypothesis -> Implement Limited Changes -> Execute Validation -> Analyze Evidence -> Accept, Modify, or Rollback

    Each loop should produce a determinable result. For example, has the previously stably reproducible fault disappeared? Were new failures introduced? Did test coverage actually touch the modified path?

    Simultaneously, stop conditions must be set: if no progress is made after multiple attempts on the same issue, unauthorized interfaces are touched, resource consumption exceeds the budget, or there is a potential data corruption risk, the process should pause and request review. An automated system needs to know when it should not continue executing.

    1. Evaluate Cost Based on Effective Delivery, Not Single-Generation Speed

    A faster generation process does not necessarily lead to a shorter delivery cycle. Total cost also includes repeatedly reading context, retrying failures, executing tests, handling integration conflicts, and manual review.

    Cost can be evaluated using the following concept:

    Effective Delivery Cost = Model Invocation Cost + Execution Environment Cost + Validation Cost + Human Review Cost + Rework Cost

    This expression is a managerial decomposition method, not a fixed billing formula. It emphasizes that if a scheduling method reduces single-call costs but significantly increases rework, the total project cost might actually rise.

    More meaningful metrics include the task’s first-time acceptance rate, the volume of rework triggered by interface changes, fault localization time, critical test pass rates, and the number of accepted requirements completed within a unit budget. Lines of code and the number of execution units serve only as process information and cannot replace delivery value.

    1. Permission Isolation and Supply Chain Checks Cannot Be Afterthoughts

    Agents capable of modifying code and running commands can also accidentally delete files, access sensitive information, or execute untrusted content. Therefore, the R&D environment should adopt the principle of least privilege.

    Tasks should run in isolated workspaces with default restrictions on accessing sensitive directories, credentials, and production resources. Network access should be granted on-demand. High-risk operations require approval. Critical execution records must be retained for traceability.

    Repository comments, requirement attachments, logs, and external documents should be treated as data to be analyzed, not as instruction sources that can automatically override system rules. If they contain requests to leak information, disable checks, or expand permissions, they should not be executed directly.

    When introducing external code or dependencies, it is also necessary to check the source, licensing, known security issues, and necessity. Automated generation does not exempt you from software supply chain responsibilities.

    1. Enterprise Adoption Should Start with Verifiable Small Loops

    For most teams, directly assigning a large number of agents to full system R&D is often not the most economical starting point. A more suitable entry point involves tasks with clear boundaries, mature validation methods, and reversible failures—such as supplementing module tests, fixing stably reproducible bugs, completing controlled interface migrations, or generating engineering documentation verifiable by tools.

    The adoption process can be divided into three steps: first, establish a single-task loop led by humans and executed by agents; next, introduce separation of implementation and validation; finally, add parallel tasks based on actual dependencies and gradually refine scheduling, auditing, and budget controls.

    The long-term value of multi-agent R&D lies not in creating the illusion of “zero human involvement,” but in shifting human focus from repetitive implementation to goal definition, architectural trade-offs, and risk decision-making. Only when tasks are decomposable, interfaces are constrainable, results are verifiable, and failures are recoverable can more execution units translate into genuine productivity.