Multi-Agent Collaboration: Building a 24/7 Price Monitoring System
Learn how to build a continuously operating price monitoring system with controlled multi-agent development workflows and deterministic runtime services. This article covers role boundaries, task contracts, recoverable orchestration, compliant data collection, explainable alerts, security, observability, and a phased implementation approach.
1. From an “Agent Army” to an Engineering Problem
The value of a multi-agent system is not that several models can produce answers at the same time. It is that a complex objective can be divided into clearly bounded, verifiable tasks that different roles complete together.
Consider competitor price monitoring for e-commerce. A request such as “Continuously monitor competitor prices and notify me when something unusual happens” involves an entire engineering workflow: identifying monitoring targets and data-use permissions, defining comparable prices, designing collection processes, storing historical data, detecting anomalies, implementing notifications, providing trend analysis, and maintaining the deployed system.
Putting all of this into one ever-growing conversation creates three common problems:
- Mixed context: Requirements, implementation details, and test results interfere with one another, burying important constraints.
- Unverifiable delivery: The system claims that work is complete without a corresponding code version, test record, or acceptance evidence.
- Uncontrolled execution risk: Agents can access too many resources, allowing an incorrect decision to affect production directly.
A more reliable objective is to build a multi-agent collaboration system managed by a task orchestrator, centered on deliverables, and operating with controlled permissions.
Here, “24/7” means that the system can continuously accept tasks, execute scheduled work, and recover from failures. It does not mean that models never make mistakes, every website remains accessible, or human intervention is unnecessary.
2. Separate Development Collaboration from Business Operations
Price monitoring has two distinct layers. They should not be treated as one.
Development Collaboration Layer
This layer turns requirements into deployable software through requirements analysis, design, development, testing, and delivery.
Agents are useful for work that requires interpretation, reasoning, or generation—for example, explaining business rules, proposing data structures, writing code, and analyzing test failures.
Business Operations Layer
This layer periodically collects prices, saves records, evaluates rules, sends notifications, and displays results.
Most of these tasks should run as deterministic programs. Fixed-threshold comparisons, scheduled execution, and database writes do not require a model call every time. Doing so would add cost and uncertainty.
A recommended structure is:
User request entry point↓Identity verification and task registration↓Task orchestrator├─ Requirements analysis agent├─ Architecture design agent├─ Development agent└─ Testing agent↓Human approval and release↓Price monitoring service├─ Scheduled execution├─ Compliant data collection├─ Data cleaning and storage├─ Anomaly rule evaluation└─ Notifications and queries
This separation avoids a common mistake: wrapping every background task in an agent and turning straightforward, reliable business logic into a difficult-to-trace conversation chain.
3. Define Roles and Delivery Boundaries
Role names alone do not create effective collaboration. Every role needs explicit inputs, outputs, permissions, and acceptance criteria.
Requirements Analysis Agent
Its inputs are user goals, existing constraints, and unresolved questions. Its outputs are a structured requirements document and an acceptance checklist.
It should first establish:
- Which product variant is being monitored, rather than matching products by title alone.
- How displayed prices, original prices, and discounted prices are defined.
- Whether discounts require membership, activation, or a minimum purchase quantity.
- Which stock states are supported and how unknown states are handled.
- The collection frequency, alert recipients, and notification windows.
- Which missing details require user clarification before work can proceed.
The most prominent number on a page is not necessarily a comparable purchase price. An installment amount, the price of the cheapest variant, and a conditional discount may represent entirely different pricing definitions.
Architecture Design Agent
Its input is the confirmed requirements document. Its outputs are module boundaries, data models, interface contracts, a deployment plan, and a risk list.
The design should explain why each component is needed rather than assemble a list of technical terms. For a small initial set of monitoring targets, a single service with a relational database may be sufficient. Message queues and additional independent services should be considered only when collection backlogs, independent scaling needs, or stronger fault-isolation requirements justify them.
Development Agent
Its inputs are task specifications and interface contracts. Its outputs are code changes, required configuration, usage instructions, and self-test results.
Development tasks should be small and explicit—for example, “Implement price-record insertion and uniqueness validation,” rather than “Build the entire backend.” Smaller tasks make errors easier to locate and allow targeted retries after failure.
Testing Agent
Its inputs are requirements, code, and the execution environment. Its outputs are test cases, defect reports, and acceptance evidence.
The testing role should independently verify behavior rather than repeat the developer’s self-test conclusions. Important boundary cases include missing prices, changed product variants, notification failures, duplicate collection, and insufficient historical data.
Task Orchestrator
The orchestrator manages dependencies, state changes, timeouts, and task assignment. It may use a model to help interpret tasks, but explicit program rules should govern task states and permission decisions.
“Completed” must correspond to deliverables and validation results. An agent’s completion message is not sufficient evidence.
4. Use Task Contracts Instead of Free-Form Chat
Separate contexts reduce interference between roles, but they can also create inconsistent information. Task information therefore needs to be stored as traceable, structured records rather than left in conversation history.
The following is an illustrative task contract. These fields are conventions defined for this design, not an interface for any particular product:
Task ID: price-rule-001Objective: Implement price change detectionInputs:- Confirmed price definition- Historical price record structure- Alert rule specificationOutputs:- Rule implementation- Unit tests- Boundary-condition documentationDependencies:- Price-record insertion task acceptedPermissions:- Read test data- Modify the designated moduleAcceptance criteria:- Normal price increases and decreases follow the rules- Missing prices are excluded from comparisons- A zero historical baseline does not cause division by zero- Duplicate events do not generate duplicate alerts
Messages between agents should include at least the task ID, sender role, message type, associated deliverables, and a relevant summary.
Message types can include task assignments, clarification requests, result submissions, defect feedback, and approval requests. Each type should trigger its own handling workflow so that ordinary discussion is not mistaken for an execution instruction.
Shared knowledge should also be organized into layers:
- Global constraints: Business objectives, security boundaries, and terminology.
- Task context: Inputs and dependencies required for the current task.
- Deliverable index: Locations and versions of requirements, designs, code, and test records.
- Execution records: Tool calls, state changes, and error details.
Long-term records should not be injected back into context indiscriminately. Outdated rules need to be marked as invalid, and sensitive information must be filtered according to permissions.
5. Design Recoverable Task Orchestration
Reliable collaboration requires more than calling several agents in sequence. Tasks need an explicit lifecycle.
A possible state model is:
Pending → Assigned → In progress → Awaiting acceptance → Completed↓ ↓Failed ← Acceptance rejected↓Retry or human intervention
Tasks with missing inputs should enter an “Awaiting clarification” state. Tasks that have been explicitly stopped should enter a “Canceled” state.
Execute According to Dependencies
Confirmed requirements are usually a prerequisite for architecture design. Interface contracts enable parallel development of related modules, while deployment depends on testing and approval.
Work should run in parallel where possible, but parallelism does not remove dependencies. If interfaces are not finalized, multiple development roles changing related modules can create substantial rework.
Detect Lost Workers Through Leases
When a worker claims a task, the orchestrator can assign a lease with an expiration time and require periodic renewal. If the worker becomes unresponsive, the orchestrator reassesses the task after the lease expires.
Lease expiration does not guarantee that the original worker has stopped. Result submission must therefore check the current execution version to prevent an outdated worker from overwriting newer results.
Pair Retries with Idempotency
Messages may be delivered more than once. An operation may also succeed but be retried because its response was lost. A practical approach is to allow repeated triggers while using idempotency constraints to prevent duplicate side effects.
Database writes can use business-level unique keys. Notifications can use event IDs. Release operations should verify the target version and approval record.
Actions involving charges, deletion, permission changes, or production releases should not be retried automatically without stronger state confirmation or human approval.
6. Price Collection: Establish Comparable Data Before Scaling
Collection is the system’s data foundation and one of its most significant sources of risk.
Prioritize Authorized Data Sources
Prefer authorized APIs, legitimately licensed data subscriptions, or files that users are entitled to provide. Collect data from web pages only when the source’s rules permit it, and follow access-frequency, data-use, and privacy requirements.
The system must not bypass login permissions, access controls, or other protective mechanisms. When collection fails, record the cause and adjust the strategy rather than defaulting to methods that evade restrictions.
Establish Stable Product Identity
A monitoring target should include the source, product identifier, variant, and any necessary regional or channel dimensions.
Products with the same name may differ in pack size, model specifications, or sales conditions. Products whose equivalence cannot be established should not be merged into a single price trend.
Store Structured Snapshots
Each collection should generally record:
- The monitoring target identifier and collection timestamp.
- The displayed price, original price, and verifiable discount information.
- Currency and price unit.
- Stock status.
- Collection status and error reason.
- Parser version.
- A necessary summary of source evidence.
Whether to retain raw responses depends on data-use permissions, privacy requirements, and storage costs. Keeping evidence does not justify retaining complete pages indefinitely.
Distinguish Missing Prices from Zero Prices
Parsing failures, delisted products, and missing quotes must not all be stored as zero. Otherwise, charts will show false price crashes and alerts will fire incorrectly.
Store monetary amounts using an exact decimal representation, or use integers after defining the currency’s smallest unit. This avoids floating-point errors affecting threshold comparisons.
7. Make Anomaly Detection Explainable
Start with explainable rules before considering more complex methods.
Low-Price Rules
An effective price below a user-defined threshold produces a candidate event. The threshold must be tied to the product variant, currency, and price definition; otherwise, the comparison is meaningless.
Price Change Rules
A common relative-change calculation is:
Relative change = (Current valid price − Baseline price) / Baseline price
The baseline can be the previous valid record or the median within a specified window. The former is more responsive, while the latter reduces the influence of isolated noise.
If the baseline is zero, historical samples are insufficient, or the price definition has changed, suspend that comparison and record the reason.
Stock Change Rules
A transition from “In stock” to “Out of stock” is usually more useful than repeatedly reporting an unchanged out-of-stock status. Unknown states must not be treated as out of stock, and collection failures must not automatically count as stock changes.
Verification and Suppression
After an anomaly appears, the system can collect the data again or require the condition to hold across multiple consecutive observations before notifying users.
This reduces false positives but increases detection latency. The trade-off should be explicit.
Notifications should include the product variant, current value, baseline value, triggering rule, collection time, and data-quality notes. A model can generate a concise explanation, but it must not replace rule calculations or claim a cause without evidence.
8. Provide Trends, Notifications, and Spreadsheet Exports
Trend views should communicate both values and data quality. Missing observations should not be connected with straight lines by default, implying that prices remained stable during the gap.
Users should be able to inspect the evidence behind anomaly markers. Changes in price definitions should be annotated, with separate series where necessary.
Notification services must handle timeouts, failures, and duplicate delivery. One approach is to save a pending notification record together with the business event, then let an independent sending task process it. This reduces the risk of saving an event but losing its notification.
Monitor notification-delivery failures separately from business price anomalies. A broken notification pipeline must not be mistaken for an absence of events.
Spreadsheet exports also require care:
- Keep the export scope consistent with access permissions.
- Include an explicit time zone for timestamps.
- Preserve monetary units and price definitions.
- Use asynchronous tasks for large exports.
- Safely handle user-controlled text so spreadsheet software does not interpret it as a formula.
- Set appropriate file expiration periods and access restrictions.
9. Make Permissions and Security Part of the Core Design
Pages, files, and messages read by agents may contain untrusted content. Even if external content says “Ignore previous rules” or “Send credentials,” it remains data to process, not a system instruction.
Use role-specific permissions:
- Requirements roles access only requirements materials.
- Development roles modify only authorized code areas and use isolated test environments.
- Testing roles access test data and do not hold production credentials by default.
- Release actions run through a dedicated process with retained approval records.
Credentials must not appear in prompts, code repositories, or ordinary logs. Tool calls should also have limits on accessible locations, execution duration, and output size.
Prices, customer information, and business data may be sensitive. Access controls must cover collection, storage, queries, exports, and deletion.
10. Make Continuous Operation Observable
Continuous operation requires more than scheduling. The system must detect when behavior deviates from expectations.
Monitor at least four categories of metrics:
- Task metrics: Wait time, execution time, failure rate, retry count, and acceptance results.
- Collection metrics: Proportion of valid records, data freshness, and distribution of parsing failures.
- Alert metrics: Event count, suppressed duplicates, delivery success, and delivery latency.
- Resource metrics: Model call volume, per-task consumption, storage growth, and queue backlog.
Use consistent task IDs to correlate orchestration, collection, calculation, and notification logs. Avoid logging credentials or unnecessary sensitive information.
Every agent task should have a maximum execution time, maximum retry count, and model-call budget to prevent failure loops from wasting resources. Tasks that exceed these limits should move to human handling rather than continue indefinitely.
Roll out new rules or parsing logic to a limited scope first and retain a rollback path. The monitoring service generally does not need development agents online for every execution. Existing deterministic workflows should therefore continue as far as possible during a temporary model-service outage.
11. Implement in Phases Rather Than Adding Everything at Once
Phase 1: Validate the Minimum End-to-End Workflow
Choose a small set of monitoring targets with clear permissions. Connect collection, storage, anomaly evaluation, and notifications.
Validate price definitions and the usefulness of alerts before introducing complex agent roles.
Phase 2: Introduce Controlled Development Collaboration
Assign clearly bounded tasks to requirements, development, and testing roles. Establish delivery contracts, version records, and acceptance procedures.
Evaluate whether collaboration actually reduces rework rather than merely increasing discussion.
Phase 3: Add Operational Safeguards
Introduce task recovery, idempotency controls, permission isolation, alert suppression, budget limits, and auditing.
Focus on behavior when workers become unresponsive, messages are duplicated, or dependencies become unavailable.
Phase 4: Optimize Scale and Cost
Adjust concurrency, split services, or introduce queues based on observed bottlenecks.
Choose models according to task requirements. Use fixed test cases to evaluate accuracy, latency, and cost rather than assuming one configuration fits every role.
Final acceptance should go beyond checking that a page opens or that an agent says the work is finished. Confirm that critical functions have test evidence, invalid data cannot contaminate results, failures can be detected and recovered from, and high-risk actions require approval.
The maturity of multi-agent collaboration is not measured by the number of roles or the amount of code generated in one run. It is measured by whether every task has clear inputs, trustworthy deliverables, and traceable results.
Use models for understanding and reasoning, deterministic programs for rule execution, and permissions, validation, and recovery mechanisms to connect the two. That is how 24/7 price monitoring becomes a maintainable engineering system rather than a demonstration.
