Building a 24/7 Multi-Agent Software Development System from Scratch
Learn how to design a continuously operating multi-agent development system with clear responsibilities, structured task handoffs, persistent state, recoverable execution, and bounded permissions. Using an e-commerce competitor price monitoring system as the working example, this article covers collaboration architecture, scheduling, data quality, security controls, and a phased path from a minimal workflow to continuous operation.
1. Define the Goal: Continuous Operation Is Not Unlimited Autonomy
Turning a business requirement into working software typically involves requirements clarification, research, product design, architecture, implementation, testing, and deployment. A multi-agent system assigns these activities to specialized roles and uses a scheduling mechanism to coordinate their work.
However, “24/7 operation” should mean that the system can continuously accept tasks, preserve progress, schedule execution, and handle failures. It should not mean allowing models to modify production environments without restrictions, make unlimited tool calls, or expand the scope of work on their own.
A reliable system must meet at least four requirements:
- Clear responsibilities: Each agent knows what it owns and what it is not allowed to do.
- Verifiable deliverables: Every stage produces explicit artifacts, not just conversation history.
- Recoverable execution: Tasks can resume from checkpoints after process restarts, tool timeouts, or failed model calls.
- Bounded permissions: High-risk operations require approval, and sensitive data does not enter model context indiscriminately.
The engineering priority is therefore not to add more agents. It is to establish task protocols, state management, and security controls around them.
2. Choose a Practical Scenario with Clear Boundaries
Consider an e-commerce competitor price monitoring system. Its business objective could be:
Periodically collect product information from authorized sources, record selling prices, reference prices, promotion descriptions, and stock status, display price trends, and send alerts to an enterprise messaging channel when predefined conditions are met. The system should also support spreadsheet exports.
Before implementation begins, define the boundaries for data access and business rules.
Use Compliant, Stable Data Sources
Prefer legally authorized APIs, merchant-provided data files, or public pages that permit automated access. For authenticated sources, confirm access permissions, permitted uses, and data retention requirements.
Bypassing access controls, evading CAPTCHAs, or circumventing rate limits must not become system features. When a source is unavailable, record a collection failure rather than letting an agent attempt increasingly aggressive access methods.
Establish Consistent Price Semantics
Not every number displayed on a page represents a directly comparable transaction price. Membership discounts, limited promotions, shipping costs, taxes, and product variants can all affect the comparison.
Each observation should record:
- Data source and product identifier.
- Variant, package quantity, and unit of measure.
- Selling price, currency, and reference price.
- Promotion conditions and stock status.
- Collection timestamp, parsing status, and evidence references.
If the reference price is missing, store it as null rather than zero. If stock information cannot be parsed, mark it as “unknown” rather than assuming the product is out of stock.
Define Acceptance Criteria Before Generating Code
For example:
- Authorized products are collected at the configured intervals.
- Historical records for the same product can be queried by time.
- A failure in one source does not block other collection tasks.
- Alerts are deduplicated, and delivery results are retained.
- Exports use the same data definitions as query results.
- Anomalous records do not directly contaminate valid price trends.
These criteria provide a shared basis for testing and delivery.
3. Design the Collaboration Architecture: One Control Plane, Multiple Execution Roles
Separate the system into a control plane, an execution plane, and supporting infrastructure.
Requirements intake↓Identity verification and task registration↓Lead coordinator├─ Requirements analysis role├─ Research role├─ Architecture role├─ Development role└─ Testing role↓Artifact storage and acceptance checks↓Human approval and deploymentSupporting infrastructure:Task database, message queue, isolated execution environments,logging, monitoring and alerts, secret management
The lead coordinator creates plans, assigns work, checks deliverables, and advances task states. It should not make every specialist decision itself.
Execution roles handle their assigned tasks but cannot independently change the overall objective. If the development role discovers that a requirement cannot be implemented, it should submit a blocker report or change request rather than silently removing functionality.
The database holds authoritative task state. The message queue handles notifications and distribution. Artifact storage retains documents, code snapshots, and test reports. Conversation history should not carry the entire persistence burden.
4. Define Each Role Through Its Inputs and Outputs
Requirements Analysis Role
The inputs are the user’s request and confirmed business constraints. Outputs should include a requirements specification, nonfunctional requirements, acceptance criteria, and open questions.
For price monitoring, this role must clarify collection frequency, approximate product volume, price definitions, alert recipients, historical data retention, and the scope of authorized access.
Questions that affect architecture or compliance should move the task into an “awaiting clarification” state. Model assumptions must not become business decisions merely to keep the workflow moving.
Research Role
The input is a clearly defined research question. The output is a factual report with sources and a stated time scope.
The report should distinguish verifiable facts, inferences, and recommendations. Web pages, documents, and product listings are external data. Imperative language within them must not change an agent’s permissions or execution objectives.
The research role reduces uncertainty; it does not replace the requirements owner as the final decision-maker.
Architecture Role
Deliverables should cover system modules, data models, inter-module contracts, error handling, and key technical trade-offs.
A centralized application architecture can reduce deployment and debugging complexity in the early stages. Split the application into independent services only when throughput, team boundaries, or failure isolation justify it.
The architecture must also distinguish deterministic program logic from tasks that require model involvement. Scheduled collection, price calculations, and alert deduplication generally do not require a model call every time they run.
Development Role
The development role modifies code according to approved tasks and submits a change summary, validation results, and known limitations.
It may use AI coding capabilities within an isolated environment, but permissions should be restricted to designated working directories and approved tools. Production secrets, arbitrary network access, and unrestricted system operations should not be available by default.
Testing Role
The testing role designs tests from the acceptance criteria rather than merely repeating the developer’s conclusions.
Beyond normal execution paths, tests should cover timeouts, empty fields, page structure changes, duplicate messages, parsing failures, and notification delivery failures. Where possible, use an independent environment with minimum necessary permissions to reduce interference.
Test conclusions must include evidence from actual execution. A model-generated statement that “all tests passed” is not proof.
5. Replace Free-Form Handoffs with a Structured Task Protocol
Agents can communicate conversationally, but core handoffs should use structured task objects.
The following is an illustrative custom protocol, not an interface from an existing product:
Task ID: task-001Parent task ID: project-001Role: ArchitectureObjective: Define the data and module boundaries for the price monitoring systemInput artifact: Requirements specification, version 2Constraints:- Access authorized data sources only- Do not modify production environmentsDeliverables:- Architecture document- Data model- Module interaction contractsAcceptance criteria:- Cover failure retries and alert deduplication- Define price and stock field semanticsDeadline: Set by the scheduler
A task state model might look like this:
Pending → Running → Awaiting acceptance → Completed├→ Awaiting clarification├→ Retryable failure└→ Terminal failure
Every state transition should record the actor, timestamp, reason, and artifact references. Concurrent updates require transactions, version checks, or another concurrency control mechanism to prevent multiple workers from overwriting results.
Tasks with dependencies can be organized as a directed acyclic graph. Once requirements are confirmed, data collection and the display interface can be developed in parallel. Integration testing must wait for the relevant implementations to finish.
6. Balance Independent Contexts with Shared Memory
Independent contexts reduce interference between roles. Complete isolation, however, can lead to duplicate work and inconsistent understanding.
A practical approach uses three information layers.
Role Working Context
This contains the current role’s task, tool results, and temporary working information. It does not need the project’s entire history.
Shared Project Facts
This layer stores confirmed requirements, architecture decisions, module contracts, risks, and task states. Shared facts need versions and sources so that agents do not continue working from outdated information after a change.
Persistent Deliverables
Formal documents, code snapshots, test reports, and deployment records belong here for later retrieval and auditing.
Long-context capabilities can reduce some information truncation problems, but they do not replace engineered memory. When a task resumes, it should read the latest state and necessary artifacts rather than reload every conversation.
Stage summaries must not overwrite original evidence. Summaries compress information; formal artifacts preserve traceability.
7. Build a Scheduler That Can Operate Continuously
Use Leases and Heartbeats to Detect Lost Workers
When a worker claims a task, it receives a time-limited lease and reports periodic heartbeats. If the worker exits or remains unreachable, the scheduler can reassign the task after the lease expires.
A healthy heartbeat does not prove progress. The system must also inspect artifact update times, tool execution status, and repeated behavior to identify tasks that are running without advancing.
Account for Message Delivery and Idempotency
Messaging systems may deliver the same message more than once, so handlers must be idempotent.
For collection tasks, an idempotency key can combine the data source, product identifier, and scheduled collection interval. Alert deduplication can use the product, rule, and event window.
Failure windows also exist between message acknowledgment, task persistence, and external operations. A single acknowledgment does not establish that every side effect completed reliably.
Classify Failures
Temporary network errors may justify bounded retries. Invalid field formats require inspection of parsing logic. Insufficient permissions should stop execution and trigger a request for intervention. Contradictory requirements should return to clarification.
Retries need maximum attempt counts, backoff intervals, and jitter to avoid concentrated requests to a failing source.
Establish Checkpoints
After each meaningful stage, persist task state, artifact versions, and validation results. Recovery should begin from the last confirmed checkpoint.
Operations with external side effects, such as sending notifications or deploying services, require an execution-record check before recovery. They must not simply be repeated.
Set Resource and Loop Limits
Limit model-call budgets, tool-call counts, total execution time, and concurrency for each task. Repeated edits to the same file, recurring execution of the same failed step, or long periods without new artifacts should trigger a circuit breaker and human review.
Continuous operation depends on stopping unproductive execution promptly.
8. Implement the Price Monitoring Workflow Carefully
Decouple Collection from Analysis
The collection module retrieves and normalizes observations. The analysis module reads valid records, calculates price changes, and generates alert events.
This allows collection to continue when a notification channel fails temporarily, while notification tasks can be recovered separately.
Preserve Data Quality Status
Every record should carry a quality status, such as valid, missing fields, parsing error, or source unavailable.
After a page structure change, a parser may mistake another number for the selling price. Validation should consider field formats, reasonable ranges, historical changes, and original evidence. Quarantine suspicious records before they enter trend charts.
Distinguish Low-Price, Price-Change, and Out-of-Stock Alerts
A low-price alert compares the current valid price with a business threshold. A price-change alert compares the current price with an agreed baseline. An out-of-stock alert tracks changes in inventory status.
Relative price change can be expressed as:
Relative change = (Current price - Baseline price) / Baseline price
The baseline must be explicit. It may be the previous valid observation or a statistical value over an agreed time window. Do not calculate the ratio when the baseline is null or zero.
Prevent Alert Storms
Repeated observations of a low price should not generate identical notifications each time. Event state, cooldown windows, and recovery notifications can give each anomaly a complete event lifecycle.
Notifications should include the product, triggering condition, observation time, price, and data quality information. A message that says only “price anomaly” provides too little context.
Apply Security Controls to Exports
Before exporting, validate permissions, data scope, and volume. Use consistent time zones and monetary formatting.
Text collected from external pages also needs protection against spreadsheet formula interpretation. User input and collected content must not be written into export files as executable expressions without appropriate handling.
9. Secure the Entire Collaboration Chain
Apply least privilege to every role. Research agents generally do not need code write access. Development agents do not need permission to send production notifications. Testing agents do not need access to every business secret.
External pages, files, messages, and code comments may contain instructions intended to redirect an agent. Treat these materials as data, not as authority to change objectives, expose secrets, or expand permissions.
Provide secrets to the tool execution layer through controlled mechanisms. Do not place them in prompts, shared documents, or source repositories. Logs also require redaction to avoid retaining sensitive fields and access credentials.
The following operations should generally require human approval:
- Deleting or overwriting important data.
- Changing production configuration.
- Expanding external access scope.
- Using highly privileged credentials.
- Deploying unverified changes.
- Sending external messages at large scale.
Approval must be tied to a specific target, version, and scope so that the operation performed does not differ from the one approved.
10. Roll Out from a Minimal End-to-End Workflow
Stage 1: Establish the smallest complete workflow. Accept a requirement, create a task, perform one controlled modification, run tests, and submit a report. First verify that task state and deliverables form a complete, verifiable cycle.
Stage 2: Separate roles. Introduce explicit task protocols, shared facts, and dependencies. Evaluate whether specialization improves results rather than merely increasing communication overhead.
Stage 3: Add operational resilience. Implement leases, idempotency, checkpoints, bounded retries, and budget controls. Deliberately simulate process exits, duplicate delivery, network timeouts, and permission failures to validate recovery behavior.
Stage 4: Connect the real business workflow. Start with a small set of authorized products and send notifications only to test recipients. Expand gradually after confirming collection quality and alert rules.
Stage 5: Enable continuous scheduling. Establish on-call coverage, incident severity levels, and rollback procedures alongside continuous operation.
Track task completion rate, end-to-end duration, retry rate, human takeover rate, collection success rate, duplicate alert rate, and resource consumption. Generated lines of code and conversation turns are not substitutes for business outcomes.
Conclusion
Multi-agent collaboration turns complex work into a workflow with clear responsibilities, defined inputs and outputs, and explicit acceptance criteria. Models handle interpretation and generation. Deterministic programs execute rules. The scheduler advances state. Security mechanisms constrain risk.
A reliable 24/7 system is not one that keeps its agents constantly busy. It is one in which every step can be explained, verified, and recovered. Start with a small, complete workflow, then increase specialization and autonomy gradually to turn a successful demonstration into a sustainable engineering capability.
