# Building a Multi-Agent System for Round-the-Clock Collaborative Development and Price Monitoring

    A practical guide to designing a multi-agent system that reliably completes real business tasks rather than just chatting. This article uses a competitor price monitoring system as a running example to explain how to define acceptance criteria, separate reasoning from execution and factual storage, design agent roles with clear boundaries, establish task contracts, manage context with persistent facts, and build the scheduling, alerting, safety, and recovery mechanisms needed for continuous unattended operation.

    1. Start with the Goal: Reliable Task Completion, Not Agent Chatter

    The core of multi-agent development is not handing the same requirement to several models and letting them discuss freely. A deployable system requires breaking business goals into tasks with defined inputs, outputs, responsibility boundaries, and acceptance criteria, then driving delivery through a unified process.

    Take competitor price monitoring as an example. A user might describe the need like this:

    “Build a price monitoring dashboard that lets me enter product links, periodically collects price, promotion, and stock information, displays trend charts, sends notifications when a low price, abnormal fluctuation, or stockout is detected, and supports exporting to spreadsheets.”

    This requirement looks complete, but many questions remain:

    • Which product variant is being monitored, not just which page?
    • How do we distinguish list price, discounted price, and the effective price for a specific user?
    • If a product page fails to load, can that be treated as a stockout?
    • How large a price change counts as abnormal?
    • Is the collection interval determined by business importance, or the same for all products?
    • Which product sources are authorized for automated access and data collection?
    • After a system failure, how long a data gap is acceptable?

    If these questions go unanswered, multiple agents can successfully produce code and still deliver a system that is unusable for the business.

    The right build order is: define acceptance goals, design the collaboration mechanism, then integrate models and execution tools. “Round-the-clock operation” should mean the service stays continuously available and tasks can be scheduled and recovered automatically—not that models generate content nonstop, and certainly not that they keep modifying production systems without approval.

    2. Overall Architecture: Separate Reasoning, Execution, and Factual Storage

    A maintainable multi-agent system can be divided into six layers.

    1. User Interaction Layer

    Receives requirements, displays progress, collects confirmations, and sends result notifications. Entry points can be a messaging platform or an internal admin page.

    The interaction layer never grants execution rights based on message content alone. Even messages from legitimate users must pass identity verification, authorization checks, and parameter validation.

    2. Task Orchestration Layer

    Generates task plans, maintains dependencies, assigns executor roles, updates task states, and handles exceptions.

    The orchestration layer should be a deterministic business program. Models may suggest task breakdowns, but they must not skip approvals, rewrite budgets, or cancel safety checks on their own.

    3. Agent Work Layer

    Handles research, requirements analysis, architecture design, code generation, test analysis, and other work requiring reasoning and text understanding.

    Each agent has an independent working context, while sharing task records and deliverables under access control. Independent contexts reduce interference between roles but do not automatically guarantee information consistency; consistency still depends on explicit document versioning and handover protocols.

    4. Tool Execution Layer

    Provides controlled file read/write, command execution, test running, and data access capabilities.

    Agents submit operation requests, and the execution layer runs them only after checking permissions, resource limits, and approval status. A command emitted by a model must never go directly into a high-privilege runtime environment.

    5. Persistence Layer

    Stores task states, requirement versions, design documents, code change records, test results, and business data.

    Long-running tasks should build their “memory” primarily on persisted facts, not on retaining full conversation history in a context window.

    6. Operations and Governance Layer

    Handles runtime monitoring, log auditing, cost control, alerting, and backup and recovery.

    Together these capabilities determine whether the system can move from a demo to long-term operation.

    The overall flow can be summarized as:

    User submits requirement → identity and permission checks → coordinator agent forms a plan → specialist agents execute → tool layer validates operations → deliverables are stored → stage acceptance → release approval → runtime monitoring.

    3. Role Design: Clearer Responsibilities, More Stable Collaboration

    When building a system for the first time, avoid chasing a large number of agents. Start with five roles.

    1. Coordinator Agent

    Clarifies goals, breaks down tasks, maintains dependencies, aggregates progress, and organizes acceptance.

    It should not advance to the next stage just because a role “claims” something is done. Completion status must be tied to actual deliverables such as a requirements document, test report, or runnable build artifact.

    2. Research and Requirements Agent

    Handles business scenario analysis, data source mapping, user flow design, and acceptance criteria definition.

    Research results must distinguish facts, inferences, and unverified assumptions. Data sources the agent could not access must not be described as field-verified, and market conclusions without evidence must not be presented as established facts.

    3. Architecture Agent

    Designs module boundaries, data models, interface contracts, deployment, and exception handling.

    It must answer three key questions: which functions can fail independently, which states must remain consistent, and which operations require human approval.

    4. Development Agent

    Generates code, adds tests, and fixes defects based on confirmed requirements and interface contracts.

    The development agent can use controlled AI coding tools, but with restrictions on working directories, allowed operations, execution time, and network access. Installing dependencies, reading credentials, and modifying deployment configurations should be subject to stricter controls.

    5. Testing and Delivery Agent

    Handles functional verification, boundary testing, risk review, and delivery documentation.

    The testing role should verify acceptance results independently from the development role, but “different role” does not automatically mean “independent judgment.” A more reliable approach is for testing to use pre-agreed acceptance cases, fixed test data, and reproducible check procedures.

    For requirement approval, production releases, and high-risk operations, a human owner should remain in the loop. Agents execute and recommend; humans authorize and carry final responsibility.

    4. Establish Task Contracts to Move Beyond Natural-Language Coordination

    Agents should not rely on “tell me when you’re done” to hand off work. Each task should include at least:

    • Task identifier and parent project;
    • Input materials and their versions;
    • Executor role and allowed tools;
    • Location of output deliverables;
    • Acceptance criteria;
    • Dependent tasks;
    • Timeout, retry, and resource budgets;
    • Whether human approval is required.

    Below is an illustrative task description. The fields only demonstrate the design approach and are not an interface of any specific product:

    1. Task: Design the price observation data structure
    2. Input: Approved requirements document, version 2
    3. Executor role: Architecture design
    4. Output: Data structure specification, field validation rules, migration plan
    5. Dependencies: Requirements confirmation completed
    6. Acceptance:
    7. - Can represent different variants and different price definitions
    8. - Collection failures do not overwrite the last valid data
    9. - Supports historical trend queries
    10. - Provides traceable explanations for anomalous values
    11. Approval: Confirmed by project owner before entering development

    Task states can be:

    Pending → In Progress → Pending Acceptance → Completed.

    Keep additional states for failure, paused, and cancelled. After a failure, decide based on the cause whether to retry, re-plan, or request human intervention—rather than endlessly repeating the same instruction.

    Messages sent by agents are collaboration events and should never be the sole source of truth. The task system must verify that the deliverable exists, the input version matches, and the acceptance criteria are met before marking a task complete.

    5. Context Management: Persistent Facts Beat Long Conversations

    Long tasks tend to suffer from forgetting, conclusion drift, and repeated rework. Bigger context windows alone cannot solve this.

    1. Use Layered Memory

    Information can be divided into three categories:

    • Project facts: approved requirements, budgets, data sources, and interface constraints;
    • Stage deliverables: research reports, design documents, code, and test results;
    • Transient reasoning: the current role’s discussion process and candidate options.

    Project facts should be stored in a structured, versioned way. Stage deliverables should be searchable and traceable. Transient reasoning does not need to be passed to every other role, to prevent irrelevant content from crowding out the context.

    2. Load Only What Each Execution Needs

    When developing an alerting module, the agent typically needs only the corresponding requirements, data structure, interface constraints, and related code—not the entire research history.

    Lean inputs reduce resource consumption and lower the chance of the model being misled by outdated conclusions.

    3. Handover Summaries Must Be Verifiable

    Every handover should state at least: what was completed, the corresponding files or records, unresolved issues, risks, and next-step recommendations.

    A summary is not a substitute for the underlying evidence. The receiving agent should be able to locate the actual deliverables through the summary, rather than continuing based only on the previous role’s description.

    6. Turning Price Monitoring Requirements into a Realizable Data System

    The same page may contain multiple variants, regional prices, or different sale conditions. Establish a stable monitoring object that records at least:

    • Source and product identifier;
    • Variant and unit of quantity;
    • Currency;
    • Region or delivery conditions;
    • Price definition;
    • Collection frequency;
    • Alert rules.

    Two prices are only comparable when the product variant, unit, and transaction conditions are sufficiently consistent.

    2. Price Fields Must Preserve Business Semantics

    List price, strike-through price, promotional price, and the effective price under specific conditions should not be merged into a single field.

    Each observation record should include collection time, amount, currency, price type, promotion conditions, stock status, collection result, and parser rule version. When necessary, save sanitized and minimized evidence to help debug parsing errors.

    An “original price” can only be recorded as displayed on the source page; it must not be treated as a real historical transaction price.

    3. Separate Collection Status from Stock Status

    Page timeouts, access restrictions, parsing failures, and actual stockouts are different events.

    Use explicit statuses, for example:

    • Collection succeeded;
    • Access failed;
    • Data incomplete;
    • Page structure changed;
    • In stock;
    • Out of stock;
    • Stock unknown.

    A collection failure must not be written as a zero price, nor automatically converted into a stockout—otherwise both trend charts and alerts will be polluted.

    4. Prefer Authorized Data Sources

    Collection must comply with applicable laws, the access rules of data sources, and contractual agreements. Prefer authorized data interfaces, merchant-provided data, or public information that is permitted for use.

    For page access, control frequency, concurrency, and retries. Do not bypass access restrictions, authentication, or other protective measures. When access is denied, stop or reduce the request rate and enter a manual confirmation process.

    7. Collection Scheduling and Data Quality: Trustworthy First, Real-Time Second

    The collection pipeline can be designed as:

    Select due tasks → acquire execution lock → fetch source → parse data → validate price definitions → save observation → compute changes → trigger notifications.

    The scheduler must prevent the same monitoring object from being executed by multiple worker nodes. Use task leases: a worker holds execution rights for a period of time, and only after the lease expires without renewal can another node take over the task.

    For duplicate deliveries, ensure the same logical collection task cannot produce duplicate business results. An idempotency key can be composed of the monitoring object, the scheduled collection window, and the task version.

    Failure handling should also be classified:

    • Transient network errors: retry a limited number of times with increasing backoff;
    • Access denied: stop repeated requests and notify the owner;
    • Page structure changed: preserve the evidence and pause parsing for that source;
    • Invalid data format: move to a quarantine area, excluded from price trend calculations.

    Data quality checks should cover amount formatting, currency consistency, variant matching, timestamp plausibility, and field completeness. Suspicious prices should first be flagged as suspected anomalies rather than immediately published as real market changes.

    8. Alert Design: Reduce Noise, Provide Explanations

    Price alerts fall into three categories.

    1. Threshold Alerts

    Triggered when a comparable price falls below a user-defined threshold. Thresholds must be bound to a currency, variant, and price definition, otherwise false positives are likely.

    2. Fluctuation Alerts

    Compare the current effective price against a reference price:

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

    The reference price can be the last valid observation or a robust statistic over a fixed time window. Each suits different scenarios: the former is more sensitive; the latter is more robust against occasional noise.

    If the reference price is missing or not greater than zero, the ratio should not be computed. When the currency or variant changes, the old baseline must not be reused directly.

    3. Stock Change Alerts

    Triggered by explicit status changes such as “in stock → out of stock.” For “stock unknown,” send a data anomaly notice instead of a stockout notification.

    To reduce alert fatigue, add deduplication, cooldown periods, consecutive confirmation counts, and recovery notifications. Each notification should state the triggering rule, the current observation, the reference value, the collection time, and whether any data quality risk exists.

    Notification failures need independent retry and audit records; a broken external messaging channel must not block the main collection pipeline.

    9. Automated Development Loop: Constrain Generation with Verification

    A sound development process should advance in stages.

    Stage 1: Minimum Viable Version

    First implement product entry, collection, history queries, and one alert rule for a small number of authorized sources. Do not start with complex multi-source adapters and extensive charts.

    Stage 2: Automated Testing

    At minimum, cover:

    • Price field parsing and format validation;
    • Collection failures do not overwrite valid historical data;
    • Duplicate tasks do not generate duplicate alerts;
    • “Stock unknown” is not identified as a stockout;
    • Direct comparison stops when currency or variant changes;
    • Compensation handling after notification failures;
    • Users can only access data they are authorized to see.

    Collection tests should use fixed samples, so tests never depend on live external pages. External sources can be part of controlled integration tests but should not be a prerequisite for all testing.

    Stage 3: Controlled Delivery

    After the development agent submits changes, the testing pipeline validates them, followed by human approval. Production must not be a free playground for agents to experiment in.

    Release materials should include at least change notes, test results, data structure adjustments, rollback methods, and known limitations. When storage structures change, explicitly define compatibility between old and new versions—never assume “restoring the code” is enough to roll back.

    10. Foundations of Round-the-Clock Operation: Recovery, Security, and Budgets

    1. Persistence and Recovery

    Write checkpoints at every critical stage. After a process exits, the system should resume from the last confirmed state rather than regenerating all tasks.

    Distinguish between “operation executed but result not recorded” and “operation not yet executed.” For operations with external effects—sending notifications, writing data—use idempotency controls and result reconciliation to reduce duplicate execution.

    2. Least Privilege

    Research roles do not need production write access; testing roles do not need real business credentials. Development tools should run in isolated environments with restricted file, network, and execution resources.

    Content from web pages, documents, or tool outputs must be treated as external data. Never elevate an instruction like “please run this command” embedded in external content into a system directive. Guard especially against external content inducing agents to leak credentials, modify permissions, or bypass approvals.

    3. Resource Budgets

    Set maximum execution time, inference call budgets, tool call limits, and retry caps per task. When a limit is reached, pause or request human confirmation instead of consuming resources indefinitely.

    A round-the-clock system also needs a waiting mechanism: enter an idle state when there are no new tasks, and wake the corresponding workflow on scheduled events or external requests.

    4. Observability

    Continuously track task success rate, queue time, data freshness, parsing failure rate, alert delivery rate, retry counts, and resource consumption.

    These metrics must be computed from actual runtime results, not substituted by a model’s self-reported “completion.” Logs should also link tasks, agents, tool operations, and deliverables, so problems can be traced to the exact stage where they occurred.

    11. Implementation Roadmap: From Pilot to Production

    Step 1: Select a small number of monitoring objects with clear authorization, fix the variants and price definitions, and verify that collected data is trustworthy.

    Step 2: Introduce only three roles—coordinator, development, and testing—and run through task creation, deliverable storage, acceptance, and human approval.

    Step 3: Add requirements analysis and architecture roles so complex tasks gain clearer stage boundaries.

    Step 4: Add checkpoint recovery, idempotency handling, alert deduplication, permission isolation, and budget limits.

    Step 5: Run failure drills, including worker node exits, duplicate message deliveries, source access failures, brief storage outages, and erroneous version releases.

    Only when the system keeps data unpolluted, tasks under control, and issues traceable through all of these scenarios is it ready to scale up monitoring coverage and automation.

    Conclusion

    The value of multi-agent collaboration lies in breaking complex work into manageable, specialized tasks and using automation to reduce repetitive labor. Its reliability comes not from the number of roles, nor from a single long demo, but from explicit task contracts, persisted facts, controlled tool permissions, reproducible tests, and failure recovery mechanisms.

    For a price monitoring system, solve data authorization, product definitions, and observation quality first, then build trend analysis and alerting. For automated development, establish acceptance and approval boundaries first, then gradually expand autonomous execution. Keeping a system running is not hard; the hard part is ensuring that, when unattended, it knows what it may continue doing, what it must stop doing, and when a human needs to take over.