Multi-Agent Systems in Production: A Guide to 24/7 Automated Software Delivery
This article explains how to build a multi-agent system for end-to-end software delivery that runs around the clock. It covers why a single general-purpose agent struggles with long delivery pipelines, a four-layer architecture built around an orchestrator, specialist roles, and a message bus, and how to define each role as a service with an explicit input/output contract and least-privilege tool access. It then details a three-tier memory model for context isolation, a typed event protocol for traceable and replayable communication, and engineering controls such as staged submissions, checkpoints, and idempotent retries that keep long-running tasks stable. Finally, it discusses guardrails for coding agents, observability and human handover, and a four-phase adoption roadmap. The core takeaway is that reliability comes from clear responsibilities, clean context, and isolated failures rather than the number of roles.
1. Why a Single Agent Cannot Handle Long Delivery Pipelines
In real software delivery, a request typically moves through market research, product design, architecture design, implementation, testing, and acceptance before it ships. The common approach is to let one general-purpose chat model carry out all of this sequentially, but that approach has three structural weaknesses.
First, context pollution. Web snippets, competitor data, and user feedback collected during research end up in the same context as the API definitions, data structures, and test cases from the implementation phase. The model’s attention is diluted, and the further the work progresses, the more likely it is to forget early constraints.
Second, blurred responsibility boundaries. The same session has to perform divergent market analysis and convergent engineering implementation. These two kinds of work have opposite requirements for prompt style, output format, and reasoning mode, so they interfere with each other.
Third, failures cannot be isolated. A mistake at any step contaminates the whole pipeline. You cannot tell which stage went wrong, and you cannot re-run just one segment.
The core value of a multi-agent architecture is to separate these three concerns: split roles by responsibility, isolate context by role, and connect the flow with a message protocol, so that each stage can be observed, retried, and reimplemented independently.
2. Overall Architecture: Orchestrator, Specialists, and a Message Bus
A working agent team usually has four layers.
Ingress layer: receives requests from sources such as chat groups, email, forms, or the command line. The key job is to normalize unstructured input into a unified task object.
Orchestration layer: the single scheduler, responsible for task decomposition, dispatch, progress aggregation, and conflict resolution. The orchestrator does no work itself; it only coordinates.
Specialist layer: roles such as market, product, architecture, development, and testing. Each role runs in its own process or session, with its own context and its own toolset.
Infrastructure layer: message queue, object storage, logging, monitoring and alerting, and the container platform. This layer determines whether the system can run stably 24/7.
A task object should use a structure like the following to stay serializable, persistable, and replayable:
{"task_id": "req-20260806-001","parent_id": null,"role": "orchestrator","goal": "Build a competitor price monitoring dashboard","constraints": ["scheduled collection", "anomaly alerts", "table export"],"artifacts": [],"status": "pending","retry": 0,"deadline": "2026-08-07T09:00:00Z"}
3. Role Design: Treat the Prompt as an Interface Contract
Each specialist role should be treated as a service with a clear input/output contract, not as a free-form prompt. A contract has four elements: input schema, output schema, available tools, and prohibited actions.
For the market research role, the contract can be written as:
Input: goal, constraintsOutput: report (market size, competitor matrix, price range, risk list)Tools: search, web scraping, table writingProhibited: modifying the code repository, replying directly to end users
The development role is different. It needs access to the code repository and must run builds and tests, so it requires broader tool permissions, but the writable directories and the allowlist of executable commands must be restricted. An example permission declaration:
role: developerworkspace: /srv/agent/ws/devallow_commands: [build, test, lint, git-commit]deny_paths: ["/etc", "/root", "prod-config"]max_turns: 200
The key design principle here is “least privilege plus explicit prohibitions.” Most incidents in multi-agent systems are not caused by a model that is not smart enough, but by a role with excessive permissions that deletes files or sends messages by mistake.
4. Context Isolation and Shared Memory
Isolation does not mean silos. The practical approach is a three-tier memory structure.
Short-term memory: the role’s own session context, holding only the information needed for the current subtask and reclaimed when the task ends.
Mid-term memory: a task-level shared area that stores an index of delivered artifacts, such as the path of a research report or the version number of an API draft. It stores pointers only, not full text, to avoid context bloat.
Long-term memory: a vector store or structured database that accumulates past solutions, lessons learned, and review conclusions for later retrieval and reuse.
def build_context(role, task, shared_index, memory_store):ctx = [SYSTEM_PROMPT[role], task.goal]for art in task.artifacts:doc = shared_index.get(art.id) # fetch summary and pointer onlyctx.append(f"Dependency artifact: {doc.summary} -> {doc.uri}")hits = memory_store.search(task.goal, top_k=3)ctx.extend([h.text for h in hits])return ctx
This “summary + pointer + fetch on demand” pattern is the key to keeping very long contexts stable. Stuffing everything into short-term memory will inevitably cause amnesia after a few dozen turns.
5. Message Protocol: Make Communication Traceable and Replayable
Communication between roles should not rely on implicit natural-language calls. It should use typed events.
event: artifact.submittedfrom: market_directorto: orchestratorpayload: {artifact_id, uri, summary, confidence}event: task.rejectedfrom: orchestratorto: product_directorpayload: {reason, missing_fields}
Once events are written to a message queue, they are persisted, which brings three benefits. First, replayability: it is immediately clear which event the pipeline broke at. Second, observability: with logging and monitoring in place, you can measure each role’s average latency, rework rate, and failure rate. Third, decoupling: replacing one role’s implementation does not affect the others.
6. Long-Running Task Stability: Staged Submissions and Checkpoints
Surviving dozens of turns without breaking does not depend on the model’s memory; it depends on engineering constraints.
Staged submissions: each role must produce a verifiable intermediate artifact and is not allowed to output the final version in one shot.
Checkpoints: after each stage is completed, write the task status, artifact hashes, and the current branch to persistent storage.
Idempotent retries: on a re-run, verify artifact hashes first and skip anything that already exists, avoiding duplicated work and duplicated messages.
def run_stage(task, role, store):ckpt = store.load_checkpoint(task.id, role)if ckpt and ckpt.hash == task.hash:return ckpt.artifactart = role.execute(task)store.save_checkpoint(task.id, role, art)bus.emit("artifact.submitted", from_=role.name, payload=art.meta)return art
7. Connecting Coding Tools in the Development Stage
The coding phase can be handed to a locally running intelligent coding tool, which decides for itself when to read files, change code, and run tests. In engineering terms, three additional guardrails are needed: a dedicated work branch, build and test gates, and a change review summary. Only changes that pass tests and have a complete review summary are allowed to merge, so that unusable code is not pushed to the main branch while the system runs unattended.
8. Observability and Human Handover
A 24/7 system must assume that exceptions will happen. At a minimum, cover four categories of alerts: task timeouts, consecutive role failures, failed artifact validation, and abnormal resource usage. Route all alerts to a chat group, with the task identifier and the most recent event attached so a person can assess the situation quickly.
Also keep a human handover switch: when the orchestrator detects a high-risk operation (such as a production configuration change or a bulk deletion), it pauses and requests confirmation. This is a necessary safety valve for an unattended system.
9. Adoption Roadmap
Phase one: run a single-role closed loop first, and verify that the four paths — ingress, execution, delivery, and alerting — work end to end. Phase two: expand into a three-role pipeline (research, implementation, testing), focusing on the message protocol and checkpoints. Phase three: introduce parallel roles and conflict resolution strategies to form a complete team. Phase four: add cost accounting, quality metrics, and knowledge accumulation, and move into steady-state operation.
The gains from multi-agent systems do not come from the number of roles, but from clear responsibilities, clean context, and isolated failures. Get those three things right, and 24/7 unattended delivery becomes an expected outcome rather than a lucky demo.
