Building a 24/7 Multi-Agent Collaborative Development System from Scratch

    A practical engineering guide to running multi-agent software development as a continuous service: how to split control from execution, share confirmed facts without mixing contexts, recover from failure, constrain tools, and accept work only when evidence shows it meets the requirements.

    1. Define the goal: continuous operation is not unlimited autonomy

    A typical multi-agent development workflow accepts a request at a single entry point, then assigns specialized agents to market research, requirements analysis, architecture, implementation, and testing, and finally delivers a usable system.

    That outcome is not achieved by creating several role prompts and letting them talk freely. The real work is a set of engineering problems:

    • Who turns a vague request into executable tasks?
    • How do roles share facts without contaminating one another’s context?
    • When one task fails, how does the system continue instead of starting over?
    • How are the code and actions an agent runs kept within bounds?
    • How do you confirm that the deliverable matches the request, rather than only producing a “done” report?
    • While the system runs continuously, how do you limit resource use and stop errors from spreading?

    The “24/7 multi-agent system” in this article is not an autonomous development team with unlimited authority. It is an engineering system that can keep accepting tasks, act only within authorization, pause when risk appears, and leave a traceable record of what it did.

    Around-the-clock describes how the service runs, not a guarantee of correctness. High-risk actions such as merging code, production releases, and access to sensitive data still need explicit approval boundaries.

    2. Use a price-monitoring product to define a concrete deliverable

    To keep the design from staying conceptual, use an e-commerce competitor price-monitoring system as the practice target.

    Its basic capabilities are:

    1. Maintain a catalog of products and competitor sources.
    2. On a schedule, collect price, reference price, promotion details, and stock status.
    3. Store history and produce price trends.
    4. Flag abnormal moves and low-price events.
    5. Send an enterprise message when rules are met.
    6. Export tabular files.

    This case is a useful test of multi-agent collaboration. It spans requirements judgment, data collection, data modeling, rule calculation, UI, and acceptance testing. Some tasks depend on others; some can run in parallel.

    Before development starts, the data boundary must be explicit. Prefer authorized data APIs, lawful data sources, or files the user supplies. Public accessibility is not permission to collect without limit. Bypassing access controls, evading rate limits, or defeating verification must not be treated as a system capability.

    If real data access has not been authorized, the first stage should validate the full path with simulated data. Agents must not be left to invent a bypass.

    3. Overall architecture: separate control logic from task execution

    Split the system into six layers:

    1. Request entry
    2. ↓
    3. Authentication and request registration
    4. ↓
    5. Task orchestrator
    6. ├─ Requirements analysis agent
    7. ├─ Research and data agent
    8. ├─ Architecture agent
    9. ├─ Development agent
    10. └─ Test agent
    11. ↓
    12. Constrained tool execution environment
    13. ↓
    14. Artifact repository, state store, and audit log
    15. ↓
    16. Acceptance, approval, and notification

    The orchestrator is the control plane. It owns state transitions, dependency checks, timeouts, and approval decisions. Agents are the execution plane. They complete specific tasks.

    That split matters. A model may suggest “retry” or “move to the next stage.” Whether to retry, whether a release is allowed, and whether a resource may be accessed must be decided by deterministic rules, not by a one-off model judgment.

    1. Request entry

    The entry point may be an enterprise messaging channel, an internal web page, or a business API, but every request should be converted into a structured record.

    At minimum, store:

    • Request ID and submitter
    • Business goal and usage scenario
    • Inputs and expected outputs
    • Acceptance criteria
    • Priority and deadline
    • Allowed tool scope
    • Budget cap
    • Whether production or sensitive data is involved

    The entry service should return an acceptance result immediately. Long-running work belongs in the background so the entry connection does not stay open.

    2. State and artifact storage

    Task state, messages, documents, and code cannot live only inside an agent conversation.

    Manage them separately:

    • State records: which stage a task is in and who is handling it
    • Artifact records: requirements, design, code changes, and test reports
    • Event records: facts such as created, claimed, completed, failed, and approved
    • Run records: model calls, tool runs, resource use, and errors

    If a process restarts, work can resume from persisted state instead of asking a model to recall what happened.

    4. Roles: every agent needs a clear delivery contract

    More roles are not automatically better. Start with the smallest team that closes the loop, then split roles where bottlenecks appear.

    1. Coordinator agent

    It clarifies the goal, splits tasks, summarizes risk, and organizes delivery. It does not hold every execution permission.

    It must answer three questions:

    • Does the current task have the conditions required to run?
    • Which work can run in parallel, and which must wait for upstream results?
    • Does the delivery already meet the acceptance criteria?

    The coordinator must not end the flow because a teammate declared “done.” It should check that artifacts exist, tests passed, and approvals are complete.

    2. Requirements analysis agent

    It turns a business description into a requirements specification.

    For the price monitor, it must make explicit:

    • Is the target the same product or a similar product?
    • Does price include shipping and discounts?
    • Does a discount require a specific membership?
    • How is stock status normalized?
    • How large a price change triggers a notification?
    • What should the page show when a source is unavailable?

    These questions decide whether the system can interpret data correctly. A “landed” or effective price usually depends on quantity, region, eligibility, and promotion terms. If those conditions are unknown, the displayed price cannot be treated as the price every user will actually pay.

    3. Architecture agent

    It owns module boundaries, the data model, interface contracts, and security boundaries.

    Its deliverables should include:

    • A system module diagram
    • Field definitions
    • Input and output contracts
    • Error classification
    • Deployment and recovery plans
    • A technical risk list
    • Test observability requirements

    An abstract architecture description is not enough. Implementation constraints must be stated: whether collection and alerting are separate, how duplicate notifications are avoided, and how historical rows stay tied to their source.

    4. Development agent

    The development role may call a constrained coding assistant, but execution stays inside an isolated working directory and environment.

    Typical allowed actions are reading task materials, editing project files, running tests, and building artifacts. Credentials, production configuration changes, and deletion of important resources require separate authorization.

    “Code was generated” is not the completion standard. The agent must submit a locatable code change, an execution record, and self-test results.

    5. Test agent

    The test role designs cases from the requirements and interface contracts. It should not simply copy the developer’s self-test notes.

    Cover at least:

    • Normal input
    • Missing fields
    • Duplicate records
    • Source timeouts
    • Abnormal prices
    • Time boundaries
    • Notification failure
    • Insufficient permission

    Keeping development and test contexts separate reduces the chance that the same wrong assumption circulates inside the team. Independence does not mean zero shared information. Both sides should share confirmed requirements, interface contracts, and artifact versions.

    5. Context management: share facts, not the entire conversation

    Long-running stability does not come only from a larger context window. Even if a model can accept a large amount of text, redundant detail, stale conclusions, and contradictory descriptions can still degrade judgment.

    A more reliable approach is layered context.

    Layer 1: current task context

    Include only what the current step needs: the goal, acceptance criteria, dependent artifacts, and the latest failure reason.

    Layer 2: project fact store

    Store confirmed long-lived facts: field definitions, business rules, technical constraints, and approved design decisions.

    Layer 3: history and audit records

    Keep the full process, but do not inject all of it into the model by default. Read it only when investigating a problem or tracing a decision.

    A simplified task context can look like this:

    1. Task ID: PRICE-DEV-07
    2. Goal: implement the price-anomaly module
    3. Input: approved rules document v3, price-record field definitions v2
    4. Output: module code, unit tests, boundary-case notes
    5. Constraint: do not modify the data-collection module
    6. Acceptance: missing values must not trigger numeric comparison; the same event must not notify twice

    The IDs and versions here are examples. They do not refer to a specific product API.

    Also separate facts from inferences. Hypotheses an agent proposes should be marked as such. They must not quietly become project facts during a summary. When a new rule replaces an old one, keep the reason for the change and the version that takes effect.

    6. Orchestration: design the state machine before role dialogue

    Multi-agent workflow should be driven by task state, not by free-form chat.

    A workable set of states is:

    1. Needs clarification → Needs planning → Ready → Running → Awaiting acceptance → Completed
    2. ├→ Waiting to retry
    3. ├→ Waiting for approval
    4. └→ Terminated

    Every transition needs entry conditions. For example:

    • Without data authorization, do not enter real collection.
    • If the upstream interface contract is not confirmed, downstream work may use only a mock interface.
    • If tests have not passed, do not mark the work as releasable.
    • Production changes must enter an approval state.

    Dependencies and parallel execution

    The price-monitoring project can be split like this:

    1. Requirements clarification
    2. ↓
    3. Data definitions and interface contracts
    4. ├─ Collection module
    5. ├─ Historical storage
    6. ├─ Alerting module
    7. └─ UI
    8. ↓
    9. Integration testing
    10. ↓
    11. Acceptance and delivery

    Parallel work assumes a stable contract. If several roles edit shared field definitions at the same time, integration cost can exceed the benefit of parallelism.

    Retry and idempotency

    Queue messages can be delivered more than once, and a worker can crash after an external action succeeds but before the result is recorded. Do not assume each task runs exactly once.

    Give tasks and external operations idempotency keys, and distinguish:

    • Retryable errors: brief connection failures, temporary resource shortages
    • Errors that need a fix: field mismatches, test failures
    • Errors that must not be retried automatically: insufficient authorization, exhausted budget, a dangerous action that was rejected

    Retries need a cap and a backoff policy. After consecutive failures hit a threshold, pause the task and submit an error summary so agents do not keep generating the same plan.

    7. Data design and rule calculation for price monitoring

    1. Do not store only a single price number

    Record product ID, source ID, observation time, displayed price, reference price, currency, promotion description, stock status, data validity, and where the source evidence lives.

    Prefer fixed-point representation or an integer in the smallest currency unit. Binary floating point can introduce money errors.

    Records of the same product from different sources are not always directly comparable. Specification, quantity, delivery region, and promotion terms belong in the comparison definition.

    2. Separate collection failure from business state

    “Stock was not collected” is not the same as “out of stock.” “The page request failed” is not the same as “the product was delisted.”

    Split collection results into two groups of fields:

    • Business fields: price, stock, promotions
    • Quality fields: success or failure, reason for missing data, data freshness, parse errors

    Alert rules may run only when the data meets validity requirements. Otherwise a network failure can be misreported as a price crash or a stock wipeout.

    3. Abnormal moves need a reasonable baseline

    A basic rule can compare the current valid price with the previous valid price:

    1. change rate = (current price − previous valid price) / previous valid price

    You still have to handle a previous value of zero, long gaps with no new records, the end of a promotion, and a change in pricing unit.

    For products whose prices move often, the median inside a rolling time window can be an auxiliary baseline. Thresholds are business configuration. Tune them with historical replay and human review. Do not claim that one percentage fits every product.

    4. Alerts must be deduplicated and noise-controlled

    Combine product, source, rule, and event state into an event ID. If the same anomaly persists, do not send a new message on every collection cycle.

    You can also set:

    • Consecutive confirmation: fire only after several valid observations
    • A cooldown window: limit how often the same class of event notifies
    • Recovery notices: update the event when the state returns to normal
    • Severity levels: distinguish ordinary change from urgent events

    Cooldowns and consecutive confirmation also delay alerts. The business owner should explicitly accept a given delay and false-alarm rate. Quieter is not automatically better.

    8. Security boundaries: treat all external content as untrusted input

    Collected pages, request attachments, and tool return values can contain inducement text. A passage that tells an agent to “ignore the original rules” or “read environment credentials” is data to analyze, not a new execution grant.

    Apply these constraints:

    1. Assign tool permissions by role. Deny unauthorized actions by default.
    2. Let the runtime manage credentials. Do not write them into prompts, logs, or delivery documents.
    3. Limit network access to an allowlist. Avoid arbitrary outbound connections.
    4. Restrict file reads and writes to the task directory so work cannot cross projects.
    5. Put resource and time limits on code execution.
    6. Require human approval for high-risk actions.
    7. Record a parameter summary, result status, and related task for each tool call.

    A model’s natural-language promise cannot replace a permission system. The real boundary is the executor, access control, and the isolation environment.

    9. Verification: judge completion by evidence, not by description

    Acceptance can be four layers.

    Layer 1: artifact completeness

    Check that requirements, design, code, test reports, and run instructions are all present and point at the same version.

    Layer 2: automated verification

    Run static checks, unit tests, interface tests, and the integration tests that are required. A pass must come from an actual execution record, not from text the model wrote.

    Layer 3: business replay

    Use fixed samples for price drops, price recovery, sustained stockouts, missing data, and duplicate events.

    Fixed samples make versions comparable. Random input on every run makes quality changes hard to judge.

    Layer 4: human acceptance

    Business reviewers check whether price definitions, notification copy, and page explanations match real usage. Engineers check security boundaries and release risk.

    For generated code, pay particular attention to permission handling, input validation, external access, and error handling. Tests passing does not mean there is no security defect.

    10. Continuous operation: design reliability, cost, and stop conditions together

    Long-running operation needs both service recovery and task recovery.

    Service recovery depends on process management, health checks, resource monitoring, and configuration management. Task recovery depends on persisted state, execution leases, heartbeats, and checkpoints.

    After a worker claims a task, it can refresh an execution lease on a schedule. When the lease expires, the orchestrator marks the task as needing recovery. It must not immediately repeat every external action. It should first inspect existing artifacts and operation records.

    Cost control should cover at least:

    • Model-call budget per task
    • Context length and call count
    • Tool runtime
    • Number of parallel tasks
    • Retry count
    • Data storage and log retention
    • Idle polling frequency

    Different stages can use model configurations of different complexity. Choose them from task performance and verification results, not from product marketing. Deterministic work such as formatting and field checks should stay with rules when rules are enough.

    Stop conditions matter just as much. When the budget is exhausted, requirements conflict, failures repeat, permission is insufficient, or an irreversible risk appears, the system should pause on its own and report what is already done, what is still unsolved, and what a person must decide.

    11. A practical rollout order

    Stage 1: close a minimal loop

    Keep only coordinator, development, and test. With simulated price data, complete “submit request → generate code → run tests → produce a report.”

    This stage validates task state and the artifact path, not the number of roles.

    Stage 2: add persistence and failure recovery

    Implement task records, event logs, worker leases, failure retry, and idempotency control. Kill processes on purpose and confirm that work can resume.

    Stage 3: connect authorized data and notifications

    Add real data sources, scheduled runs, and enterprise messaging. At the same time, check rate limits, timeouts, data quality, and alert deduplication.

    Stage 4: complete permissions and approval

    Separate development from production. Put releases, credential access, and resource changes behind an approval flow.

    Stage 5: measure and improve continuously

    Track completion rate, reasons for human intervention, failure distribution, delivery time, and resource use. Keep metric definitions stable. Do not judge the system only from successful cases.

    12. The final delivery should be a runnable, maintainable engineering asset

    A qualified multi-agent development task should deliver at least:

    • Confirmed requirements and acceptance criteria
    • Key design decisions and version history
    • Locatable code and build artifacts
    • Automated test results
    • Data sources and authorization notes
    • Configuration and deployment instructions
    • Alert rules and a failure-handling guide
    • Known limits, unfinished items, and a rollback plan

    The value of multi-agent collaboration is not how many job titles you simulate. It is breaking a complex task into clear units of responsibility and connecting them with reliable state management, controlled tool execution, and evidence-based acceptance.

    A system can keep carrying development work only when role boundaries are clear, task state can be recovered, external actions are permissioned, and results can be verified. A usable around-the-clock agent team depends on model capability and engineering discipline together, not on a prompt that claims it can “finish everything automatically.”