7x24 Multi-Agent Development with Open-Source LLMs: A Practical Tutorial
This article explains how to build a 7x24 multi-agent development system using open-source LLMs. It covers role-based agent design, long-task state management, a four-layer system architecture, an e-commerce competitor price monitoring case, scheduling and observability practices, model selection criteria, and common pitfalls. Readers can use these practical patterns to build a stable, locally deployable multi-agent workflow from research to development and testing.
1. Why a Multi-Agent Collaboration System Is Needed
Traditional single-agent chat is essentially an “all-in-one assistant.” As task scale grows, for example from requirements research all the way to delivery, a single context expands rapidly. The model may forget earlier constraints, confuse task stages, or even make conflicting decisions across different steps.
The multi-agent architecture decomposes complex tasks into role-based responsibilities:
- Orchestrator: receives user requirements, breaks down tasks, dispatches them to specialized agents, and aggregates results;
- Research Agent: handles market research and competitor information organization;
- Product Agent: outputs PRDs and requirements documents;
- Architecture Agent: performs technology selection and system design;
- Development Agent: executes coding implementation;
- Testing Agent: writes and runs test cases and outputs quality reports.
Each agent has an independent context and communicates with others through messages. This design brings three direct benefits:
- Context isolation: each role’s context contains only the information it needs, avoiding long-context degradation;
- Single responsibility: role prompts can be highly specialized, making model output more stable;
- Parallelism and extensibility: research and design can proceed in parallel, and new roles do not affect existing chains.
2. Core Challenge: Stability in Long Tasks
Multi-agent systems place much higher demands on models than single-turn Q&A. There are three core tests:
- Long-task stability: after dozens of message round trips, can the model still strictly follow the original task constraints?
- Very long context memory: after the context grows, are key decisions still traceable and not forgotten?
- Cross-round task-chain continuity: can upstream outputs such as the PRD and architecture plan be accurately referenced in downstream development and testing, rather than being “reinvented”?
Practical experience shows that instead of relying on the model to “remember everything,” it is better to explicitly manage task state in engineering. Common approaches include:
{"task_id": "price-monitor-001","stage": "development","artifacts": {"prd": "docs/prd.md","architecture": "docs/architecture.md","code": "src/"},"constraints": ["Collect price data every 30 minutes","Abnormal fluctuations must trigger a notification on a messaging platform"]}
Persist artifacts such as the PRD and architecture design as files, and inject relevant summaries each time an agent is woken up, rather than letting all historical messages accumulate without limit. This is the key to keeping long chains from collapsing.
3. System Architecture Design
A deployable 7x24 system is best divided into four layers:
- Entry layer: users submit requirements to the orchestrator through instant messaging tools, such as Feishu/Lark or similar enterprise messaging platforms. The entry layer only performs identity verification and message forwarding; it does not carry business logic.
- Orchestration layer: the orchestrator maintains a task state machine (pending research → researching → designing → developing → testing → delivery) and handles dispatch, timeout retries, and result collection.
- Execution layer: specialized agents receive tasks through a message queue and produce documents or code. The development agent can autonomously invoke a local AI coding tool, making its own decisions about coding and refactoring actions to enable unattended coding around the clock.
- Infrastructure layer: scheduling (cron jobs/workflow engine), object storage for artifacts, and logging and monitoring/alerting to observe agent behavior and task health.
An illustrative task flow is as follows:
User (messaging platform)│ "Build a competitor price monitoring system"▼Orchestrator ──► Research Agent ──► Research report│ ││ ▼├──► Product Agent ──► PRD│ ││ ▼├──► Architecture Agent ──► Technical plan│ ││ ▼├──► Development Agent (autonomously invokes local coding tool)│ ││ ▼└──► Testing Agent ──► Test report│▼Orchestrator aggregates → Delivery
4. Case Study: E-commerce Competitor Price Monitoring System
The following is a real, working case that illustrates the outputs of each role.
Requirement: periodically collect competitor product prices, original prices, discount information, and inventory status; provide trend charts and abnormal fluctuation markers; send alerts through a messaging platform such as Feishu/Lark or similar when prices are low, fluctuate sharply, or are out of stock; support Excel export.
Research Agent output: target categories, data fields to monitor, recommended collection frequency, and compliance notes (follow the target site’s robots protocol and access rate limits).
Product Agent output: a PRD whose key features include:
- Data collection: price, original price, coupons, and inventory status;
- Data storage: a time-series price record table;
- Analysis: trend charts, period-over-period/year-over-year fluctuations, and anomaly detection thresholds;
- Alerts: three rule types for low prices, sharp fluctuations, and out-of-stock items;
- Export: Excel reports.
Architecture Agent output: a technical plan: data collection module → message queue/buffer → time-series database or relational database → analysis service → notification service → export service. Scheduled tasks are centrally scheduled, and alert rules are centrally configured.
Development Agent: autonomously invokes a local AI coding tool to complete coding. To give it decision-making ability, it needs clear tool-call boundaries: it can read and write repository files and run tests, but it must not access external sensitive configurations. A typical agent tool definition is as follows:
@tooldef write_code(path: str, content: str) -> str:"""Write code to the specified file and return the write result."""@tooldef run_tests(test_path: str) -> str:"""Run the specified test directory and return a summary of the results."""@tooldef read_artifact(name: str) -> str:"""Read the content of an upstream artifact (PRD/architecture document)."""
Testing Agent verifies: collection task idempotency, correct anomaly fluctuation detection, no duplicate alert messages, and complete Excel export data.
The resulting system can run unattended overnight and complete development and iteration automatically.
5. Runtime and Scheduling Practices
To achieve stable 7x24 operation, note the following:
- Process supervision: deploy the orchestration service on a container platform with health checks and automatic restarts;
- Task idempotency: record the state of each collection and notification to avoid duplicate execution after a restart;
- Failure recovery: when an agent execution fails, write it to a retry queue with the failure reason, avoiding starting from scratch;
- Observability: log every agent invocation (input summary, output summary, duration, token consumption) for later auditing and optimization;
- Cost control: for long tasks, summarize and compress historical messages, and set a per-task invocation limit for each agent.
A simple scheduling configuration example:
schedule:- name: price-collectcron: "*/30 * * * *"action: collecton_failure: retrymax_retries: 3- name: price-anomaly-checkcron: "5,35 * * * *"action: analyzedepends_on: price-collect- name: daily-reportcron: "0 9 * * *"action: export_excel
6. Model Selection Recommendations
This type of system has three main requirements for model capability: code generation quality, long-context consistency, and reliability of multi-turn tool calls. During selection, test the following metrics rather than looking only at single-turn benchmark scores:
- Whether the model still follows initial constraints after dozens of message rounds;
- Whether instruction forgetting occurs with mixed input of large files and multiple documents;
- Whether tool-call parameters remain correctly formatted after multiple rounds;
- Whether a failed retry can continue from existing artifacts rather than redoing the work.
Recently, open-source models have made significant progress in code and agent-cluster capabilities. It is advisable to prioritize open-source models that can be deployed locally and support long context and function calling, for private deployment and cost control.
7. Common Pitfalls and Mitigations
- Context pollution: outputs from different agents are mixed into the same conversation history, causing role confusion. Mitigation: strictly isolate contexts; the orchestrator passes only task summaries and artifact references.
- Hallucinated interfaces: the development agent may call methods that do not exist. Mitigation: inject the real interface list/type definitions into the prompt and enforce test verification.
- Infinite loops: agents wait on each other. Mitigation: the orchestrator sets stage timeouts and maximum rounds.
- Notification storms: the same anomaly triggers repeated alerts. Mitigation: alert deduplication and quiet windows.
- Artifact inconsistency: the PRD and code diverge. Mitigation: the testing agent uses the PRD as the acceptance basis and returns a discrepancy report.
8. Conclusion
Multi-agent collaboration is not simply chaining multiple chat models together. It is a complete engineering system that includes role division, state management, tool boundaries, scheduling, and observability. By removing humans from the pipeline, letting the orchestrator dispatch and each role execute autonomously, and using locally deployable open-source LLMs, you can build a development workforce that truly operates 7x24. It is recommended to start with a small closed loop (research → development → testing), validate task-chain stability, and then gradually expand roles and automation.
