Multi-Agent Development Fleet: A Practical Guide to Running 24/7 Autonomous Coding Pipelines
This guide explains how to move from a single coding agent to a multi-agent development fleet that runs around the clock. It covers why single-agent workflows suffer from context pollution, unclear ownership, and idle compute; how to structure roles such as orchestrator, research, product, architect, development director, QA, and ops agents; and how isolated workspaces, a lightweight message protocol, and scheduled patrol loops keep the system stable. A competitor price monitoring example ties the pipeline together, followed by deployment, cost control, risk management, and a tuning checklist for common pitfalls.
1. From a Single Agent to a Development Fleet: Why Multi-Agent
Early intelligent coding practices mostly stayed at the stage of “a single agent working serially”: one agent reads requirements, writes code, and runs tests while its context keeps expanding. Constraints from earlier stages are easily lost during task switching, and once a long workflow is interrupted, it has to start over. As task complexity grows, this model exposes three structural problems.
The first is context pollution. Market research, product requirements, architecture design, coding, and quality validation require completely different knowledge structures. Putting them into the same context forces the model to repeatedly weigh irrelevant information, and output quality decays with each round.
The second is blurred responsibility boundaries. A single agent both decides and executes, so when something goes wrong, it is impossible to tell whether the cause was a misunderstanding of requirements or a defect in the implementation.
The third is low time utilization. Human-triggered workflows leave large amounts of compute idle overnight.
The core idea of a multi-agent architecture is to split a complex delivery workflow into several single-responsibility roles, each with its own context and tool set, collaborating through a message bus. This brings three direct benefits: contexts do not interfere with each other, errors are attributable, and tasks can run in parallel. A typical development fleet includes the following roles.
- Orchestrator Agent: The single external entry point for requirements. It decomposes tasks, dispatches work, aggregates results, and reports to humans.
- Market Research Agent: Collects public information and produces structured competitor and requirement material.
- Product Manager Agent: Turns material into requirement documents and defines acceptance criteria.
- Architect Agent: Handles module decomposition, data models, and interface contract design.
- Development Director Agent: Schedules local intelligent coding tools for implementation and decides on its own when to refactor and when to add tests.
- QA Agent: Generates and executes test cases based on acceptance criteria, and returns a defect list.
- Ops / On-Call Agent: Handles scheduled dispatch, log inspection, and anomaly alerting.
It is worth emphasizing that more roles are not always better. Role division should follow two principles: clear information boundaries and verifiable deliverables. Usually five to eight roles are enough to cover most small and medium-sized software delivery scenarios.
2. Context Isolation: The Foundation of a Stable Fleet
Each agent should have an independent session context and an independent file workspace. This is the key to whether the whole architecture can run stably over the long term. The following convention is recommended in practice.
workspace/orchestrator/ # Orchestrator: task board, dispatch recordsresearch/ # Research: raw material, cited sourcesproduct/ # Product: requirement docs, acceptance criteriaarch/ # Architecture: module diagrams, interface contractsdev/ # Development: code repository, build artifactsqa/ # QA: test cases, defect ticketsops/ # On-call: schedule config, alert records
The direct benefit of isolation is extremely low rollback cost. When the QA agent decides an implementation does not meet the standard, it only needs to send a defect ticket back to the development role, which fixes it inside its own workspace without replaying the entire chain. At the same time, roles exchange only “deliverable reference + summary” rather than the full conversation history, which significantly reduces the context length of each call.
3. Communication and Collaboration: The Message Protocol Sets the Ceiling
Communication between agents should use a lightweight protocol of “topic + message type + deliverable pointer” to avoid the ambiguity of free text.
{"topic": "delivery.pipeline","from": "qa_agent","to": "dev_director","type": "defect_report","payload": {"artifact": "workspace/qa/defects/issue-017.md","severity": "high","acceptance_ref": "workspace/product/acceptance.md#A3"},"trace_id": "task-20260901-001"}
Three engineering constraints are worth following. First, the same trace_id runs through the entire chain, making it easy for log services to search and locate problems. Second, messages carry only pointers, not bodies; the bodies live in shared files or object storage, achieving a separation of “light control plane, heavy data plane.” Third, set a maximum retry count and maximum hop count to prevent roles from kicking issues back and forth into an infinite loop.
4. Scheduling and On-Call: Making the Fleet Truly Run 24 Hours
Uninterrupted operation depends on three mechanisms working together. The scheduling layer uses timed triggers for periodic tasks, such as collecting competitor prices and stock status every early morning; the event layer uses a message queue to absorb asynchronous tasks and smooth out peaks and troughs; the on-call layer uses monitoring and alerting to inspect failure rates, task backlogs, and timeouts.
# Example: the on-call agent's patrol loopdef patrol():for job in scheduler.due_jobs():result = runner.execute(job) # Invoke the corresponding roleif result.status in ("failed", "timeout"):metrics.incr("agent_task_failed")notify(job.owner, result.summary) # Trigger human takeoverlog.info(trace_id=job.trace_id, **result.meta)
When the same task fails consecutively and reaches a threshold, it should automatically degrade to “pause and wait for human confirmation” instead of retrying indefinitely. This is the most easily overlooked design in long-running unattended scenarios, and the one that most affects stability.
5. Case Study: The Full Chain of a Competitor Price Monitoring System
Take a typical deliverable as an example to connect the whole pipeline. After the orchestrator receives the requirement “build a competitor price monitoring system that periodically collects price, original price, discounts, and stock status, outputs trend charts and flags abnormal fluctuations, sends alerts on low prices, sharp fluctuations, and out-of-stock, and supports spreadsheet export,” the chain unfolds as follows.
- The research role organizes publicly available data dimensions and common collection frequencies, and notes compliance boundaries and robots protocol constraints.
- The product role produces the requirement document and acceptance criteria, defining a quantified meaning of “abnormal fluctuation,” for example a rise or fall exceeding a configured threshold.
- The architecture role provides a layered design: collection layer, cleaning layer, storage layer, metric computation layer, alerting layer, and export layer.
- The development role codes autonomously in a local intelligent coding tool, deciding on its own to write unit tests before the implementation.
- The QA role executes test cases against the acceptance criteria, returns defect tickets, and the development role iterates on fixes.
- The on-call role configures scheduled tasks and alert channels, and keeps patrolling after delivery.
The data flow can be summarized with the following pseudocode:
def collect_and_alert():raw = fetcher.pull(targets) # Collectionclean = cleaner.normalize(raw) # Cleaning: units, currency, timestampsstore.save(clean) # Persist to storagefor sku, series in store.history().items():if anomaly.detect(series): # Fluctuation / low price / out of stockalert.send(sku, series.latest()) # Alertexporter.to_spreadsheet(clean) # Export
6. Deployment, Cost, and Risk Control
For deployment, stateless roles are suitable for container platforms with elastic scaling; long-running tasks and state data go to object storage and managed databases; scheduling and messaging go to message queue and scheduled task services; observability relies on log services and monitoring and alerting. Baidu AI Cloud offers corresponding capabilities in these general categories, and teams can freely combine them according to their existing technology stack.
There are three practical lessons for cost control. First, a tiered model strategy: use lightweight models for research and summarization tasks, and more capable models for architecture and coding tasks. Second, caching and deduplication: do not parse the same material repeatedly. Third, set a per-task budget cap; exceeding the budget stops the task and reports it.
Risk control is equally indispensable: collection behavior must comply with the target site’s terms of use and access rate limits; keys are managed centrally by a key management service and never written into code or logs; all automated commits and automated releases keep a human confirmation gate; and all critical operations are fully audited to ensure every step is traceable and rollback-able.
7. Common Pitfalls and a Tuning Checklist
- Overlapping role responsibilities: Two roles editing the same file must be avoided with workspace isolation and file locks.
- Overly heavy context passing: Pass only pointers and summaries, and keep bodies external.
- Missing acceptance criteria: Without quantifiable standards, the QA role can only give subjective judgments and iteration cannot converge.
- Alert storms: Similar alerts need aggregation and silence windows.
- No takeover mechanism: An escalation path and pause policy must be defined.
Built with the structure above, a multi-agent development fleet can keep doing research, design, coding, and validation overnight, while humans only make decisions and accept deliverables at key points. This hands repetitive work to an automated pipeline and keeps judgment on the human side.
