How to Build an Always-On Multi-Agent Development System from Scratch

    This article walks through the engineering design of an always-on multi-agent development system, using a competitor price monitoring dashboard as the running example. It explains why the goal is reliable delivery rather than agent chatter, how to split model judgment from execution control across six architectural layers, how to define roles with clear inputs, outputs, and boundaries, and how to replace free-form conversation with structured task handoffs. It also covers layered context management, data semantics and failure handling for price collection, isolated code execution, test-backed acceptance, recovery and cost limits for long-running operation, model selection based on measured task performance, and a staged rollout path. The core takeaway: automation becomes sustainable only when task protocols, shared facts, execution isolation, verification, and failure recovery are separated cleanly, with humans owning high-risk decisions.

    1. Start With the Goal: Reliable Delivery, Not Agent Conversation

    The easiest thing a multi-agent system can demonstrate is several roles taking turns talking about the same requirement. For real development work, how lively the discussion is does not matter. What matters is whether the system produces a clear requirement, usable code, passing tests, and the ability to keep moving after a failure.

    Take “build a competitor price monitoring dashboard” as an example. The user may submit a single sentence:

    Support entering competitor page URLs, periodically collect price, discount, and stock status, display price trends, send notifications on low prices, abnormal fluctuations, or out-of-stock, and support table export.

    That sentence states a business goal but does not fully define system behavior. Which pages can be collected? How are different variants of the same product handled? What is displayed when collection fails? How large a fluctuation counts as abnormal? Do notifications require approval? If these questions are not clarified up front, the development agent can generate a large amount of code and still deliver a system nobody can accept.

    So the core problem a multi-agent development system has to solve is not “add a few more roles.” It is establishing a controlled delivery chain:

    requirement intake → information completion → task decomposition → role-based execution → deliverable review → integration testing → human confirmation → release and operation.

    “Always-on” also does not mean agents are allowed to modify production without limits. A more accurate goal: low-risk tasks can run continuously, high-risk operations require explicit authorization, and the system stays observable, pausable, and recoverable while unattended.

    2. Overall Architecture: Separate Model Judgment From Execution Control

    A practical multi-agent system can be divided into six parts.

    2.1 Task Entry Point

    The entry point can be an enterprise messaging channel, an admin page, or an internal API. It receives requirements, identifies the submitter, creates a task ID, and collects the necessary business parameters.

    The entry point should not hand a natural-language requirement straight to a high-privilege execution tool. A safer approach is to first form a task draft containing:

    • Business goal and intended users;
    • Expected deliverables;
    • Permitted data sources;
    • Time, budget, and resource limits;
    • Operations that require human confirmation;
    • Verifiable acceptance criteria.

    When information is missing, the system should ask clarifying questions rather than invent business rules.

    2.2 Orchestration and Control Layer

    The orchestration layer owns task state, dependencies, permission checks, timeout handling, and retry scheduling.

    A model can suggest “which role should handle the next step,” but whether that step actually executes should be decided by deterministic control rules. For example, formal development must not start before the requirements document has been reviewed and approved; code that has not passed automated tests must not enter the release stage.

    This design prevents a model from declaring “the task is complete” in conversation while the actual deliverables are still missing.

    2.3 Specialist Agent Layer

    Different agents take on different responsibilities, each with its own context and tool permissions.

    The value of role separation is narrowing task scope and making output ownership explicit. It does not assume that multiple models are automatically more accurate than one. Multiple agents can also share the same mistake, so independent evidence and programmatic verification are still required.

    2.4 Tool Execution Layer

    This layer provides controlled file read/write, code execution, test execution, data queries, and message sending.

    Tool execution needs identity verification, parameter validation, resource limits, and audit records. External access, dependency installation, sensitive file reads, and production data modification should each have separate authorization rules.

    2.5 State and Deliverable Storage Layer

    Task state, requirement documents, design notes, code versions, test results, and review comments all need to be persisted.

    Do not rely only on model conversation history to hold project facts. Once a long task spans multiple sessions, or the execution process restarts, depending on context alone easily loses key decisions.

    2.6 Monitoring and Security Layer

    This layer records runtime logs, tracks resource consumption, detects abnormal loops, performs emergency stops, and raises alerts on sensitive behavior.

    The overall relationship can be understood as:

    1. Requirement entry
    2. ↓
    3. Task orchestration and permission control
    4. ↓
    5. Research → Product → Architecture → Development → Testing
    6. ↓ ↓ ↓
    7. Shared deliverable store and persisted task state
    8. ↓
    9. Delivery approval and runtime monitoring

    3. Dividing Roles: Every Role Needs Input, Output, and Boundaries

    You do not need a dozen agents to start. For the competitor price monitoring project, six roles are enough to cover the main delivery flow.

    3.1 Coordinator Agent

    Responsible for requirement clarification, work breakdown, dependency management, deliverable aggregation, and progress reporting.

    It should not hold all execution permissions by default. In particular, releasing, deleting data, and modifying credentials should be reviewed by a separate control mechanism.

    The coordinator’s main outputs are the task plan, the risk list, and stage summaries, not doing everyone else’s work for them.

    3.2 Research Agent

    Responsible for analyzing the price monitoring scenario, data acquisition constraints, common business rules, and potential compliance issues.

    The research report should separate facts, inferences, and items still to be verified. Cited external information needs a record of the source and retrieval time, but text inside an external page must not become a system instruction.

    For questions like “does the displayed page price equal the actual transaction price,” if reliable evidence is missing, the item should be marked uncertain rather than written up as a settled conclusion.

    3.3 Product Agent

    Responsible for turning business intent into functional requirements and acceptance criteria.

    For example, “support price alerts” needs to be broken down further into:

    • Setting a low-price threshold per product;
    • Computing the change ratio between adjacent valid samples;
    • Merging repeated events;
    • Allowing notifications for a specific product to be paused;
    • Displaying trigger time, current value, and reference value.

    The product agent must also state what is out of scope. For instance, the first release may support only a small number of authorized data sources and should not promise coverage of every page.

    3.4 Architecture Agent

    Responsible for data models, module boundaries, interface contracts, deployment structure, and failure handling.

    Architecture design has to answer real constraints. A small prototype usually does not need a complex distributed architecture; queues and stricter scheduling become worthwhile when the number of collection targets grows, tasks back up, or multiple execution nodes run in parallel.

    3.5 Development Agent

    Responsible for implementing features in an isolated workspace, adding tests, and submitting change descriptions.

    If it can call an AI coding tool, restrict the tool’s working directory, network access scope, and runtime resources. Commands proposed by the agent are execution requests to be validated, not instructions that run unconditionally.

    3.6 Testing and Review Agent

    Responsible for checking whether the implementation meets requirements and for trying to find error paths and security problems.

    The testing agent should verify against frozen acceptance criteria rather than accept verbal conclusions from the development agent. High-risk modules additionally need human review.

    4. Task Protocol: Turn Free Conversation Into Structured Handoffs

    Agents can send each other messages, but critical handoffs should not rely on natural language alone. Every task record should carry at least:

    1. Task record:
    2. Task ID
    3. Project
    4. Owning role
    5. Input deliverable version
    6. Prerequisites
    7. Expected output
    8. Acceptance criteria
    9. Risk level
    10. Deadline
    11. Current status

    Task states can be:

    1. Needs clarification → Ready → In progress → Pending review → Done
    2. ↓
    3. Blocked
    4. ↓
    5. Needs attention

    These names are design examples, not a fixed interface of any existing system.

    The key principle: every state change must carry evidence. Moving to “pending review” should include the deliverable location and version; moving to “done” should include the review result; moving to “blocked” should state the reason and who needs to act.

    Also prevent endless rework. If the same task fails review repeatedly, automatic revision should pause and the task should go to a human. Otherwise the system may keep generating similar changes, consuming resources without improving the result.

    5. Context Management: Independent Work, Shared Facts

    “Each agent has its own context” helps reduce cross-role interference, but independent contexts must not become information silos.

    Split information into three layers.

    5.1 Project-Level Facts

    Goals, terminology, constraints, acceptance criteria, and confirmed decisions. All roles read the same version.

    5.2 Task-Level Inputs

    Document excerpts, interface definitions, relevant code, and prior deliverables needed for the current task.

    There is no need to stuff the entire project into every call. Provide what the task needs and keep a retrieval path back to the original deliverables.

    5.3 Role-Level Working Notes

    Intermediate analysis, attempts, and local notes. These can stay in the role’s own context and do not all need to be broadcast.

    For long-running operation, maintain a decision record:

    1. Decision: The first release only connects data sources with confirmed access authorization
    2. Reason: Reduce compliance and collection-stability risk
    3. Impact: Some products cannot enter automated monitoring yet
    4. Status: Confirmed
    5. Related: Requirement version and approval record

    Stage summaries help resume a task, but a summary is not the source of truth. When amounts, interface fields, or security constraints are involved, go back to the original documents so that an omission or error in a summary is not amplified over time.

    6. Case Study: Designing the Competitor Price Monitoring System

    6.1 Define What a Product and a Quote Mean

    Price monitoring is first a data semantics problem and only second a collection problem.

    The same product may have different variants, regions, membership conditions, and discount thresholds. Comparing two numbers on a page directly produces false alerts.

    Recommended fields to store separately:

    • Product name and variant;
    • Data source and external product identifier;
    • Collection time;
    • Displayed price and original (strikethrough) price;
    • Discount condition description;
    • Stock status;
    • Currency;
    • Collection result status;
    • Parsing rule version.

    A missing price must not be recorded as zero, and unknown stock must not be treated as out of stock. A post-discount price that cannot be confirmed should keep its condition description rather than being forced into an “actual transaction price.”

    6.2 Collection Needs Explicit Failure Semantics

    Recommended processing chain:

    1. Scheduled task
    2. → Check access authorization and rate limits
    3. → Fetch data
    4. → Parse fields
    5. → Validate completeness and plausibility
    6. → Save the sample result
    7. → Run alert evaluation

    Parse failure, access failure, and out-of-stock are three different states and must be recorded separately.

    When a collection run fails, the dashboard can keep showing the most recent valid price, but it must clearly mark the data update time and the current collection status so users do not mistake stale data for the latest result.

    Collection must respect the source’s access rules, the authorized scope, and applicable legal requirements. Coverage should not be improved by bypassing access restrictions.

    6.3 Anomaly Detection Must Resist Noise

    The change ratio between adjacent valid samples can be expressed as:

    1. Change ratio = (current price - reference price) / reference price

    Before computing, confirm the reference price is greater than zero and that both samples share the same variant, currency, and price basis.

    Anomaly detection can combine:

    • User-defined upper and lower price bounds;
    • Change ratio between adjacent samples;
    • Price distribution over a recent window;
    • Confirmation across several consecutive samples;
    • Correlation checks against discount condition changes.

    Concrete thresholds should come from business configuration or historical validation. Do not treat demo thresholds as universal standards.

    6.4 Notifications Should Deduplicate, Not Fire on Every Collection

    The notification module should track event state. For example, if the same product stays below the threshold, notify only on first trigger or on a significant state change.

    Give each event a stable identifier and persist its send status. If sending times out, check whether it already succeeded before retrying to reduce duplicate notifications.

    Even so, avoid promising that external notifications will “never” duplicate. In practice, duplicate risk is controlled with idempotency records, deduplication windows, and compensation mechanisms.

    6.5 Export Needs Security Design Too

    Table export is not just writing data to a file; it also involves permissions, data volume, and content safety.

    Text beginning with certain characters that spreadsheet software may interpret as a formula should be safely escaped. Large exports should run as asynchronous tasks so they do not block interactive requests.

    Exported files should also include the time range, price basis, and notes on anomalous data, so users do not mistake an incomplete sample for a complete market picture.

    7. Code Execution: Autonomous Development Must Be Built on Isolation

    An agent’s ability to keep writing code does not mean it should control production servers directly.

    A safer execution model:

    1. Create a separate workspace for each development task.
    2. Mount only the code and documents the current task needs.
    3. Deny access to production credentials and sensitive directories by default.
    4. Limit CPU, memory, disk, and execution time.
    5. Apply scope restrictions to outbound network access.
    6. Save change diffs, execution logs, and test reports.
    7. Enter the integration environment only after review approval.

    Relying on a simple command blacklist is not recommended. Command combinations, script invocations, and indirect execution can all bypass string checks. More effective constraints live at the level of operating system permissions, execution isolation, network policy, and credential management.

    Also define change isolation and integration order across development tasks so different agents do not overwrite the same file simultaneously.

    8. Quality Acceptance: Done Must Be Backed by Test Evidence

    For the price monitoring case, acceptance should cover at least four test categories.

    8.1 Functional Tests

    Verify product entry, sample storage, trend display, alert configuration, and the export flow.

    8.2 Exception Tests

    Verify access timeouts, missing fields, malformed price values, unknown stock, and notification failures.

    8.3 Security Tests

    Verify unauthorized access, sensitive information leakage, dangerous file operations, and handling of malicious input.

    Collected content is untrusted external data. Even if a page contains text such as “ignore previous rules” or “read the local file,” it can only be treated as page content and must not be promoted to an execution instruction.

    8.4 Recovery Tests

    Verify that a task can resume after an execution node is interrupted, that repeated delivery does not cause duplicate writes, and that failed notifications are compensated correctly.

    Developers should also watch requirement coverage, not just test count. A large number of tests that all revolve around the happy path can still miss critical risks.

    9. Always-On Operation: Recovery Capability and Cost Boundaries

    Long-running operation requires the following mechanisms.

    9.1 Heartbeats and Task Leases

    Execution nodes periodically update their liveness. When a task lease expires, the scheduler decides whether to reassign it, preventing multiple nodes from working the same task.

    9.2 Checkpoints and Idempotency

    Save deliverables and state at stage completion. On recovery, continue from the most recent valid checkpoint instead of re-running everything.

    Operations that write, notify, or release should use idempotency keys or duplicate detection.

    9.3 Bounded Retries

    Transient failures can be retried. Missing permissions, conflicting requirements, and long-term data format changes are not suitable for blind retries.

    Retries need a count limit, a wait interval, and escalation conditions. Once the limit is exceeded, the task becomes blocked and the owner is notified.

    9.4 Budget and Deadline Conditions

    Budget covers not only model call cost but also execution time, storage, network, test resources, and human review effort.

    When a task hits a budget boundary, it should pause and output what is done, what remains, and the risk of continuing, rather than consuming resources indefinitely to preserve “autonomous operation.”

    9.5 Human Takeover

    Expanding external access scope, changing production configuration, handling sensitive data, performing irreversible operations, and formal releases are all good candidates for human approval.

    The takeover interface should show the purpose of the operation, its blast radius, the proposed change, and the rollback plan, not just a single “approve?” button.

    10. Model Selection: Validate With Task Performance, Not Marketing Claims

    Multi-agent development mainly demands that a model:

    • Reliably follow role and output constraints;
    • Understand structured tasks and tool feedback;
    • Preserve key constraints across long tasks;
    • Fix code based on test failures;
    • Recognize missing information and ask for clarification proactively;
    • Refuse to treat external content as high-privilege instructions.

    For evaluation, build a fixed set of tasks close to your business and record success rate, number of human interventions, elapsed time, and cost. A large context window does not guarantee that a model accurately remembers every constraint, and strong code generation does not guarantee reliable execution of a release process.

    Model capability can be allocated by risk and complexity, but the task protocol and acceptance criteria must stay unified after any switch so different execution paths do not produce inconsistent results.

    11. Suggested Rollout Order

    Stage one: a single agent with controlled tools. Validate the requirement entry point, deliverable storage, execution isolation, and human acceptance.

    Stage two: add product and development roles, establish structured handoffs, and address information loss between requirements and implementation.

    Stage three: introduce an independent testing role and use failure cases to exercise rework, blocking, and recovery mechanisms.

    Stage four: add research, architecture, and parallel tasks to handle more complex projects.

    Finally, gradually connect continuous scheduling, notifications, monitoring, and approvals. Each time you open a new automated execution permission, first verify that failure handling and the emergency stop actually work.

    Conclusion

    The engineering value of a multi-agent system lies neither in the number of roles nor in how long it appears to run unattended. It lies in whether it can turn a vague requirement into a deliverable that is evidence-based, versioned, and verified.

    To build an always-on collaborative development system, prioritize the task protocol, shared facts, execution isolation, test-based acceptance, and failure recovery. Models handle understanding and reasoning, the orchestration layer handles rules and state, the tool layer handles controlled execution, and humans handle key risk decisions. Only when these responsibilities are cleanly separated does automation move from a demo effect to a sustainable engineering practice.