Building a Multi-Agent R&D System That Can Run Around the Clock
A single chat model can write a block of code, but it rarely carries a long software delivery from problem definition to a running system. This article explains how to split work into agents with clear duties, isolated context, and message-based collaboration so tasks stay recoverable overnight, and how to wire roles, a minimal protocol, checkpoints, and quality gates around a price-and-inventory monitoring example.
Long-cycle software delivery is more than one conversation. A single model can write a stretch of code, yet it rarely carries the full path from problem definition to a running system. Irrelevant detail crowds the context, roles bounce between research and coding, and unattended overnight work has no recoverable state—so the task forgets or drifts. Splitting the work into agents with clear duties, isolated context, and message-based collaboration is an engineering method for turning “able to chat” into “able to keep delivering,” not another larger prompt.
Why a single agent cannot hold a long task
A complete delivery usually includes market and competitor notes, scope and acceptance criteria, architecture trade-offs, implementation, tests, release notes, and alerting policy. Inputs and outputs differ: facts and hypotheses, executable specs, code and test evidence. If all of that sits in one session, early research is overwritten by later patches, and failed retries amplify wrong conclusions.
Around-the-clock operation adds three requirements. First, critical constraints must survive a very long context—field meanings, alert thresholds, and forbidden actions. Second, the task chain across turns must be traceable so an interrupted step can resume from a checkpoint instead of being re-asked from scratch. Third, stability beats a single impressive reply: the model may occasionally write wrong code, but the orchestration layer must detect, isolate, and roll back.
The value of multiple agents is not livelier role-play. It is splitting state, permissions, and failure domains.
Roles and boundaries
Split by delivery stage, not job titles. Each agent should have only the tools and materials needed for that stage.
- Intake: accept a natural-language goal, fill in constraints (time zone, data freshness, compliance bounds, deliverable format), and emit a structured task ticket. It does not change code.
- Research: gather public information and existing internal documents, label source, time, and confidence, and list unknowns. Unverified numbers must not be written as facts.
- Spec: collapse research into a problem statement, user scenarios, acceptance criteria, and non-functional requirements (latency, retention, alert channels).
- Architecture: choose data flow, storage, and scheduling; write interface contracts and failure policy. Output design and interfaces only; do not replace implementation.
- Implementation: code against the contract in an isolated working copy, commit in small steps, and attach how to run and roll back.
- Verification: design cases from acceptance criteria, covering functional correctness, edges, and regression. On failure, return reproducible evidence only; do not expand scope.
- Orchestration and on-call: maintain the task state machine, decide who runs next, and handle timeouts, retries, and human escalation.
Agents do not share full context. They exchange agreed messages. Research noise does not pollute implementation, and temporary implementation logs do not rewrite frozen acceptance criteria.
Messages and state: a minimal collaboration protocol
Do not forward entire chat logs. Short messages with fixed fields are enough:
- Task id and parent task id, to stitch overnight round trips.
- Stage and version, for example spec v3, implementation against spec v3.
- Input summary and invariants that must be kept.
- Artifact locations (doc sections, code paths, test reports), not full artifacts in every message.
- Status: pending, in progress, blocked, awaiting human confirmation, done, failed.
- Block reason and suggested next owner.
The orchestrator follows state transitions, not a feeling that a role “has more to say.” A typical happy path is: task ticket → research notes → frozen spec → architecture review record → implementation diff notes → verification report → delivery checklist. If a step fails, roll back to the last frozen version rather than overwriting history.
Illustrative structure only—field meaning, not a platform API:
message:id: task-1042stage: verifybased_on: spec-v3status: blockedartifact: reports/price-monitor/run-17invariant:- alert only on agreed thresholds- do not invent missing pricesnext: implementation
Run the chain on a business system
Take product price and inventory monitoring as an example. The goal can be: collect price, list price, promotions, and stock on a schedule; provide trends and anomaly flags; notify owners on low price, sharp moves, or stockouts; support table export. The example is complete without locking agents to one industry jargon.
Freeze the data model in the spec stage before writing collectors. Each observation should include at least: object id, collection time, price, original price, promotion text, stock status, source, and whether collection succeeded. Trend charts need evenly spaced or alignable series. Anomalies need explainable rules, such as deviation from a rolling median, consecutive gaps, or stock going from available to none. Alerts must carry a rule id and the raw observation, not only “large swing.”
Architecture can use common, replaceable component types: a scheduler to trigger collection; object storage for raw responses and exports; structured storage for observations and rule hits; a message queue for “collection done,” “verification failed,” and “needs human confirmation”; logs and metrics for success rate, latency, and alert volume. Do not hard-code a vendor’s proprietary calls in the design. Collection failures should retry and mark gaps; never interpolate fake prices.
The implementation agent delivers incrementally against the contract: collection adapters, rule computation, export, notification templates. The verification agent asserts on fixed sample data: a normal series does not alert; an injected stockout must alert; missing fields are recorded as failure, not silently dropped; export columns match the spec. The orchestrator must not mark the system on-call until verification passes.
Engineering so long tasks do not forget
A larger model context window is not a substitute for external memory. Put what must not be lost in the orchestrator and artifacts:
- Freeze spec and architecture decisions; changes require a version bump.
- Inject only the current stage’s summary into the prompt, plus artifact pointers.
- Persist the task chain as a state machine; after process restart, resume from the last successful checkpoint.
- Require sources for critical numbers; without a source, mark as unverified and keep them out of acceptance criteria.
- Set turn and time budgets. On timeout, degrade to “report the current block,” not endless self-Q&A.
If a coding agent may call a local programming environment, minimize permissions: limit the working directory, forbid changing orchestration config and secrets, and require the verification agent before commit. All-day code generation is not unattended ownership. Overnight automation should stop at candidate changes that passed tests; merge and external release can still require a human gate.
Quality, cost, and risk
Multiple agents increase call volume. Cut waste by skipping useless turns: no coding until the spec is frozen; on verification failure, return only failing cases and related diffs; cap research sources. Observe stage duration, rework count, context truncations, and false-alert rate—not how many words were generated.
Risks belong in the runbook. Agents may invent interfaces, loosen acceptance, or leak internal paths in alert copy. Mitigations include tool allowlists, keeping secrets out of prompts, validating output shape, and dual confirmation for high-impact actions (send notifications, write production data, merge to main). For price data, respect collection frequency and source terms of use. Record collection time and failures; do not package incomplete data as a complete market conclusion.
From pilot to on-call
Do not staff every role on day one. First close four stages: intake, spec, implementation, verification, using read-only sample data for the monitoring system in an isolated environment. After that is stable, add research and architecture review, and attach scheduling, queues, and logs to ordinary cloud capabilities: containers or a job platform for workers, a message queue for stage events, object storage for reports, monitoring for failure rate. If you use a general cloud such as Baidu AI Cloud, treat it only as the environment that runs those standard capabilities; keep the orchestration protocol decoupled from any one product.
On-call, the orchestrator wakes on a schedule, not when someone chats. Daily outputs: whether new observations are complete, whether rules drifted, whether candidate changes passed regression, and whether anything is blocked for humans. People move from restating requirements from scratch to handling exceptions and approving frozen versions.
The core of an around-the-clock multi-agent R&D system is independent context to protect professional judgment, messages and versions to protect the task chain, and gates plus evidence to protect delivery quality. Roles can grow or shrink with the team. Protocol and checkpoints should not be rewritten whenever the model changes. Run one narrow, complete, recoverable path first, then scale the fleet.
