Always-On Multi-Agent Collaboration Systems: Architecture and Engineering Practices
This article presents an engineering framework for building always-on multi-agent collaboration systems. It covers layered architecture, deliverable-based roles, structured messaging, state machines, controlled coding, a price-monitoring case study, alert design, phased rollout, and operational safeguards, with a focus on bounded autonomy and verifiable execution.
1. Clarify the Goal: Always-On Does Not Mean Unlimited Autonomy
The value of a multi-agent system is not that multiple models answer the same question at the same time. Rather, it is the ability to break a complex task into work units with clear responsibilities and verifiable inputs and outputs, then coordinate those units through an orchestration mechanism.
Consider an e-commerce competitor price monitoring scenario. A business user submits a request through an enterprise messaging channel. The system then needs to complete requirement clarification, data source assessment, product design, technical design, coding, testing, and deployment preparation. After launch, business services must also periodically collect product prices, discount information, and inventory status, generate trend analysis, and send alerts when rules are met.
Two operating modes should be distinguished:
- Project delivery mode: Multiple agents collaborate on a phase-based development task and stop once acceptance criteria are met.
- Business operation mode: Schedulers, collection services, analysis services, and notification services continuously process periodic tasks.
An always-on system depends first on stable engineering infrastructure, not on having a large model continuously generate content. Agents are suitable for requirement understanding, solution selection, and exception analysis. Repetitive execution, precise calculation, and state persistence should be handled by deterministic programs wherever possible.
At the same time, autonomy must have boundaries. The system can automatically perform low-risk, reversible operations. However, production releases, data deletion, expansion of collection scope, and changes to sensitive permissions should go through a human approval process.
2. Build a Layered Architecture That Decouples Models from Execution Permissions
A practical solution can be divided into six layers:
Requirement entry↓Identity verification and requirement registration↓Task orchestrator ←→ Agent execution units↓ ↓Task state and message store Controlled tool execution layer↓ ↓Deliverable repository and audit records↓Acceptance, approval, and release
2.1 Requirement Entry
The entry point can be an enterprise messaging channel or an internal business page. It receives requirements, identifies the submitter, generates a task ID, and returns acceptance status.
The entry layer should not simply forward a message directly to the model. It also needs to check the message source, user permissions, attachment types, and request frequency to prevent unauthorized users from triggering code execution or reading business data.
If the requirement information is insufficient, the system should clarify it first. For example, “monitor competitor prices” still lacks product scope, collection frequency, price definition, notification recipients, and acceptance criteria.
2.2 Task Orchestration Layer
The orchestrator manages task dependencies and lifecycle, including:
- Which tasks can run in parallel;
- Which tasks must wait for upstream deliverables;
- Whether retries are allowed after failure;
- When human confirmation is required;
- What conditions must be met before a task can be declared complete.
The model can suggest a decomposition plan, but the final task state should be written to persistent storage and advanced by the orchestrator according to rules. Chat history cannot be treated as the only task database.
2.3 Agent Execution Layer
Each agent has its own task context, role constraints, and tool permissions. The underlying model can be the same, but input materials, work objectives, and executable operations should differ.
Independent contexts can reduce role confusion, but they do not make the system inherently secure. Permission isolation must be enforced by the runtime environment and tool execution layer, not only by prompts.
2.4 Tool Execution Layer
The tool layer handles operations such as file reads and writes, code changes, test execution, data queries, and notification delivery. The model proposes a call request, and the execution layer checks permissions, parameters, and resource limits before deciding whether to execute it.
The key principle is: the model makes recommendations, controlled programs perform execution, and the audit system records events.
3. Define Roles by Deliverables, Not by Stacking Agent Names
The more agents there are, the higher the coordination cost usually becomes. Start with a small number of roles with clear responsibilities, then add execution units based on bottlenecks.
3.1 Requirement Coordination Agent
This role converts business expressions into a clear requirement specification, covering scope, constraints, priorities, and acceptance criteria.
For a price monitoring project, it should specify:
- Whether the monitored object is a product, a specific variant, or a sales item in a store;
- Whether the price is the displayed page price, the price after direct discounts, or a price available only when conditions are met;
- Where inventory status comes from and how to handle cases where it cannot be determined;
- Whether alerts should be sent in real time or summarized within a time window;
- Which features are in the first-phase scope and which are deferred.
The deliverable of the requirement coordination agent should be a reviewable requirements document, not a vague discussion summary.
3.2 Data Research Agent
This role evaluates data sources, access permissions, field stability, and collection feasibility.
The focus is not merely “can the page be scraped,” but whether data that matches the business definition can be obtained lawfully and stably over time. Authorized data APIs, data files, or other permitted channels should be preferred.
If public pages must be parsed, the agent needs to evaluate access rules, rate limits, page changes, and data usage boundaries. It must not bypass authentication, access restrictions, or other security measures.
3.3 Product and Architecture Agents
The product role outputs page flows, field definitions, alert rules, and exception display methods. The architecture role outputs module boundaries, data models, task dependencies, permission design, and deployment plans.
The two roles need to form explicit agreements. For example, if the page displays a “final price,” the data layer must explain the calculation basis. If discount eligibility conditions are missing, the product layer should not present an estimate as a confirmed price.
3.4 Development Agent
The development role executes coding tasks based on confirmed designs and may invoke intelligent coding tools deployed in a controlled environment.
It should receive a limited working directory, short-lived credentials, and clear modification objectives. By default, it must not access production secrets, modify other projects, or expand its own permissions.
3.5 Test and Acceptance Agent
The test role independently generates checks based on requirements, reviews development deliverables, and runs deterministic tests.
Independent review helps find omissions, but models may also share similar biases. Therefore, “another agent agreed” cannot replace objective verification. Critical functionality still needs to be confirmed through test data, execution results, and manual spot checks.
4. Collaborate Through Structured Messages to Avoid Context Contamination
Agents should exchange task summaries and deliverable references rather than broadcasting all conversations indiscriminately.
An internal task message should contain at least the following:
Task ID: price-monitor-001Sender role: Requirement coordinationReceiver role: Architecture designGoal: Design the product price collection and alerting pipelineInput: Confirmed requirements document and data source assessment resultsOutput: Module design, data structures, risk listCompletion criteria: Pass design review and cover all first-phase requirementsConstraints: Do not introduce unauthorized data sources
The above is an illustrative message structure, not an interface from a specific product.
Deliverables should be stored in a unified repository, and messages should reference their version and location. This reduces redundant transmission and prevents downstream roles from reading outdated designs.
Context should be divided into three parts:
- Role rules: Responsibilities, permissions, and prohibited actions.
- Task materials: Only the requirements, designs, and data needed for the current work.
- Traceable memory: Confirmed conclusions, reasons for changes, and deliverable references.
Long-term memory should not accumulate indefinitely. Outdated information should be archived, and unverified conclusions should be marked with their source and confidence level. In particular, operational instructions found on web pages must not be treated as system commands. External content can only be analyzed as data and must not change agent permissions or execution rules.
5. Control the Development Process with State Machines and Dependency Graphs
Use clear task states:
Pending → Running → Pending check → Completed↓ ↓Retry Needs correction↓FailedTasks requiring human decision → Pending approval
State transitions must be triggered by explicit conditions. For example, a development task should not enter the completed state merely because the model says it is “done.” The system also needs to check whether files were generated, tests passed, and deliverables are complete.
Task dependencies can be represented as:
Requirement confirmation → Data source assessment → Technical design → Backend development↓ ↓Page design → Frontend development↓Integration testing↓Manual acceptance↓Release approval
Backend and frontend development can proceed in parallel once the interface contract is stable. Integration testing must wait until the necessary modules are ready.
Message delivery and task execution must also handle duplication. A queue may deliver the same message more than once, and an execution process may be interrupted after completing an operation but before writing the state. Therefore, tasks should have idempotency identifiers, and actions such as notification sending and data writes need deduplication mechanisms to avoid business side effects caused by repeated execution.
6. Controlled Coding: Make Automated Development Stoppable, Resumable, and Reversible
The most common problem in automated coding is mistaking “code was generated” for “delivery was completed.”
A reliable development loop should include:
- Read the task and constraints;
- Generate a modification plan;
- Modify code in an isolated workspace;
- Run static checks and automated tests;
- Summarize changes, test results, and unresolved issues;
- Enter review rather than publishing directly.
The tool execution layer should also enforce limits on time, memory, storage, and network access. Operations such as deleting large numbers of files, executing high-risk commands, or modifying permissions should be blocked or require approval.
Task budgets can be controlled along four dimensions: maximum execution time, maximum retry count, model invocation budget, and maximum modification scope. The values should be determined by project complexity and risk; there is no universal configuration suitable for every team.
If successive fixes make no progress, the system should stop and submit a failure report. The report should at least describe reproduction steps, error output, attempted solutions, and issues requiring human judgment, rather than continuing in an infinite loop.
7. Price Monitoring Case Study: Standardize Data Definitions Before Implementing Alerts
7.1 Product Identity Must Be Stable
The same product may have different variants, package quantities, and sales channels. Comparing directly by name can easily confuse different products.
Maintain an internal product identifier and associate it with source identifiers, specifications, units of measure, and matching evidence. Products that cannot be reliably matched should enter a manual confirmation queue rather than being forced into trend analysis.
7.2 Store Raw Observations and Normalized Results
Each collection should record:
- Product identifier and source;
- Collection time;
- Displayed price and currency;
- Strike-through price or reference price;
- Discount description and eligibility conditions;
- Inventory status;
- Collection result status;
- Reference to raw evidence;
- Parsing rule version.
Raw observation records help review parsing errors. Normalized results are used for comparison and statistics. The two should not replace each other.
The “original price” should also not be assumed by default to be a previously transacted price. If it is only a page reference price, the field name and page description should reflect that fact.
7.3 Price Calculations Must Preserve Conditions
For discounts that can be determined directly, the price under the corresponding conditions can be calculated. When membership eligibility, bundle purchases, coupon claims, or regional differences are involved, the conditions should be preserved rather than unconditionally merged into a single number.
For example:
Page price: 120Direct discount: 10Additional discount: Requires specified purchase conditionsDeterminable price: 110Conditional discount price: Display separately; do not include in default comparison
This example only illustrates how definitions can be handled and does not represent any specific business rule.
Monetary calculations should use a representation that supports exact decimals to avoid binary floating-point errors. Data in different currencies, with different specifications, or in different units of measure cannot be compared directly.
7.4 Inventory and Collection Failures Must Be Distinguished
Inventory can be divided into states such as “in stock,” “out of stock,” and “unknown.” Page parsing failures, network timeouts, or access restrictions should be recorded as collection exceptions and must not be automatically interpreted as out-of-stock.
Similarly, a collection failure must not be written as a zero price. Missing values should retain their cause, and trend charts should show data gaps rather than creating false price drops.
8. Alert Design: Explainable, Deduplicated, and Recoverable
Price alerts can include three common types of rules:
- Threshold alert: The effective price falls below a business-defined threshold.
- Volatility alert: A significant change occurs relative to a comparable baseline.
- Inventory alert: Status changes from in stock to out of stock, or recovers from out of stock to in stock.
The relative change rate can be calculated as follows:
change rate = (current effective price - baseline effective price) / baseline effective price
The baseline price must be valid and greater than zero. For new products, sparse data, or changes in price definitions, regular judgments should be paused or special rules should be applied.
To reduce false alerts, combine consecutive observations, data quality checks, and manual sampling verification. An abnormally low price may be a real promotion or a parsing error; the system should be able to explain the source of evidence.
Notifications should include the product, time, triggering rule, before-and-after values, applicable conditions, and data source. The sending process should also include:
- A deduplication identifier for the same event;
- A cooldown window for repeated reminders;
- An aggregation mechanism for high-frequency events;
- Limited retries after send failures;
- Recovery notifications after service restoration.
Detecting an event and successfully delivering a notification are two different things and should be recorded separately.
9. Roll Out Gradually from a Minimal Closed Loop
Implement the system in four stages rather than letting it take over the entire process at once.
Stage 1: Validate Single-Role Delivery
First, have one agent generate a design or code based on fixed requirements, and have a human review it. Focus on whether task inputs are sufficient, tools are controllable, and deliverables are reviewable.
Stage 2: Validate Role Collaboration
Add requirement, development, and test roles, connect task state storage, and establish structured messages and deliverable versioning. Human advancement of critical milestones should still be retained.
Stage 3: Launch a Small-Scale Business Closed Loop
Select a small number of authorized data sources and complete collection, storage, display, and alerting. Validate correctness first, then gradually expand product count and collection frequency.
Stage 4: Establish Continuous Operation Safeguards
Add scheduling, retries, monitoring, auditing, and recovery mechanisms. Expand the scope of automated execution only after permission boundaries, failure handling, and cost control are clear.
Acceptance should cover both normal and abnormal scenarios, including duplicate messages, task interruptions, data format changes, notification failures, insufficient permissions, and manual cancellation. Also verify that tool processes are actually terminated after cancellation, avoiding a situation where a task appears stopped but continues running in the background.
10. The Core of Always-On Operation Is Operations, Not Prompts
A continuously running system should monitor at least the following metrics:
- Task backlog and waiting time;
- Task success rate and retry distribution;
- Model invocation consumption and remaining budget;
- Data collection success rate and completeness;
- Alert trigger volume and delivery status;
- Test failures;
- Tool timeouts and permission denials.
Logs should correlate task IDs, execution stages, and deliverable versions, but must avoid recording secrets, full credentials, or unnecessary personal information.
For failure recovery, regularly back up task state and business data, verify that backups can be restored, and set checkpoints for important processes. After a service restart, the system should identify in-progress tasks and decide whether to retry them or hand them over to a human, rather than repeating all operations from the beginning.
Cost control should also be engineered: use programs for fixed rules, reuse validated results for common questions, and invoke models only when semantic understanding and complex judgment are needed. The orchestrator can remain on standby without keeping all agents active at all times.
Conclusion: Put Autonomy Inside Verifiable Engineering Boundaries
Multi-agent collaboration can organize requirement understanding, design, development, and testing into a more continuous workflow, but it does not automatically eliminate data risks, implementation defects, or operational issues.
A genuinely usable always-on system needs clear responsibilities, traceable messages, recoverable state, restricted permissions, and acceptable results. For price monitoring scenarios, it must also maintain lawful collection, unified price definitions, retained data evidence, and a clear distinction between business anomalies and collection failures.
Starting from a small, verifiable closed loop and gradually expanding automation permissions is usually more reliable than pursuing fully unattended operation directly. The maturity of the system should be measured not by the number of agents, but by whether it can stop promptly when something goes wrong, explain accurately what happened, and allow humans to take over.
