Mixture of Agents (MoA) and Global Routing: A Practical Guide to Multi-Agent Consultation Configuration
This guide explains how to build a Mixture of Agents (MoA) system with a layered reference-and-aggregation architecture and a global routing layer. It covers why single-model assistants fail on complex tasks, how to configure read-only reference models and a single privileged aggregator, routing policies based on complexity, risk, and budget, a six-step configuration workflow, advanced techniques, and observability metrics for troubleshooting.
1. Why Single-Model Assistants Make Confident Mistakes
The most common architecture for an intelligent assistant is a single model with tool calling. It is easy to build, but on complex tasks it tends to fail in three ways:
- Fixed thinking: The model commits to the first plausible path and has no mechanism to argue against itself.
- Hallucination accumulation: Once an intermediate step contains a factual error, later reasoning treats it as a given premise and amplifies it.
- Incomplete solutions: In long-chain tasks, boundary conditions, exception branches, and rollback strategies are often ignored.
The core idea of multi-agent consultation (Mixture of Agents, or MoA) is to separate divergence from convergence: multiple perspectives generate candidate views in parallel, then a single decision maker cross-validates them and produces the final result. This mirrors how human expert panels and code reviews work, which makes it more stable and more controllable in engineering practice.
MoA is not about running several models against each other. Unordered multi-agent competition creates role conflicts, duplicate calls, and operational confusion, which reduces reliability. The form that actually works is layered collaboration with a single execution exit.
2. Layered Architecture: Reference Layer and Aggregation Layer
2.1 Reference Model Layer (The Think Tank)
The reference layer consists of 2 to 3 models with different specialties. The key constraint is that they are read-only and have no tool permissions:
- Input: the user’s original question plus a necessary context summary;
- Output: analysis approaches, risk points, missing items, and alternative options;
- Prohibited: executing commands, writing files, making network requests, or giving final conclusions.
The no-permission design is not a limitation but a safety boundary. It guarantees the divergence phase produces no side effects, making repeated attempts extremely cheap. You can safely increase sampling diversity (for example, using different temperature settings, different prompt templates, and different specialty definitions).
Suggested role differentiation:
| Role | Focus | Typical Prompt Emphasis |
|---|---|---|
| Logic reviewer | Whether premises hold and whether reasoning jumps | List implicit assumptions and counterexamples |
| Engineering implementer | Feasibility, dependencies, failure paths | Provide implementation steps and exception handling |
| Risk and compliance reviewer | Security, permissions, data boundaries | Point out sensitive operations and audit requirements |
2.2 Aggregation Model Layer (The Decision Executor)
The aggregation layer is the only core model that holds full permissions. Its responsibilities are:
- Consolidate all reference views, deduplicate, and cluster them;
- Cross-validate, flag conflicts, and provide the basis for rulings;
- Fill gaps and form a single canonical answer;
- Call tools such as the terminal, file system, and browser to carry out execution.
A single execution exit brings two direct benefits: the operation sequence is traceable and rollback points are clear, and there is no race condition where multiple agents modify the same resource at once.
Illustrative pseudocode:
def moa_run(user_input, ctx):# Phase 1: parallel divergence, no side effectsviews = parallel_map([logic_reviewer, engineer, risk_reviewer],lambda m: m.invoke(prompt_reflect(user_input, ctx), tools=None))# Phase 2: cross-validation, flag conflictsconflicts = detect_conflicts(views)dossier = merge_and_rank(views, conflicts)# Phase 3: single-point convergence and executionplan = aggregator.plan(user_input, dossier)result = aggregator.execute(plan, tools=full_toolset, audit=True)return result, dossier, conflicts
3. Global Routing: Sending Requests to the Right Layer
MoA solves “did we think of everything,” while global routing solves “should we use MoA at all.” If every request entered the consultation flow, cost and latency would be unacceptable. The routing layer typically decides along three dimensions:
- Complexity: whether the task needs multi-step reasoning or cross-module changes;
- Risk level: whether it involves deletion, permission changes, or writes to production;
- Resource budget: token and time limits.
A routing policy table that can be put into practice:
route_policy:- name: fast_pathwhen: complexity == low and risk == noneaction: single_model- name: review_pathwhen: complexity == medium or risk == mediumaction: moa(reference_count=2, aggregation=1)- name: deep_pathwhen: complexity == high or risk == highaction: moa(reference_count=3, aggregation=1, force_human_confirmation=true)
Key implementation points:
- Default to the fast path to avoid making MoA global;
- Risk takes priority over complexity; high-risk operations escalate unconditionally;
- Routing decisions must be explainable; write the matched rule to logs for later review;
- Provide a fallback switch; if the reference layer times out or is unavailable, degrade to a single model and annotate the reason for degradation.
4. Configuration Workflow (A General Six-Step Method)
- Define capability boundaries: specify which operations are strictly prohibited, and put them in system-level constraints rather than user prompts.
- Configure the reference layer: set specialties, temperature, and maximum output length, and disable tool permissions across the board.
- Configure the aggregation layer: open the required tools, and enable operation auditing and full-context reading.
- Implement routing decisions: externalize rules as configuration, with support for hot updates and canary rollout.
- Add observability: record per-phase latency, token consumption, number of conflicts, and ruling rationale.
- Build an evaluation loop: run a fixed test set for regression and track changes in hallucination rate and task completion rate.
Illustrative configuration structure:
{"reference_layer": [{"role": "logic", "tools": [], "temperature": 0.7},{"role": "engineering", "tools": [], "temperature": 0.5}],"aggregation_layer": {"tools": ["shell", "fs", "browser"], "audit": true},"router": {"default": "fast_path", "escalate_on_risk": true},"fallback": {"on_timeout": "single_model", "annotate": true}}
5. Advanced Techniques
- Treat conflict as a signal: use the number of disagreements among reference models as a complexity indicator, and automatically add a verification round when disagreement is high.
- Two-stage aggregation: have the aggregation layer first produce “review comments,” then execute only after human or rule-based confirmation, which significantly reduces misoperations.
- Context compression: pass summaries rather than full history to the reference layer, controlling cost while reducing attention dilution.
- Cache reuse: cache reference views for similar questions and only recompute the aggregation stage.
- Cost guardrails: set token and call-count limits per consultation, with automatic degradation when exceeded.
- Prompt debiasing: explicitly require in the aggregation prompt to “first list the rejected options and the reasons,” to suppress premature convergence.
6. Observability and Troubleshooting
Collect at least these metrics: routing hit rate, reference-layer timeout rate, conflict count distribution, aggregation-stage tool call success rate, end-to-end latency percentiles, and cost per task.
Common failures and how to handle them:
| Symptom | Possible Cause | Action |
|---|---|---|
| Latency rises significantly | Too many reference models or overly long outputs | Limit output length, switch to parallel calls |
| Conclusions remain unstable | Reference perspectives are too homogeneous | Change specialty settings and sampling parameters |
| Misoperations occur | Aggregation layer permissions are too broad | Narrow the tool scope, add a second confirmation |
| Cost exceeds budget | Routing is too aggressive | Tighten escalation conditions, enable caching |
7. Conclusion
The value of MoA is not “more models” but decoupling divergence from convergence and trading a single execution exit for controllability. The value of global routing is to start this mechanism only in the scenarios that need it. Combined, they systematically reduce the probability of hallucinations and incomplete solutions without sacrificing response speed. When adopting this approach, start with read-only consultation, gradually open execution permissions, and always keep configurability, observability, and degradability as design baselines. If you run on a cloud platform such as Baidu AI Cloud, you can combine general capabilities like container platforms, log services, and monitoring and alerting to complete the deployment and operations loop.
