Building 24/7 Multi-Agent Systems: A Practical Engineering Guide

    Learn how to build a continuously operating multi-agent system with clear responsibilities, versioned task handoffs, controlled code execution, and reliable recovery. Using an e-commerce competitor price monitoring system as an example, this guide covers requirements, workflow orchestration, shared knowledge, data quality, testing, observability, and human approval. It also outlines a phased approach to moving from a single-agent workflow to sustained, controlled collaboration.

    1. From Multiple Agents to a Sustainable System

    Assigning market research, requirements analysis, architecture, development, and testing to different agents is one way to automate complex tasks. But creating multiple roles does not automatically produce reliable collaboration.

    Without task state management, agents may repeat the same work. Without explicit handoff protocols, downstream agents may continue developing against outdated requirements. Without acceptance checks, generated code is not evidence of completed delivery.

    A 24/7 multi-agent system is therefore best understood as an engineered execution system:

    Models provide understanding and reasoning; workflows organize tasks; tools execute operations; persistent storage preserves facts; and validation determines whether results are acceptable.

    “24/7” means the system can continuously receive events, schedule work, and handle failures—not that a model must generate content without interruption. Workers can wait when there is no work. Blocked tasks should enter a recoverable paused state. High-risk operations require human approval.

    This guide uses an e-commerce competitor price monitoring system to illustrate the approach. All task structures, fields, and pseudocode are illustrative design examples, not interfaces for an existing product.

    2. Define Acceptance Criteria Before Designing Agent Roles

    Turn Natural-Language Requests into Verifiable Goals

    A user might ask, “Build a competitor price monitoring system.”

    That request is not specific enough to begin development. At a minimum, clarify:

    • Are monitoring targets product URLs, product IDs, or collections of products?
    • Will data come from authorized APIs, public pages, or user-uploaded files?
    • Does “price” mean the displayed price, promotional price, or effective price after meeting specific conditions?
    • Must the system distinguish product variants, regions, membership status, and purchase quantities?
    • What are the collection frequency, notification channels, and data retention period?
    • Which actions require human confirmation?

    The system should first produce a requirements draft that clearly separates confirmed requirements, open questions, and unsupported features.

    An initial scope might be: periodically collect product prices and stock status from authorized sources, display historical trends, send alerts according to user-configured rules, and support spreadsheet export.

    These boundaries prevent agents from expanding the scope on their own and reduce rework.

    Separate Functional Acceptance from Operational Acceptance

    Functional acceptance checks whether the system meets business goals:

    • Can users add, pause, and delete monitoring tasks?
    • Does the system retain price change records?
    • Can it detect prices below a configured threshold?
    • Can it display trends and export data?

    Operational acceptance checks reliability:

    • Are collection failures retried according to policy?
    • Do duplicate tasks create duplicate records?
    • Can alerts be sent repeatedly within a short period?
    • Does task progress survive a restart?
    • Do credentials appear in logs or generated files?

    The system should enter continuous operation only after satisfying both sets of criteria.

    3. Define Roles Around Responsibilities, Not Titles

    A practical agent-assisted development workflow can use the following roles.

    Requirements Coordination Agent

    This agent receives user requests, asks clarification questions, breaks work into tasks, tracks status, and consolidates the final deliverables.

    It may determine execution order, but it should not bypass acceptance criteria to declare success. When requirements change, it should create a new version and identify existing artifacts that need to be rechecked.

    Research and Requirements Agent

    This agent documents business scenarios, data source constraints, feature boundaries, and acceptance criteria.

    Research findings must distinguish facts, inferences, and unverified assumptions. Information that cannot be confirmed should remain explicitly unknown rather than being replaced with plausible-sounding content.

    Architecture Agent

    This agent defines modules, data models, interface contracts, and key technical decisions.

    For price monitoring, the business system can be divided into:

    • Monitoring task management
    • Data collection and parsing
    • Price normalization
    • Historical record storage
    • Rule evaluation
    • Notification delivery
    • Queries, charts, and exports

    Modules should exchange information through explicit data structures rather than implicit conventions.

    Development Agent

    This agent generates and modifies code based on confirmed requirements and interface contracts, then performs the necessary local validation.

    It may invoke a controlled coding execution environment, but its permissions should be limited to the working directory, test environment, and approved operations. It should not receive production credentials or unrestricted system access by default.

    Testing and Delivery Agents

    The testing agent checks requirements coverage, constructs edge cases, reproduces defects, and produces test evidence. The delivery agent prepares deployment instructions, configuration checklists, operational runbooks, and known limitations.

    Separating responsibilities reduces the risk of an agent approving its own work. However, different agents may still share similar reasoning biases. Independent testing must therefore include executable assertions and actual runtime results, not just another model’s judgment.

    4. Organize Collaboration with a Task Graph

    Express the Workflow as Dependencies

    A basic task graph might look like this:

    Requirements intake → Clarification → Requirements confirmation → Architecture design → Parallel development → Integration testing → Security review → Human approval → Delivery

    Frontend, backend, and collection modules can be developed in parallel once their interface contracts are established. However, concurrent changes to the same interface definition can create conflicts. Parallel work should therefore be bounded by file ownership, module responsibilities, and contract versions.

    Persist an Explicit State for Every Task

    At a minimum, support these states:

    • Pending
    • Running
    • Waiting for external conditions
    • Awaiting review
    • Completed
    • Failed
    • Canceled

    A task should not become complete merely because an agent says, “Done.” Completion should require artifact references, validation results, and any necessary review records.

    The following is an illustrative task structure:

    1. Task ID: price-rule-014
    2. Goal: Implement a price-drop alert rule
    3. Dependency: Price normalization module has passed testing
    4. Inputs: Rule specification version 3, normalized price data structure
    5. Outputs: Implementation code, test cases, execution results
    6. Acceptance criteria:
    7. - Generate an event when the price drop reaches the threshold
    8. - Do not calculate a drop when the previous valid price is missing
    9. - Do not send duplicate notifications for repeated submissions of the same event
    10. Risk level: Medium
    11. Maximum attempts: Configured by workflow policy

    This structure makes a task reschedulable, auditable, and verifiable without tying it to a specific implementation.

    Messages Notify; Storage Is the Source of Truth

    Agents can send messages such as “Interface updated” or “Testing found a defect,” but messages should not be the only record of those facts.

    Formal requirements, interface contracts, code versions, and test results should reside in persistent storage. Messages should carry task IDs, artifact locations, and version information. Downstream agents should read the referenced version before proceeding.

    This allows the system to recover its context even when messages are delayed or workers restart.

    5. Combine Independent Contexts with Shared Knowledge

    Independent contexts help reduce interference between roles, but they can also fragment information. The solution is not to share every conversation with every agent. It is to establish layered memory.

    Manage Three Types of Information Separately

    Task-level context: The current objective, input materials, constraints, and recent execution results.

    Project-level knowledge: Confirmed requirements, architecture decisions, interface agreements, coding standards, and acceptance criteria.

    Runtime state: Task progress, retry counts, execution leases, budget consumption, and alert records.

    Task-level context can be compressed after execution. Project-level knowledge should be versioned. Runtime state must support accurate updates and failure recovery.

    Summaries Cannot Replace Original Evidence

    Long-running tasks can produce periodic progress summaries, but those summaries must reference the original artifacts.

    “Collection module completed” is insufficient. The record should also include:

    • The corresponding code version
    • Supported data source types
    • Tests that passed
    • Unresolved issues
    • Interface constraints for the next stage

    For amounts, permissions, thresholds, and data fields, agents should prioritize formal documents or structured configuration rather than relying solely on compressed model memory.

    6. Key Technical Considerations for Price Monitoring

    Start with Authorization and Access Rules

    Prefer authorized APIs or data that users are legally entitled to provide. For public pages, assess access rules, terms of use, rate limits, and permitted data usage.

    The system should not improve collection success by bypassing access controls, evading verification mechanisms, or obtaining unauthorized data.

    Classify collection failures before responding:

    • Temporary network failures may be retried after a delay.
    • Expired authorization should pause collection and notify an administrator.
    • Page structure changes should trigger a parsing repair workflow rather than unlimited retries.

    Price Normalization Matters More Than Extracting a Number

    Prices from different sources may not be directly comparable. A normalized record should include the product identifier, variant, currency, price type, stock status, collection timestamp, and discount conditions.

    Do not directly compare a per-unit price available only after meeting a spending threshold with an unconditional displayed price. If discount conditions cannot be determined, preserve the original description and mark the record as unsuitable for direct comparison.

    Use fixed-point or decimal representations appropriate for monetary calculations to avoid binary floating-point errors. Record collection time separately from processing time so delays can be analyzed.

    Alerts Must Account for Noise

    Common alerts include:

    • The current price falls below a user-defined threshold.
    • The price drops by more than a specified percentage relative to the previous valid price.
    • Stock changes from available to unavailable.
    • Data has not been updated successfully for an extended period.

    The price-drop ratio can be calculated as:

    1. Price drop ratio =
    2. (previous valid price - current valid price) / previous valid price

    Use this formula only when the previous price is valid and greater than zero, and both prices use the same comparison basis.

    Data quality checks, repeated observations, cooldown windows, and recovery notifications can reduce false alerts. Requiring repeated observations also increases alert latency, so the exact rules should reflect the business’s timeliness requirements.

    7. Keep Automated Coding in a Controlled Environment

    Allowing development agents to invoke coding environments can connect code generation, testing, and repair. However, those environments must remain isolated from production systems.

    Recommended controls include:

    1. Give each development task an independent working directory or isolated environment.
    2. Do not provide production databases or credentials by default.
    3. Restrict network access.
    4. Require approval for dependency installation, file deletion, and high-risk operations.
    5. Retain code diffs, execution records, and test output.
    6. Set limits on execution time, storage usage, and resource consumption.

    Text from web pages, documents, and collected content must be treated as untrusted input. Instructions embedded in that text—such as “Ignore previous requirements” or “Execute this operation”—must not be elevated to system authority.

    Code repair should follow a bounded loop:

    1. Read the task
    2. Generate or modify code
    3. Run static checks and tests
    4. Analyze failures
    5. Continue repairs within the available budget
    6. Submit artifacts and validation evidence

    If repeated repairs fail, the system should stop automatic attempts and report the failure causes, approaches already tried, and questions requiring human judgment. It should not continue in an unproductive loop.

    8. Continuous Operation Requires Reliable Scheduling and Recovery

    Scheduled Work Does Not Require a Continuously Running Model

    A scheduler should trigger price collection at defined intervals. Established parsing, storage, and rule evaluation logic can usually run as deterministic programs. Models are needed only for tasks such as handling structural changes, investigating anomalies, or analyzing requirements.

    This division reduces cost and improves reproducibility.

    Use Idempotency and Execution Leases

    Distributed execution can produce duplicate deliveries. A collection task can use the monitoring target, scheduled execution time, and task version to construct an idempotency key. Alert events also need their own deduplication identifiers.

    When a worker claims a task, it should receive a time-limited lease and renew it through heartbeats. If the worker becomes unreachable, the task can be rescheduled after the lease expires.

    External notifications generally cannot be assumed to have strict exactly-once delivery semantics. Persist delivery state, define retry policies, and assess the possibility of duplicate notifications under extreme failure conditions.

    Bound Retries

    Transient failures can use retries with progressively longer delays and random jitter. Deterministic errors—such as missing fields, invalid credentials, or conflicting requirements—should not be retried mechanically.

    Set project-level budgets, task-level attempt limits, and circuit-breaking conditions. Persistent instances of the same error should pause the affected tasks rather than cause every agent to keep making repeated calls.

    9. Testing, Observability, and Human Approval Provide Final Safeguards

    Test Both Normal and Failure Paths

    Beyond successful price collection, test:

    • Missing prices, zero prices, and invalid monetary values
    • Changes to product variants
    • Duplicate or out-of-order data
    • Notification delivery failures
    • Workers exiting during execution
    • Exports containing large numbers of records
    • Old tasks remaining in the queue after a requirements update

    Use fixed test data wherever possible to make results reproducible. For external systems, first validate internal logic with simulated data, then perform controlled integration tests.

    Use Metrics to Diagnose Problems

    Continuously monitor task success rates, wait times, retry counts, data freshness, notification latency, model usage costs, and the frequency of human intervention.

    Break these metrics down by role, task type, and data source. An aggregate success rate can hide a module that consistently fails.

    Logs should include task IDs and artifact versions while redacting secrets, personal information, and sensitive business data.

    Retain Human Approval for High-Risk Actions

    Production deployments, credential changes, large-scale data deletion, permission expansion, and execution beyond the approved budget should enter an approval workflow.

    Human approval is not a failure of automation. It is a way to manage risk by level. Low-risk work can proceed automatically; high-risk work must include the proposed changes, validation evidence, impact scope, and rollback plan.

    10. Build in Stages Rather Than Deploying a Full Agent Team at Once

    Stage 1: Implement a single-agent loop covering requirements intake, task execution, and result validation. Establish artifact storage and logging.

    Stage 2: Separate development and testing roles. Verify that task handoffs, version management, and independent acceptance checks work.

    Stage 3: Introduce parallel development and scheduling. Add conflict handling, idempotency, and failure recovery.

    Stage 4: Add scheduled tasks, budget controls, security approvals, and continuous observability. Gradually expand the scope of unattended operation.

    Validate every stage with real tasks rather than judging it solely by how smoothly a demonstration runs.

    Ultimately, a reliable multi-agent system must answer five questions:

    1. Where is the task now?
    2. What requirements and artifacts govern its execution?
    3. How is the result verified?
    4. How does the system recover from failure?
    5. Who approves the risk?

    When each question has a clear answer, multi-agent collaboration moves from appearing capable to delivering sustained value under controlled conditions.