Building a 24/7 Multi-Agent Automated Task System
This article explains how to design a production-grade, always-on multi-agent automation system, using a competitor price monitoring dashboard as a worked example. It covers requirement decomposition with acceptance criteria, a layered architecture that separates agent intelligence from deterministic orchestration, role division among coordinator, collection, parsing, validation, analysis, alerting, and reporting agents, and the mechanisms—idempotency, retries, rate limiting, circuit breaking, and task state machines—needed for reliable long-term operation. It also addresses data modeling, anomaly detection, alert de-noising, dashboards, asynchronous spreadsheet export, observability, security governance, phased rollout, and common pitfalls to avoid.
Building a 24/7 Multi-Agent Automated Task System
1. Starting from a Natural Language Task
Suppose a business user sends the following task to a “coordinator agent” on a collaboration platform:
Requirement: Build a competitor price monitoring dashboard. Support adding competitor links, periodically collect price, original price, promotions, and stock status, provide trend charts and anomaly flags, and send alerts via the enterprise collaboration platform when prices drop sharply, volatility spikes, or items go out of stock. Support spreadsheet export.
On the surface this looks like a “dashboard development task,” but it actually involves data collection, task scheduling, state management, rule-based judgment, notifications, report export, and long-term operations. A simple cron script might work initially, but as the number of links grows, page structures change, the network gets flaky, alerts multiply, or failed tasks pile up, the system quickly becomes unmaintainable. A better approach is to abstract the requirement into a “multi-agent automated task system”: a coordinator agent understands the goal and decomposes it into steps; role-based agents—collection, parsing, validation, analysis, alerting, and reporting—each execute specialized tasks; and an orchestrator centrally manages state, retries, permissions, and auditing.
This article is not about any specific product. Instead, it takes a general technical perspective on how to build a 24/7 automation system that runs long-term, is observable, and is governable.
2. Requirement Decomposition and Acceptance Criteria
Before architectural design, the natural language requirement must be converted into verifiable engineering items. Otherwise, agents may look busy while the deliverable cannot be verified.
1. Functional Requirements
- Link management: support adding, editing, and disabling competitor links, with metadata such as product ID, site, SKU, and monitoring frequency.
- Scheduled collection: configurable collection periods per link or group, capturing price, original price, promotions, stock status, and collection time.
- Data retention: store every collection snapshot, with time-range queries and trend display.
- Anomaly flagging: mark abnormal fluctuations using thresholds, sliding windows, year-over-year and period-over-period comparisons, and sudden-change detection.
- Alerting: send alerts through enterprise collaboration channels when prices drop, volatility spikes, or stock runs out.
- Dashboard: trend charts, anomaly markers, filtering, and drill-down.
- File export: asynchronously export query results to spreadsheets, with export audit records.
2. Non-Functional Requirements
- Availability: failed tasks can be retried, critical state can be recovered, and single points of failure do not break overall scheduling.
- Idempotency: repeated execution of the same link within the same collection cycle does not produce duplicate snapshots or duplicate alerts.
- Observability: logs, metrics, tracing, task auditing, and alert escalation.
- Compliance: collection frequency, access methods, and data usage comply with the target site’s terms of service and applicable laws; no bypassing of access controls.
- Cost control: support incremental collection, caching, batching, and model call budget limits.
3. Acceptance Criteria
Acceptance should not be judged by “does the page appear,” but by verifying: whether tasks run stably on schedule; whether failures recover automatically; whether alerts can be suppressed and escalated; whether exported files are permission-isolated; whether anomaly detection is explainable; and whether the system scales horizontally as the number of links grows.
3. Overall Architecture: Layered Decoupling, Not a Monolithic Script
A layered architecture is recommended, avoiding coupling collection, judgment, and notification into one flow.
Interaction layer: task input, dashboard queries, notification channels, export entryOrchestration layer: task parsing, plan generation, state machine, scheduling, approvals, retriesExecution layer: collection agent, parsing agent, validation agent, analysis agent, alerting agent, reporting agentData layer: metadata store, snapshot store, rule configs, task states, audit logsGovernance layer: permissions, secrets, rate limiting, circuit breaking, logs, metrics, tracing, cost budgets
The interaction layer receives natural language or structured tasks and outputs readable results; the orchestration layer breaks goals into steps and maintains task state; the execution layer consists of role-based agents performing concrete actions; the data layer stores snapshots, rules, and audit information; and the governance layer spans the entire pipeline to keep the system running long-term.
The key design principle: agents handle judgment and generation; the orchestrator handles deterministic control. Agents must not freely decide whether to retry, whether to send an alert, or whether to skip approval. Retry counts, timeouts, alert suppression windows, and approval nodes should be determined by the orchestrator and rule engine; agents only execute within those boundaries.
4. Multi-Agent Role Division
1. Coordinator Agent
The coordinator agent understands the task goal, constraints, and acceptance criteria, and generates an execution plan, but never directly touches data. It should output a structured plan, e.g.: create a link table, configure collection periods, generate anomaly rules, create dashboard queries, configure notification templates, and run one trial execution. Once generated, the plan enters a state machine and the orchestrator executes it step by step.
2. Collection Agent
The collection agent fetches page or API content per link, recording response status, latency, and collection time. It should not directly parse business fields or send alerts. On failure, it returns a clear error type—network timeout, access restricted, page not found, or structure changed—so downstream logic can classify handling.
3. Parsing Agent
The parsing agent extracts fields like price, original price, promotions, and stock from the collected content, and outputs a confidence score. For structure changes or missing fields, it should return “pending validation” rather than guessing. Parsing rules should be versioned for easy rollback.
4. Validation Agent
The validation agent checks field validity: is the price positive, is the original price higher than the current price, are promotions computable, is stock status within the enum range? Failed data goes to a quarantine area and does not participate in trend analysis, preventing dashboard pollution.
5. Analysis Agent
The analysis agent computes trends, year-over-year and period-over-period changes, sliding window means, and sudden-change scores, combining them with the rule engine to generate anomaly flags. It should output explainable reasons, such as “current price is 20% below the 7-day median” or “stock status changed from in-stock to out-of-stock.”
6. Alerting Agent
The alerting agent handles alert aggregation, suppression, escalation, and notification template rendering. It does not decide “is this abnormal”—it consumes analysis results and rule configurations. Repeated anomalies for the same product within a short window should be merged into one alert to avoid notification storms.
7. Reporting Agent
The reporting agent asynchronously generates spreadsheet files, covering query conditions, field mapping, paginated writes, file permissions, and expiration cleanup. Large exports should enter a queue, and on completion the download link is sent via notification channels—never blocking the request synchronously.
5. The 24/7 Operating Mechanism
Long-running systems fear “task storms” and “failure pile-ups.” Design must cover scheduling, idempotency, retries, rate limiting, and the state machine.
1. Scheduling and Triggering
The scheduler generates tasks by link group, monitoring frequency, and priority. High-frequency and low-frequency links use separate queues so they don’t interfere. Manual and scheduled triggers share one execution entry point, but manual tasks must record the operator and reason.
2. Idempotency and Deduplication
Every collection task should carry an idempotency key, e.g., “product ID + collection cycle.” Before execution, check whether a successful snapshot already exists; if so, skip or return the existing result. Alerts need idempotency keys too, e.g., “product ID + anomaly type + time window,” preventing duplicate notifications.
3. Retries and Backoff
Network failures can be retried, but parsing failures, missing fields, and access restrictions should not be retried indefinitely. Configure strategies by error type: transient errors use exponential backoff; structure changes go to manual review; permission issues trigger an alert and pause the link.
4. Rate Limiting, Circuit Breaking, and Dead Letters
Target site access should have concurrency caps and rate limits. When consecutive failures hit a threshold, circuit-break that domain or link group to contain the impact. Tasks exceeding the maximum retry count go to a dead letter queue, where an ops agent summarizes them and notifies the owner.
5. Task State Machine
Recommended task states: pending, running, awaiting validation, succeeded, failed-awaiting-retry, manual review, and canceled. State transitions must be controlled by the orchestrator, recording time, operator, and reason. Here is a pseudocode sketch:
function run_task(task):if idempotency_store.exists(task.key):return idempotency_store.get(task.key)plan = planner.plan(task.goal, task.constraints)state.save(task.id, "RUNNING")for step in plan.steps:result = dispatcher.execute(step, timeout=step.timeout)audit.append(task.id, step.name, result.status)if result.requires_approval:state.save(task.id, "WAITING_APPROVAL")notifier.send_approval(task.owner, result.summary)returnif result.is_transient_failure and step.retryable:retry_queue.push(step, backoff=exponential(step.attempt))continueif result.is_failure:dead_letter.push(task.id, step.name, result.reason)state.save(task.id, "FAILED")returnidempotency_store.set(task.key, "SUCCESS")state.save(task.id, "SUCCESS")
6. Price Monitoring Data Model and Collection Strategy
The core of price monitoring is not “grabbing a number,” but forming a comparable, traceable, explainable time series.
1. Data Model
At minimum, include four data types: link metadata, collection snapshots, anomaly flags, and alert records. Link metadata records product ID, site, group, monitoring frequency, and parsing rule version. Snapshots record price, original price, promotions, stock, collection time, and a raw summary. Anomaly flags record type, score, reason, and rule version. Alert records capture notification channel, suppression window, delivery status, and recipients.
2. Collection Strategy
Collection frequency should be tiered by business value: high frequency for key competitors, low frequency for long-tail products. Before collecting, check the most recent snapshot time to avoid redundant work. On page structure changes, retain raw summaries or versioned structured parsing results for traceability. On failure, record the error type—never write null values into the price field.
3. Compliance and Stability
Collection must respect the target site’s terms of service, rate limits, and data usage boundaries. Do not bypass access controls or verification mechanisms. Data requiring login or authorization must be handled within the authorized scope. Collectors need timeouts, retries, rate limiting, and circuit breaking to avoid stressing the target site.
7. Anomaly Detection and Alert De-Noising
1. Rule Design
Low-price rules can use “below a fixed threshold” or “below a percentage of the N-day median.” Sharp volatility can use “change rate between adjacent snapshots exceeds a threshold” or “sliding-window sudden-change score exceeds a threshold.” Out-of-stock rules can be based on stock status enum changes. Rules should be versioned with hit reasons recorded.
2. Alert Aggregation and Suppression
The same anomaly type for the same product sends only once within the suppression window; simultaneous anomalies across multiple products are aggregated by group; low-priority alerts outside business hours can be batched into delayed summaries. High-priority alerts should support escalation, e.g., if unacknowledged past a timeout, notify the next-level owner.
3. Explainability and Rollback
Every anomaly flag should include the rule ID, threshold, input data, and calculation explanation. Rule changes should support canary releases and rollback, so a single misconfiguration does not flood users with false positives.
8. Dashboard and Spreadsheet Export
Dashboard queries should be based on the snapshot and analysis result tables, supporting filtering by product, group, time range, and anomaly type. Trend charts should mark anomaly points and allow viewing the anomaly reason. Query APIs should paginate and rate-limit to keep large scans from dragging down storage.
Spreadsheet export should be asynchronous: the user submits export criteria to create a task, the reporting agent queries in pages, writes the file, uploads it to controlled storage, and records file permissions and expiration. Export results should include query conditions, generation time, and field descriptions for auditability. Sensitive fields should be masked according to permissions.
9. Observability and Security Governance
The system needs four observability capabilities: logs, metrics, tracing, and auditing. Logs record task state transitions and error reasons; metrics track task success rate, average latency, retry counts, dead letter volume, alert volume, and export backlog; tracing links one task from trigger to notification end to end; auditing records who modified links, rules, notification configs, or exported data, and when.
On the security side, secrets should be centrally managed with least-privilege grants; notification channels and exported files require access control; when agents call large language models, sensitive information in inputs should be limited, with call budgets and timeouts in place. For cloud deployment, you can use general-purpose infrastructure such as container platforms, message queues, object storage, log services, and monitoring/alerting from providers like Baidu AI Cloud as the foundation for stateless execution, asynchronous decoupling, and persistent orchestration.
10. Rollout Steps and Common Pitfalls
Recommended phased rollout: Phase 1—link management, single-link collection, snapshot storage, and a basic dashboard. Phase 2—queue-based scheduling, idempotent retries, and failure isolation. Phase 3—anomaly rules, alert aggregation, and spreadsheet export. Phase 4—permissions, auditing, cost budgets, and capacity/load testing.
Common pitfalls include: treating agents as fully autonomous systems, making them uncontrollable; ignoring idempotency, causing duplicate alerts and snapshots; overly aggressive collection frequency triggering access restrictions; arbitrary anomaly thresholds causing floods of false positives; synchronous exports dragging down APIs; missing dead letter queues leaving failed tasks unhandled; and executing model-generated plans without validation, running steps that don’t exist or exceed permissions.
In summary, the key to a 24/7 multi-agent automated task system is not “letting agents run free”—it is constraining agents with deterministic orchestration, managing tasks with a state machine, keeping alerts explainable with a rule engine, and ensuring long-term operability through observability and auditing. Only by converting natural language requirements into verifiable engineering loops can a system truly run stably and deliver continuously.
