Multi-Agent Development: A Practical Guide to Running a 24/7 Agent Fleet
This guide explains how to move from a single AI assistant to a coordinated multi-agent system for software development. It covers the four-layer architecture (orchestrator, specialist agents, message bus, and tools), role definitions, structured communication protocols, long-running context and memory strategies, and the scheduling, monitoring, and human-approval guardrails needed for 24/7 operation. A practical competitor price-monitoring example and a pre-launch checklist are included.
1. From Single-Agent Chat to an Agent Fleet: Why Coordination Matters
Over the past year, the form of AI agents has changed noticeably: from “question-and-answer” assistants into long-task executors that can plan autonomously, call tools, and keep working. But when task complexity rises to that of a complete software project, the problems of a single agent quickly surface:
- Context pollution: Research, design, coding, and testing information mixed in the same session dilutes key constraints.
- Conflicting role objectives: The same model is asked to both diverge and converge, to both write code and critique it, and instruction priorities end up fighting each other.
- Long-task instability: After dozens of turns, early requirement details are lost, the task chain breaks, and output quality drops sharply.
The core idea of multi-agent coordination is to split “one all-purpose player” into “a team with a division of labor.” Each agent has an independent context, a clear responsibility boundary, and auditable outputs, and they collaborate through a messaging mechanism. The benefit is not just “parallelism”; more importantly, it is engineering governability: every step has an owner, inputs and outputs, and traceability.
2. Overall Architecture: Orchestrator, Specialists, and a Message Bus
A deployable multi-agent system typically has four layers:
- Scheduling layer (Agent orchestrator): Receives human requirements and handles task decomposition, prioritization, dispatch, and acceptance.
- Execution layer (specialist agents): Roles such as market research, product requirements document writing, architecture design, coding, and testing.
- Communication layer (message bus): Carries task dispatch, status synchronization, blocker reporting, and result return.
- Tool layer: File system, code repository, AI coding tools, spreadsheet export, alerting channels, and so on.
An illustrative role definition (pseudocode that expresses structure only and is not tied to any specific product):
class Agent:def __init__(self, role, context_window, tools):self.role = roleself.context = [] # Independent context; no interference between agentsself.tools = toolsdef receive(self, message):self.context.append(message)def run(self):plan = self.think(self.context)result = self.act(plan)bus.send({"from": self.role, "task_id": current_task, "result": result})
There are three key design principles:
- Context isolation: Each role keeps only information relevant to its own responsibilities, avoiding noise accumulation.
- Artifact-driven handoffs: What roles pass to each other are structured artifacts (requirement items, interface drafts, test cases), not long stretches of chatter.
- State-machine task management: A task is in one of “to do / in progress / pending acceptance / blocked / done,” and the orchestrator decides the next step based on status.
3. Role Orchestration: Make Each Agent Do One Thing
In practice, the most common failure point is blurry role boundaries. The recommended split is:
- Orchestrator agent: The only entry point that interacts with humans; responsible for clarifying requirements, breaking down milestones, and accepting results.
- Research agent: Collects public information, outputs a structured summary of competitors and user pain points, and flags information uncertainty.
- Product agent: Turns research conclusions into a requirement list and acceptance criteria, clarifying priorities and out-of-scope items.
- Architecture agent: Provides module breakdown, data models, interface contracts, and rationale for technology choices.
- Development agent: Calls local AI coding tools, implements features per the interface contracts, and submits runnable code with documentation.
- Testing agent: Generates test cases from the acceptance criteria, executes them, reports defects, and closes the loop.
Each role’s “definition of done” must be verifiable. For example, the development role’s definition of done is not “the code is written” but “unit tests pass, static checks have no blocking items, and the interface matches the architecture document.”
4. Communication and Collaboration: Messages, Shared Storage, and Conflict Handling
The stability of a multi-agent system depends largely on whether the communication protocol is disciplined.
- Suggested message structure:
task_id,sender,receiver,type(task/question/block/delivery),payload,deadline. - Shared artifact area: Requirement documents, interface contracts, and data dictionaries live in a unified file area or object storage; roles read by path to avoid context bloat.
- Blocker reporting: When any role hits missing information, it immediately asks the orchestrator rather than guessing on its own, reducing rework.
- Conflict handling: When development and testing conclusions disagree, the orchestrator rules based on the acceptance criteria and, if necessary, sends the issue back to the architecture role to revise the contract.
A simplified message flow example:
{"task_id":"T-102","sender":"research","receiver":"pm","type":"deliver","payload":{"path":"/shared/research.md"}}{"task_id":"T-102","sender":"pm","receiver":"architect","type":"task","payload":{"path":"/shared/prd.md"}}{"task_id":"T-102","sender":"qa","receiver":"lead","type":"block","payload":{"reason":"Missing exception scenario definitions"}}
5. Long-Task Stability: Context, Memory, and Resume from Checkpoints
To keep the fleet working through the night, you must solve the “amnesia” problem. Reusable engineering techniques include:
- Layered memory: Short-term context holds only the current subtask; long-term memory is persisted as files containing a Decision Log.
- Summary compression: After each milestone, the orchestrator generates a summary of fixed maximum length to replace the original long conversation.
- Resume from checkpoints: Task state and artifacts are persisted, so after a process restart work continues from the “pending acceptance” node instead of starting over.
- Idempotent design: Repeated collection or build operations produce no duplicate side effects, making retries safe.
At the model level, the requirements are: long context that does not lose key constraints, task-chain continuity across turns, and stable adherence to structured instructions. Large-context general-purpose models in the industry can already support dozens of turns of collaboration, but the context management strategy is still the deciding factor in whether the system runs end to end; stability cannot be placed entirely on the model.
6. 24/7 Operation: Scheduling, Human Boundaries, and Alerting
Round-the-clock operation requires three categories of infrastructure capability (all generic categories):
- Container platform: Hosts each role’s process with restart support and resource limits.
- Scheduled execution: Triggers periodic tasks via cron-style rules, such as scheduled collection and inspections.
- Logging and monitoring/alerting: Centrally collects runtime logs and pushes alerts through instant messaging tools on anomalies.
The human boundary must be clear: high-risk actions such as external publishing, data deletion, and paid resource creation must have a human confirmation node. Example policy:
schedule:- name: collectevery: "0 */2 * * *"agent: collector- name: nightly-buildevery: "0 2 * * *"agent: devguardrails:require_human_approval: ["deploy", "delete_data", "spend_budget"]max_retry: 3
7. Practical Example: Auto-Generating a Competitor Price Monitoring System
As a typical delivery, the system the fleet completes overnight has the following capabilities: scheduled collection of prices, original prices, discounts, and stock status; generation of trend views with abnormal fluctuation flags; alerts via instant messaging channels on low prices, sharp fluctuations, or out-of-stock; and spreadsheet file export.
The corresponding role collaboration chain is: the research role organizes monitoring dimensions → the product role defines thresholds and acceptance criteria → the architecture role determines the data model and scheduling interval → the development role calls AI coding tools to implement collection and visualization → the testing role constructs exception scenarios to verify the alerting chain. The whole process has complete artifacts and a traceable chain.
8. Common Pitfalls and an Acceptance Checklist
- Pitfall 1: Too many roles. Start with 4–6 roles, then expand after the flow works.
- Pitfall 2: Unstructured messages. Passing natural language back and forth quickly amplifies ambiguity.
- Pitfall 3: No acceptance criteria. Without a verifiable definition of done, delivery quality is uncontrollable.
- Pitfall 4: Excessive permissions. Give agents the minimum necessary permissions and force human confirmation for high-risk actions.
Pre-launch self-check: Is context isolated, are artifacts persisted, can tasks resume from checkpoints, are alerts reachable, can failures be retried, and are logs auditable?
9. Conclusion
The value of a multi-agent fleet is not “more models running” but breaking the software delivery process into a governable, verifiable, and rollback-capable engineering workflow. Master the four cornerstones—role orchestration, message protocols, layered memory, and scheduling/alerting—and you can build a stable automated development pipeline on general cloud infrastructure such as Baidu AI Cloud, handing repetitive work to machines and keeping judgment and decisions for yourself.
