Multi-Agent Development System in Practice: Building an Always-On Automated Engineering Pipeline
This article explains how to build a multi-agent development system that runs an automated engineering pipeline around the clock. It covers why a single long-prompt conversation fails at context pollution, broken task chains, and role conflicts; how to map a small set of specialized agents into a one-way topology; how to isolate context with a structured message envelope; and how to keep long-running tasks stable through externalized state, staged validation, context compaction, and idempotent retries. A competitor price monitoring case study and notes on observability, cost control, and common pitfalls are included.
1. Why a Single Model Conversation Cannot Support Always-On Development
Many teams take a wrong first step when automating R&D: they hand a single, extremely long prompt to the model and expect it to complete research, design, coding, testing, and delivery in one shot. This looks impressive in a demo, but it breaks down quickly on a real project for three reasons.
First, context pollution. Requirements, design drafts, error logs, and temporary conclusions all sit in the same conversation, making it hard for the model to tell which line is the current constraint and which is an obsolete intermediate artifact. Second, broken task chains. Long tasks span dozens of turns, and a single misjudgment along the way means every later inference is built on a false premise. Third, role conflict. The same context is asked to do divergent market research and convergent architecture decisions at once; the two thinking modes interfere with each other, and output quality inevitably drops.
The value of a multi-agent architecture is that it separates these three problems: independent contexts address pollution, explicit message passing addresses broken chains, and role separation addresses thinking conflicts.
2. Role Design: Mapping an Organization Chart to an Agent Topology
A usable development legion should not have too many roles; five to seven is usually enough to cover the full chain. A recommended split of responsibilities:
- Orchestrator agent: the only external interface, responsible for requirement clarification, task decomposition, prioritization, and final acceptance.
- Research agent: collects market and competitor information, and outputs structured conclusions rather than long prose.
- Product agent: turns research conclusions into a requirements document, defining feature boundaries and acceptance criteria.
- Architecture agent: defines module boundaries, data models, and interface contracts.
- Development agent: invokes a local AI coding tool to land code, with autonomous decision-making and multi-round iteration.
- Test agent: generates cases from the acceptance criteria, runs them, and returns failure context.
- Ops/alerting agent: handles scheduled jobs, monitoring alerts, and result archiving.
The key principle of role design is single responsibility and one-way data flow. The research output flows only to product, and the product output flows only to architecture; letting any two agents message each other freely would turn the topology into a mess.
3. Context Isolation and the Message Protocol
Each agent should have its own session and its own memory space, with cross-role information passed as structured messages. A minimal viable message envelope can look like this:
{"from": "research_agent","to": "product_agent","task_id": "T-20260805-001","type": "artifact","payload": {"summary": "Competitor prices cluster in the 99-199 band","evidence": ["ref_01", "ref_07"],"confidence": 0.82},"trace": ["T-001", "T-004"]}
Three fields deserve special attention: task_id is used for chain tracing, type decides how the receiver parses the message, and trace keeps references to upstream tasks so the whole chain stays auditable. In practice, it is best to write every artifact to disk as a file and pass only the path and a summary in the message body, so the context is not blown up by large blocks of raw text.
4. Long-Task Stability: Systems Engineering Beyond Model Capability
Even with an open-source large model that has strong coding and cluster capabilities, you cannot bet all stability on the model. The engineering side needs at least four things.
One, externalize state. Write the task state machine into separate storage with four states: pending, in progress, blocked, and awaiting acceptance. Any agent restores from storage after a restart instead of relying on conversation memory.
Two, validate in stages. Every stage’s output must be checkable: a requirements document needs an acceptance criteria checklist, an interface definition needs contract validation, and code needs a runnable minimal loop. If validation fails, roll back to the previous node rather than passing the problem downstream.
Three, compact context. Summarize historical messages in layers, keeping decision conclusions and constraints while discarding process chatter. Sketch of the logic:
def compact(messages, keep_recent=6, max_chars=4000):recent = messages[-keep_recent:]older = summarize(messages[:-keep_recent])text = older + "\n".join(recent)return text[:max_chars]
Four, idempotence and retries. Side-effect operations such as scheduled collection and message pushing must be idempotent, and retries on failure must not produce duplicate data or duplicate alerts.
5. Case Study: Implementing a Competitor Price Monitoring System
Take the e-commerce competitor price monitoring system described above; the full chain can run like this.
After receiving the requirement, the orchestrator agent first clarifies three questions: which categories to monitor, the threshold definition for a low price, and the alert delivery channel. It then splits the work into a parallel research phase and a serial development phase. The research agent outputs the price band distribution and a list of major players; the product agent produces a requirements document specifying that the collected fields are price, original price, discount, and stock status, and requiring a trend chart plus anomaly markers; the architecture agent defines the boundaries of the collection, storage, computation, presentation, and alerting layers, and agrees on the table schemas and interface contracts.
The development agent invokes a local AI coding tool to autonomously build the collection script, data cleaning, metric computation, and export modules, repeatedly self-testing locally until the minimal loop runs. The test agent generates boundary cases from the acceptance criteria, covering out-of-stock, sudden price drops, and missing fields, and returns failure context to the development agent to form a fix loop. Finally, the ops agent registers the scheduled job and configures threshold alerts and daily report archiving.
Run this flow overnight, with a human confirming only twice at key checkpoints, and you get deliverable results.
6. Observability, Cost Control, and Common Pitfalls
An automated legion’s biggest fear is “running as a black box.” It is advisable to instrument every agent uniformly, recording input summaries, output summaries, elapsed time, and token consumption, and to build a dashboard on top of a logging service and monitoring alerts. On cost, put strong models on hard nodes such as architecture and debugging, and lightweight models on simple nodes such as summarization and formatting; this usually cuts overall spend significantly.
There are four common pitfalls: blurry role boundaries that make agents wait on each other; oversized message bodies that overflow the context; missing idempotence that causes duplicate alerts; and no rollback mechanism that lets errors amplify all the way down. The way to avoid all of them points to one principle: lock uncertainty inside small, verifiable boxes.
7. Conclusion
The barrier to a multi-agent system is not “making the model talk,” but splitting the R&D process into nodes that are verifiable, rollback-able, and observable. When context isolation, the message protocol, externalized state, and staged validation are all solid, and an open-source model with stable long-context behavior is in place, an always-on automated development team stops being a demo toy and becomes an engineering asset that keeps producing.
