Multi-Agent System Design for 24/7 Continuous Delivery: A Practical Guide

    This article explains how to build a multi-agent system that delivers software continuously rather than just generating code once. Using a competitor price-monitoring dashboard as a running example, it covers turning business requirements into acceptance criteria, defining agent roles and communication boundaries, organizing delivery with a persistent state machine, separating independent contexts from a shared source of truth, enforcing least-privilege tool access and prompt-injection defenses, designing data collection and alerting rules, testing both business logic and agent workflows, and controlling reliability and cost. It closes with a four-stage rollout path: make the process verifiable first, then automate it; make failures recoverable first, then run around the clock.

    1. From “Agents Can Write Code” to “The System Can Keep Delivering”

    Getting an agent to produce code once and getting several agents to collaborate on a project over time are two different problems.

    The first usually needs only a clear input and a limited context. The second also has to handle task decomposition, role collaboration, dependencies, execution permissions, result verification, and failure recovery. Without these mechanisms, adding more agents may only add communication overhead without improving delivery quality.

    A multi-agent system should therefore not be understood as “several chat windows open at the same time,” but designed as an engineering system with explicit control logic:

    • Models handle understanding, analysis, planning, and generating candidate results.
    • The orchestration layer handles state transitions, task dispatch, and dependency management.
    • The tool layer executes controlled operations.
    • The storage layer persists facts, artifacts, and execution records.
    • The verification layer decides whether results meet the delivery standard.

    This article uses a “competitor price monitoring dashboard” as the running case. After the user states the requirement, the system proceeds through research, product design, architecture design, development, testing, and delivery. Note that running around the clock means the service can schedule work continuously and recover from failures; it does not mean the model can execute without limits, and it certainly does not mean generated output is correct by default.

    2. Turn Business Requirements into Verifiable Goals First

    The original requirement can be summarized as follows:

    The user enters competitor product links; the system periodically collects price, reference price, promotion information, and stock status; it displays historical trends, sends notifications when price or stock rules are triggered, and supports exporting table files.

    This description is enough to start a discussion, but not enough to start development directly. At minimum, the following questions need answers:

    1. Is automated access to the data sources permitted?
    2. Do the product links cover different variants, regions, or membership conditions?
    3. Does “low price” mean below a fixed threshold, or below a historical baseline?
    4. Does stock status depend on the delivery region?
    5. What is the collection frequency, and how are failures handled?
    6. Who receives notifications, and should duplicate events be merged?
    7. Which fields does the export contain, and how is the time range limited?

    These questions determine the system’s data model, collection strategy, and acceptance method. Agents can compile open questions and propose defaults, but they should not record unconfirmed assumptions as established facts.

    2.1 Define Layered Acceptance Criteria

    It is worth splitting acceptance into four layers.

    Functional acceptance: the ability to create monitoring tasks, store collection records, display trends, manage rules, and export data.

    Data acceptance: every record contains collection time, source identifier, currency, product variant, and collection result status. Data that cannot be determined must be marked as unknown rather than filled in arbitrarily.

    Operational acceptance: scheduled tasks can recover, failures can be retried, and repeated execution does not produce duplicate notifications or duplicate records.

    Security acceptance: credentials never appear in conversations or artifacts, collection behavior stays within the authorized scope, and release operations go through the required approval.

    Writing acceptance conditions up front avoids a development agent delivering a demo system where “the page opens but the business does not work.”

    3. Role Division and Collaboration Boundaries

    Roles should be divided by work products and permissions, not by titles alone. A practical initial team can include:

    Role Core responsibility Main artifacts
    Coordinator agent Decompose requirements, manage dependencies, check stage results Task plan, status records, delivery checklist
    Research agent Map business scenarios, data sources, and constraints Research report, risk list
    Product agent Define scope, interaction, and acceptance conditions Requirement spec, process description
    Architecture agent Design modules, data structures, and runtime approach Architecture notes, interface contracts
    Development agent Implement features, submit changes, handle defects Code changes, run instructions
    Test agent Verify business behavior, failure paths, and security boundaries Test records, defect reports

    The value of role isolation is reduced context pollution. For example, the test agent should mainly receive the requirement spec, interface contracts, and the version under test, rather than fully inheriting the development agent’s explanation of its own implementation. This supports independent review, though it does not guarantee the models share no blind spots.

    3.1 Do Not Make Full-Mesh Communication the Default

    Letting every agent message every other agent freely looks flexible, but in practice it easily causes repeated discussion, mutual waiting, and drifting responsibilities.

    A more robust pattern is for the coordinator agent to own the main task while each role communicates only with the dependency nodes it needs. For example, when testing finds a defect it produces a structured defect ticket; after fixing it, development submits a new version; the orchestration layer schedules retesting based on status.

    Messages can use a format like the sketch below. These fields are an application-defined protocol and do not represent any existing product interface.

    1. Task ID: task-042
    2. Message type: stage result
    3. From role: product
    4. To role: coordinator
    5. Related version: requirement spec v2
    6. Artifact location: document reference in the controlled artifact store
    7. Conclusion: variant distinction and notification deduplication rules must be added
    8. Blocker: price threshold not yet confirmed

    A real system should also record message time, processing status, and a trace identifier so it is possible to locate why a task stalled.

    4. Organize Delivery with a Persistent State Machine

    Long-running tasks should not be driven by chat history alone. Chat context is model input; it cannot replace reliable business state.

    The main flow can be designed as:

    1. Requirement received
    2. → clarification and confirmation
    3. → research complete
    4. → requirement spec approved
    5. → architecture review passed
    6. → development complete
    7. → testing passed
    8. → release approval
    9. → delivery and observation

    Each stage also supports failure branches:

    1. running → success
    2. running → retryable failure → waiting for retry
    3. running → non-retryable failure → manual handling
    4. running → waiting for confirmation
    5. running → cancelled

    4.1 Stage Transitions Require Evidence

    “The development agent says it is done” should not trigger delivery directly. Moving to the next stage requires explicit conditions, for example:

    • The requirement stage has confirmed acceptance items.
    • The architecture stage specifies data sources, error handling, and permission boundaries.
    • The development stage stores a traceable code version and run instructions.
    • The test stage has test records tied to the target version.
    • The release stage has the corresponding permission and approval.

    The coordinator agent can help check materials, but the final state update should be controlled by deterministic rules and an authorization mechanism.

    4.2 Persistent Checkpoints

    Task state, stage artifacts, failure reasons, and next actions should all be written to persistent storage. After the runtime process restarts, the system resumes from the most recent checkpoint instead of re-running the entire project.

    For operations with side effects such as notifications, collection, and release, idempotency control is needed. For example, the same monitoring task in the same scheduled collection window should produce only one valid result, and repeatedly delivered notification events should be recognized and merged.

    5. Balancing Independent Contexts with Shared Facts

    Giving each role an independent context reduces irrelevant interference, but it can also produce divergent understandings of the business.

    The solution is not to copy every conversation to every role, but to establish a shared source of truth.

    It helps to divide information into three classes:

    Stable facts: confirmed requirements, acceptance criteria, interface contracts, permission constraints.

    Stage artifacts: research reports, design documents, code versions, test reports.

    Temporary reasoning: option comparisons, unconfirmed judgments, process discussion.

    Stable facts must have versions and change records; temporary reasoning must not be promoted automatically into formal constraints. On each handoff, the receiving role should get the currently effective version, not the entire history.

    5.1 A Long Context Is Not the Same as Not Forgetting

    A model’s ability to accept a long input does not mean it will always use every detail in it accurately. When there is too much information, critical constraints can still be missed.

    A more reliable approach is to build a compact context package for each subtask:

    • The current goal and the prohibited actions.
    • The necessary requirement excerpts.
    • Relevant interfaces and data structures.
    • Version references to dependency artifacts.
    • The required output format for this task.
    • Acceptance check items.

    Summaries can compress information, but key facts should retain their original basis. For high-risk content such as price rules, authorization scope, and release conditions, do not rely on automatic summarization alone.

    6. Tool Calls Need Least Privilege and Execution Isolation

    A development agent needs to access files, run tests, modify code, and sometimes call AI coding tools. These capabilities must be provided through a controlled tool layer.

    6.1 Authorize by Risk Level

    Operations can be grouped into three classes:

    Low-risk operations: reading project files, generating documents, running static checks.

    Medium-risk operations: modifying code, installing approved dependencies, running local tests. These should run in an isolated environment with changes recorded.

    High-risk operations: accessing production data, deleting resources, changing permissions, publishing externally. These require manual confirmation or a strict approval policy.

    Agents should not hold long-lived production credentials directly. The runtime environment should inject short-lived, narrowly scoped authorization, and sensitive content in logs should be masked.

    6.2 Guard Against Instruction Injection in External Content

    Product pages, research material, and user-uploaded files are all untrusted input. Even if such content contains text like “ignore the previous rules” or “run this command,” it can only be treated as data to analyze, never as an instruction for tool operations.

    Protection must be implemented in both the model prompt and the tool boundary:

    • Keep external content separated from system instructions.
    • Let tools accept only structured, validatable parameters.
    • Restrict file access to authorized directories.
    • Restrict network access to a defined target scope.
    • Require separate authorization for high-risk operations.
    • Log alerts for suspicious instructions and stop the related actions.

    Simply telling the model “do not perform dangerous operations” is not a security mechanism.

    7. Data and Collection Design for the Price Monitoring System

    Price monitoring looks like storing numbers, but it actually requires handling several price definitions. Listed price, price after promotion, member price, and variant-specific price may all differ; putting them on a single curve is misleading.

    A product record should contain a business identifier, source identifier, variant information, and monitoring status; a collection record stores time, amount, currency, stock status, promotion conditions, and result status.

    Amounts are best stored as fixed-point decimals or as integers in the smallest currency unit to avoid precision problems from binary floating-point arithmetic. Times should be stored on a unified basis and converted to the user’s time zone for display.

    Stock status can be defined as “in stock, out of stock, unknown.” If collection fails or the page structure changes, record unknown or failed rather than automatically deciding out of stock.

    7.2 Collection Pipeline

    1. Scheduled trigger
    2. → create collection task
    3. → check authorization and access restrictions
    4. → fetch permitted data
    5. → parse and normalize
    6. → validate variant, currency, and price definition
    7. → store record
    8. → evaluate alert rules
    9. → create notification event

    Prefer data sources that are legally authorized or publicly permitted for access. When encountering authentication, access restrictions, or an explicit prohibition on automated collection, do not attempt to bypass them.

    The collector and the business rules should be separated: the collector fetches and normalizes data, the rule engine evaluates changes, and the notification module handles delivery. This limits the impact of a single source change on the whole system.

    8. Alert Rules Cannot Depend on a Single Price Difference

    Common rules include fixed thresholds, relative change rates, and stock status changes.

    The relative change rate can be expressed as:

    1. change rate = (current price - baseline price) / baseline price

    Before calculating, confirm the baseline price is valid and greater than zero, and ensure the product variant, currency, and price conditions match.

    An “abnormal fluctuation” is not necessarily a market change; it may come from a parsing error, a variant switch, or a change in promotion conditions. Before alerting, it therefore helps to add data quality checks, confirmation across consecutive observations, and a cooldown period.

    A notification event should preferably store:

    • The triggering target and rule version.
    • The current value and the comparison baseline.
    • The trigger time and related collection records.
    • Delivery status and failure reason.
    • Deduplication identifier and handling record.

    Notification failures should be retried independently, without repeating collection or regenerating alerts. For a persistent out-of-stock state, send a first notification when the status changes and then send summaries as the business requires, avoiding message flooding.

    9. Testing Must Cover Deterministic Logic Beyond the Model

    Testing a multi-agent system should follow two tracks.

    The first is business system testing, covering amount calculation, rule evaluation, task scheduling, export, notifications, and permission control.

    The second is agent workflow testing, covering whether the system proactively asks for clarification when requirements are missing, whether it can recover after a task failure, whether defective artifacts are blocked from entering the next stage, and whether malicious external content can trigger tools beyond its authority.

    The price monitoring case should cover at least:

    • Normal collection producing a valid record.
    • Missing or malformed price fields.
    • A change in product variant.
    • A temporarily unreachable source.
    • An unavailable notification service.
    • A duplicated task submission.
    • The runtime process being interrupted before or after saving results.
    • A requirement change invalidating old test results.

    For table export, also account for the risk of untrusted text being interpreted as a formula by spreadsheet software, using safe escaping or an explicit data-type writing strategy where necessary.

    10. Reliability and Cost Control for 24/7 Operation

    Round-the-clock operation depends on infrastructure, not on keeping the model in a conversation.

    Production systems typically need a task queue, persistent storage, runtime isolation, health checks, logs, monitoring, and alerting. On failure, the system must be able to determine whether the task has not run yet, failed during execution, or succeeded but lost result confirmation.

    10.1 Retries Must Be Bounded

    Transient network failures can use backoff retries with randomized jitter; insufficient permissions, contradictory requirements, or an illegitimate data source should stop the task and hand it to a human.

    Each task class should have a maximum attempt count, an execution timeout, and an overall budget. Once a limit is exceeded, save the failure state to avoid the agent falling into an infinite loop.

    10.2 Observe Real Delivery Quality

    Beyond the number of model calls, also track:

    • End-to-end delivery time.
    • Waiting time per stage.
    • First-pass acceptance rate.
    • Defect reopening rate.
    • Tool call failure rate.
    • Number of manual interventions.
    • Resource consumption per delivery.

    These metrics show whether the system genuinely reduces rework rather than just producing more text faster.

    Cost control can start with reducing irrelevant context, reusing confirmed artifacts, running independent tasks in parallel, and letting deterministic programs handle rule computation. Models should be used mainly for understanding and generation, not for every scheduled trigger or simple threshold comparison.

    11. Roll Out in Four Stages

    Stage 1: Establish a controlled single-task flow.
    First get requirement clarification, development, testing, and manual acceptance working end to end, and validate artifact standards and tool permissions.

    Stage 2: Split the key roles.
    Isolate development from testing first, then add product and architecture roles as task complexity grows, avoiding the creation of too many agents at the start.

    Stage 3: Add persistence and recovery.
    Implement the state machine, task queue, checkpoints, idempotency, and failure handling, and verify that execution can continue after a restart.

    Stage 4: Extend to continuous operation.
    Add scheduled collection, notification deduplication, monitoring and alerting, budget control, and release approval, gradually widening the scope of automation.

    The most important engineering principle is: make the process verifiable before automating it, and make failures recoverable before pursuing 24/7 operation.

    The value of multi-agent collaboration lies not in the number of roles, nor in how much content a model can generate continuously, but in whether requirements, evidence, actions, and acceptance can be connected. Only by combining model reasoning with deterministic control, permission management, testing, and operational safeguards can you build a genuinely maintainable continuous delivery system.