Multi-Agent System in Practice: Building a 24/7 Automated Development Pipeline
This article explains how to build a multi-agent system that operates as a round-the-clock development pipeline. Using an e-commerce competitor price monitoring system as the running example, it covers the three-layer orchestrator-specialist-executor architecture, context isolation and message bus design, role definitions with acceptance criteria, and implementation details for collection, storage, visualization, alerting, and export. It also addresses scheduling, idempotency, recovery, cost control, and common pitfalls, showing how to turn software delivery into an engineered, unattended workflow.
1. Why a Single Agent Struggles with the Full Delivery Chain
Interest in multi-agent systems has been growing across the industry, and one conclusion keeps being confirmed: a single agent tends to degrade on tasks that are long-running, multi-role, and context-heavy. The reasons are not mysterious — limited context window, conflicting role objectives, and no isolation boundary for errors. When a task grows from “write a piece of code” into “deliver a working software system,” a single agent is forced to play product manager, architect, developer, and tester within the same context. The result is drifting requirement understanding and a gap between implementation and acceptance criteria.
The value of a multi-agent legion is precisely that it splits this chain apart: each agent keeps one responsibility, one evaluation standard, and one independent context, and they collaborate through messages. This article uses an e-commerce competitor price monitoring system as the running case and shows how to build a development legion that runs around the clock using general-purpose LLM capabilities. The delivered system supports scheduled collection, trend visualization, anomaly flagging, low-price and out-of-stock alerts, and table export.
2. Overall Architecture: A Three-Layer Orchestrator-Specialist-Executor Model
An operable legion is not a flat pool of agents; it is layered. A three-layer structure is recommended:
- Orchestrator: the single external entry point, responsible for requirement parsing, task decomposition, priority ordering, and acceptance decisions.
- Specialist: roles such as market research, product requirements, architecture design, development, and testing, each with its own independent context.
- Executor: controlled tools that interact with the outside world, such as collectors, storage, chart rendering, and notification sending.
Layers communicate only through messages, and reading each other’s internal reasoning is prohibited. This constraint is the foundation of the whole design, and it brings three direct benefits: contexts do not pollute one another, single-point failures can be isolated, and roles can be replaced and upgraded independently.
A schematic role registry looks like this (pseudocode, expressing structure rather than concrete interfaces):
AGENTS = {"researcher": {"goal": "Research competitors and pricing strategies", "tools": ["web_fetch"]},"pm": {"goal": "Produce a structured requirements document", "tools": ["doc_write"]},"architect": {"goal": "Define module boundaries and interfaces", "tools": ["doc_write"]},"developer": {"goal": "Implement collection, storage, and export", "tools": ["code_exec", "file_io"]},"tester": {"goal": "Build test cases and run regression checks", "tools": ["code_exec"]},}
3. Context Isolation and the Message Bus: What Makes Collaboration Work
Independent contexts do not mean “everyone writes their own thing”; they mean “everyone holds one copy of the necessary information.” In practice, each agent should maintain three kinds of memory:
- Task memory: the currently assigned sub-goals and acceptance conditions.
- Shared memory: conclusions only (requirement items, interface contracts, defect lists), with no process chatter.
- Private memory: the agent’s own reasoning drafts, never exposed externally.
The message bus handles routing and backpressure. Every message contains at least task_id, from, to, type, payload, and trace_id. The trace_id runs through the entire chain and is the only clue for later troubleshooting and cost accounting.
{"task_id": "T-20260801-001","from": "orchestrator","to": "developer","type": "task.assign","payload": {"module": "collector", "acceptance": "field completeness >= 99%"},"trace_id": "tr-9f2c"}
You must set a concurrency limit and a queue length limit; otherwise the orchestrator will overwhelm downstream agents through broadcast-style dispatch. A practical rule: specialist-layer concurrency should not exceed twice the available execution slots, and when the queue is full, degrade to serial processing.
4. Role Design: Inputs, Outputs, and Acceptance Criteria for Each Agent
The goal of role design is to make “acceptance-ready” the default property. For this case:
- Market research agent: takes a target category and competitor list as input, and outputs a price range, common promotion cadence, and a data availability assessment. Acceptance requires every conclusion to include its source and an uncertainty note.
- Product requirements agent: converts research conclusions into itemized requirements, each with background, target users, and acceptance criteria; unmeasurable words such as “friendly” or “fast” are prohibited.
- Architecture design agent: provides module boundaries, data models, and failure degradation strategies. Acceptance requires that the failure of any single module does not make the whole system unavailable.
- Developer agent: submits work split by module, in small runnable steps. Acceptance requires every commit to pass the existing tests.
- Tester agent: independently constructs boundary and exception cases, especially covering three real-world problems: page structure changes, missing fields, and rate limiting.
The key design principle: acceptance criteria are produced upstream, executed downstream, and adjudicated by the orchestrator, forming a closed loop that avoids “writing the exam and grading it yourself.”
5. Core Implementation: Collection, Storage, Visualization, Alerting, and Export
The collection layer turns “volatile web pages” into “stable structured data.” The common approach is to externalize selectors and parsing rules as configuration, so a structure change means editing configuration rather than code. Also add request intervals, retry on failure, and a deduplication key (such as item identifier plus time bucket).
For storage, dual writes are recommended: details go into relational storage for querying and export, while aggregated results go into a cache to speed up trend chart rendering. The table structure can be abstracted as:
CREATE TABLE price_snapshot (item_key VARCHAR(64) NOT NULL,price DECIMAL(10,2),origin_price DECIMAL(10,2),discount VARCHAR(32),stock_state VARCHAR(16),captured_at TIMESTAMP NOT NULL,PRIMARY KEY (item_key, captured_at));
Anomaly detection uses three complementary rules to avoid the noise of a single threshold: a low-price rule (below a certain percentage of the median of the last N samples), a fluctuation rule (change between adjacent samples exceeds a threshold), and an out-of-stock rule (stock state changes from in to out). When all three rules are evaluated, results are aggregated over a time window, so the same item triggers only one alert per window.
Alerts are delivered through messaging or general notification capabilities, and the content must include the item identifier, current value, reference baseline, timestamp, and trace_id for traceability. Export runs as an asynchronous task that generates a table file, stores it in object storage, and returns a download URL, avoiding long-running tasks blocking the main chain.
def detect(item, history):prices = [h.price for h in history[-20:]]med = median(prices)if item.price < med * 0.85: return "low_price"if abs(item.price - history[-1].price) / history[-1].price > 0.15:return "spike"if item.stock_state == "out" and history[-1].stock_state == "in":return "out_of_stock"return None
6. 24/7 Operation: Scheduling, Idempotency, Recovery, and Cost Control
The core of round-the-clock operation is not “never stop running” but “run recoverably.” Four points must be implemented:
- Scheduling: trigger collection on a timer with staggered execution; the orchestrator generates daily task batches.
- Idempotency: repeated writes for the same
item_keyin the same time bucket must be blocked by a primary key or deduplication key. - Recovery: persist the output of each stage, and after a process restart, continue from the most recent checkpoint instead of starting over.
- Cost: set step and call budget limits for each agent; when a limit is exceeded, converge to “output the current best conclusion and state the gap.”
Observability is equally indispensable. Record structured logs and metrics uniformly: task success rate, average chain latency, calls per task, and alert hit rate. When metrics look abnormal, investigate selector failures and rate limiting first, since these account for most real-world failures.
7. Common Pitfalls and How to Avoid Them
The first pitfall is role overreach: the developer agent modifies requirements on its own. Avoid it by making shared memory read-only and requiring all changes to go through orchestrator approval. The second is error accumulation: an upstream mistake gets amplified downstream. Avoid it by requiring key conclusions to include sources and confidence, and by giving the tester agent the authority to send work back. The third is alert fatigue: overly sensitive thresholds cause notifications to be ignored. Avoid it with window aggregation and a merged daily summary. The fourth is context bloat: private memory grows without bound. Avoid it with rolling summaries that keep only conclusions and open items.
8. Conclusion
The essence of a multi-agent legion is engineering the software delivery process: replaceable roles, isolated contexts, traceable messages, and recoverable failures. Once this skeleton is in place, the chain from requirements to delivery can keep running unattended, and the team can focus its energy on defining goals and adjudicating quality. To further lower the barrier to building and operating such a system, you can combine general-purpose capabilities from Baidu AI Cloud — container platform, message queue, object storage, log service, and monitoring and alerting — to bring the architecture into production faster.
