Building an Operating System Prototype with Multi-Agent Collaboration in Eight Days

    This article examines how multi-agent collaboration enables AI systems to deliver a complete operating system prototype in eight days, moving software delivery from code snippets to runnable systems. It explains why single agents struggle with system-level tasks, details four key mechanisms behind long-running agent workflows—task decomposition, contract-first interfaces, automated verification loops, and externalized memory—and shows how the same approach applies to application tools and formal verification, along with practical deployment and risk-control advice.

    1. From Generating Code to Delivering a System

    Over the past two years, AI coding tools have mostly operated at the function and file level, handling code completion and refactoring. A newer class of practice has pushed the problem to a much larger scale: starting a model in an empty directory, running it continuously for several days, orchestrating thousands of sub-agents, and producing an operating system prototype that can boot, with a kernel, basic drivers, a file system, and a graphical interface. In parallel, content creators have used similar capabilities to build image editing and video editing tools that replace everyday software in a short time, and have canceled their subscriptions to the original commercial products as a result.

    The value of these cases is not that they replace a specific product, but that they reveal an engineering fact: when context management, task decomposition, and verification loops for agents are mature enough, the minimum unit of software delivery is shifting from a “code snippet” to a “runnable system.” Setting aside specific products, this article discusses the general technical mechanisms and implementation methods behind this shift.

    2. Why a Single Agent Struggles with System-Level Tasks

    System-level engineering has three inherent constraints that single-turn conversational generation can hardly satisfy at once.

    The first is the context capacity constraint. An operating system prototype involves multiple subsystems, including the boot flow, memory management, device access, the file system, and window management. The code volume and interdependencies far exceed a single context window. Forcing everything in dilutes critical information, and the model tends to produce output that “looks right but does not run.”

    The second is the consistency constraint. Once interface signatures, data structures, or error codes become inconsistent across modules, all subsequent integration fails. Human teams solve this with documentation and review; agent teams must solve it with machine-verifiable contracts.

    The third is the verification constraint. Errors in system-level code only surface in a real execution environment. Without automated build, boot, and regression testing, the model falls into a loop of “feeling good about itself.”

    3. Four Key Mechanisms for Long-Running Multi-Agent Collaboration

    3.1 Task Decomposition and Dependency Orchestration

    A workable approach is to have a main control agent first produce a high-level architecture and module list, then break it into a directed acyclic dependency graph and distribute it to sub-agents in topological order. Each sub-agent is responsible for only one clearly bounded module, and its input is an interface contract rather than the global codebase.

    1. boot -> memory -> interrupt -> driver(block/keyboard)
    2. -> fs -> window -> login -> installer

    3.2 Contract-First and Interface Freezing

    Freezing interface definitions before coding is the most effective way to suppress inconsistency. In practice, contracts are usually written as machine-readable interface description files, and any commit that deviates from the contract is rejected before merging.

    1. /* Example: freeze the contract first, then implement in parallel */
    2. typedef struct {
    3. int (*read)(void *dev, uint64_t off, void *buf, size_t len);
    4. int (*write)(void *dev, uint64_t off, const void *buf, size_t len);
    5. } block_ops_t;

    3.3 Automated Verification Loop

    After each sub-agent delivers, it must go through four steps: build, boot, assert, and roll back. If the build fails, the boot fails, or an assertion does not pass, the task automatically returns to the queue with the failure log attached and is retried. This step determines whether long-running operation degrades into an ineffective loop.

    3.4 Context Compression and Externalized Memory

    In long tasks, write architecture decisions, completed modules, and failure reasons into an external memory file, and inject only the slice needed for the current task into the context, avoiding unlimited growth of the conversation history. This is the core engineering technique that supports “running continuously for several days.”

    4. The Same Approach Applies at the Application Layer: Using Work Habits as the Spec

    The cases of image editing and video editing tools show that the source of a spec does not have to be a requirements document; it can be an expert’s operating habits. Developers can have the tool first observe and abstract a list of common features, control layouts, and keyboard shortcut mappings, then generate the interface and interaction logic, and finally connect model capabilities to enable natural-language instruction-based modification. The key is still verification: each feature, such as import, scaling, layers, and text, must have an executable test case.

    5. Formal Verification: Making Correctness Progressively Checkable

    Transcribing existing mathematical proofs into a formal language that a proof assistant can check step by step is another high-value task. Its engineering implication is that when the output has a machine-decidable correctness standard, the efficiency of an agent’s self-correction improves significantly. This suggests that in business systems we should make “acceptance criteria executable as code” wherever possible.

    6. Implementation Advice and Risk Control

    • Start with a small-scale pilot, choosing modules with clear boundaries that can be automatically verified;
    • Prioritize building infrastructure such as build, testing, and log monitoring before introducing agents;
    • Keep human review checkpoints, especially for code related to permissions, data, and external interfaces;
    • Pay attention to cost and compute scheduling, and use container platforms and message queues for task distribution and rate limiting;
    • Run dependency and vulnerability scans on generated code to avoid introducing uncontrollable components.

    If an enterprise wants to implement this kind of practice on Baidu AI Cloud, it can use a container platform to host the agent runtime, object storage to save build artifacts, and log services with monitoring and alerting to track the status of long-running tasks, building a stable and reliable agent engineering pipeline with general cloud-native capabilities.