Building a 24/7 Multi-Agent Development Squad: A Practical Guide
This article explains why single-agent architectures struggle with long-chain software development and how a multi-agent system solves the problem through role separation, context isolation, and parallel scheduling. It covers the four-layer architecture, role prompt contracts, artifact-driven memory, message bus and conflict handling, overnight stability, DAG-based scheduling, and human oversight boundaries, along with a practical implementation checklist.
1. Why a Single Agent Cannot Support Long Development Chains
Over the past two years, agent practice around large language models has gone through a clear paradigm shift. The early form was “single-turn Q&A plus simple tool calls.” It then evolved into a single agent with planning ability: give it a goal, and it decomposes the steps, calls tools, and iterates on its own output. But when the task grows from “write a script” to “deliver a complete software system,” the limits of the single-agent architecture show up quickly.
The core problems come down to three points. First is context bloat. A complete development workflow includes market research, requirements writing, architecture design, coding, testing, and delivery notes. Intermediate output from any stage crowds the limited context window, so early constraints get “forgotten.” Second is mixed responsibilities. The same model has to weigh product tradeoffs and worry about code indentation style at the same time. Attention is split, and output quality drops on both dimensions. Third is the lack of parallelism. A single agent is essentially serial: it cannot advance research and test case design at the same time, so the time cost of long tasks grows linearly.
The multi-agent architecture is the structural answer to these three points: split roles to lower the cognitive load on any single point, isolate contexts to suppress information contamination, restore collaboration through message passing, and compress total time through parallel scheduling. It is worth stressing that multi-agent is not simply “more model instances.” It is fundamentally a distributed systems engineering problem, except the nodes are execution units driven by models.
2. Overall Architecture: Roles, Bus, and Isolation
A multi-agent development squad that runs stably can be abstracted into four layers.
The first layer is the access layer. It receives requirements, confirms boundaries, shows progress, and delivers alerts for a human owner. It usually connects to a common instant messaging or collaboration platform and issues instructions in the form of a conversation.
The second layer is the orchestration layer, the “supervisor agent.” It produces no deliverables itself; it only handles task decomposition, dispatch, dependency management, and acceptance. Its key design principle is: schedule and judge only, never do the work itself. Once the supervisor starts writing code, the system has degraded back into single-agent mode.
The third layer is the execution layer, made up of several specialized agents, for example market research, requirements and documentation, architecture design, development, testing, and delivery summary. Each agent has its own context, its own prompt, its own tool set, and its own working directory.
The fourth layer is the infrastructure layer, including model inference services, the message channel, artifact storage, and logging, monitoring, and alerting. This layer determines whether the system can run unattended 24/7.
The following sketch describes one dispatch:
[Access layer] Requirement submitted↓[Orchestration layer] Supervisor: decomposes into a task DAG with dependencies and acceptance criteria↓ ┌──────────────┬──────────────┬──────────────┐Research agent Docs agent Architecture agent Test agent↓ └──────────────┴──────────────┴──────────────┘[Infrastructure layer] Message bus / artifact storage / logs / monitoring and alerting
3. Role Design: Write the Job Description into the Prompt
The quality ceiling of a multi-agent system is often decided by how clearly roles are defined. A practical role prompt contains at least five sections: identity and goal, input contract, output contract, prohibitions, and escalation path.
Take the development agent as an example. The input contract should state that it “accepts only reviewed and approved technical designs and task cards.” The output contract should state “runnable code, change notes, and self-test results.” The prohibitions should include “must not change interface contracts on its own, must not skip tests.” The escalation path is “when a design is ambiguous, ask the architecture agent back rather than making assumptions.” This contract-style writing turns collaboration from “free conversation” into “verifiable interface calls,” which is the key to keeping long tasks on track.
More roles is not better. In practice, 5 to 8 specialized roles usually cover a small or medium development workflow. Roles that are too fine-grained create a lot of handoff overhead and actually reduce overall throughput.
4. Context Isolation and Artifact-Driven Memory
Independent context is the foundation of a multi-agent system, but isolation creates a new problem: how does information flow across roles? The answer is “do not pass context, pass artifact references only.”
Concretely, each agent’s session keeps only the condensed information its own task needs, and cross-role collaboration happens through files in a shared working directory and structured task cards. A task card should use a stable field structure:
{"task_id": "T-014","owner": "dev_agent","depends_on": ["T-009"],"input_refs": ["docs/architecture.md"],"output_refs": ["src/price_fetcher.py"],"acceptance": ["unit tests pass", "retry on exception works"],"status": "in_progress"}
This brings three benefits: context usage drops sharply; any role can be restarted or swapped to a different model and resume without loss; and all intermediate artifacts are naturally auditable and rollback-able. For very long tasks, a “summary archiving” strategy can be added: when a session approaches the window limit, compress the history into a structured summary, write it to the artifact directory, and bring it back by reference, so key information is not truncated.
5. Communication: Message Bus and Conflict Governance
Communication between roles needs a reliable channel. In engineering, a lightweight message queue or event bus is usually chosen, with three message types agreed upon: task dispatch, status report, and exception escalation. The message body should carry a task identifier and a version number to support idempotent handling and out-of-order correction.
Conflict governance is often overlooked. If two agents modify the same file at the same time, a lease or lock mechanism must be introduced; a safer approach is to divide write permissions by directory so each role can write only to its own artifact path, eliminating contention at the source. In addition, the supervisor should set timeouts and retry limits so that one role stuck in a loop does not hold up the whole pipeline.
6. Long-Task Stability: Getting the Squad Through the Night
The original text mentions that after dozens of rounds of conversation, context was not lost and the task chain did not break. Behind this are three engineering constraints at work, not merely model capability.
The first is externalized state. All progress is defined by task cards and artifacts; the model context is only “working memory” and can be discarded and rebuilt at any time. The second is resume from breakpoint. Before each scheduling round, the supervisor scans task card status, identifies unfinished tasks, and continues from the breakpoint instead of recalling from conversation history. The third is a verification loop. Every task must have acceptance criteria that can be judged automatically, and the test agent’s output is returned as an objective signal, avoiding “the model claims it is done.”
On model selection, three key metrics are long-context retention, instruction-following stability, and code generation quality. Open-source models in the industry continue to iterate on code and cluster collaboration and can serve as the base inference engine for a self-built squad. If you want to reduce operational burden, you can also run inference and scheduling components on Baidu AI Cloud’s model services and container platform, leaving scaling, log collection, and monitoring and alerting to mature general cloud capabilities.
7. Scheduling and Parallelism: From Serial Pipeline to DAG Execution
Once tasks are expressed as a directed acyclic graph, scheduling becomes a classic problem: continuously take tasks with zero in-degree and dispatch them in parallel. In practice, limit the concurrency (for example, run 3 to 5 execution agents at the same time), because too much concurrency amplifies the probability of API rate limiting and artifact conflicts.
A simplified scheduling loop can be written as:
while pending or running:for task in ready_tasks(): # dependencies satisfiedif len(running) < MAX_PARALLEL:dispatch(task) # post to the message busfor done in collect_finished():mark_done(done) # update task card, unlock successorssleep(poll_interval)
With a priority field, “blocking tasks” can be executed first to shorten the critical path.
8. Human Collaboration and Risk Boundaries
Running automatically around the clock does not mean fully unattended. A reasonable approach sets three human gates: requirement confirmation, design review, and pre-release acceptance. At the same time, draw red lines for the squad, for example no write access to production, no publishing content externally, and a budget and time limit per run. All tool calls should be logged for later traceability.
9. Implementation Checklist
- Define 5 to 8 roles and their input and output contracts;
- Set up a shared artifact directory and structured task cards;
- Connect a message channel and agree on message types and an idempotency strategy;
- Define acceptance criteria that can be judged automatically for every task;
- Configure logs, metrics, and exception alerts to enable unattended operation;
- Keep human gates and permission red lines to control automation risk.
Built along these lines, a development squad made of different specialized agents can keep running through the night: research, documentation, architecture, coding, and testing each move forward and cross-check one another. In the morning, the owner only needs to review the summary artifacts and alert records to decide whether to enter review and release. This is the real value of multi-agent engineering: not making the model “smarter,” but making collaboration more reliable.
