Mixture of Agents (MoA): A Practical Guide to Multi-Agent Consultation and Global Routing Configuration

    This article explains how to build a Mixture of Agents (MoA) architecture that separates divergent thinking from convergent execution. You will learn how to define the reference layer and the aggregation layer, isolate tool permissions, design global routing rules based on complexity, risk, and external information needs, and follow a six-step rollout process. It also covers merge strategies, observability metrics, cost control, and common pitfalls to avoid.

    1. Why a Single Model Can Fail Confidently

    In real-world AI application development, relying on a single model to answer directly has structural weaknesses. Because models generate content probabilistically, they can produce fluent but unreliable conclusions when information is incomplete or the question itself is ambiguous. A single model also follows a fixed reasoning path with no cross-checking from different perspectives, so once it enters a wrong branch, it struggles to self-correct. Another problem appears when one model acts as both the “thinker” and the “executor”: tool calls may begin before the reasoning has converged, causing actions and judgments to contaminate each other.

    The core idea of the multi-agent consultation pattern (Mixture of Agents, or MoA) is to split “divergent thinking” and “convergent execution” into two layers. First, multiple reference models with different specialties analyze the problem in parallel. Then, a single aggregation model with full permissions performs cross-validation, integrates the proposals, and delivers the final result. This is not simply about adding more models; it builds a stable “group discussion, single decision-maker” structure through role separation and permission isolation.

    2. Role Design: Boundaries Between the Reference Layer and the Aggregation Layer

    For the reference model layer (the think tank), 2 to 3 models are recommended, with differentiated specialties. For example, one can focus on logical reasoning and code review, one on business and domain knowledge, and one on risks and boundary conditions. The key constraint for this layer is that it receives no tool permissions. These models can only read the user’s question (and desensitized context when necessary) and output opinions, ideas, potential flaws, and alternative approaches. They do not run commands, write files, or produce the final answer. The benefits are threefold: higher diversity of thought, fewer mental fixed patterns, and lower invocation cost (lightweight models can be used).

    The aggregation model layer (the decision executor) is the only core role holding full permissions. It can read the entire conversation context and call tools such as terminal, filesystem, browser, log service, and monitoring alerts as needed. Its responsibilities are to summarize the reference layer’s opinions, identify contradictions and cross-validate them, remove speculation, fill in missing steps, output standardized conclusions, and execute them. Because only this layer has write access, operations do not conflict, and the responsibility boundary is clear and auditable.

    A schematic configuration structure (pseudocode, expressing only the layering and permission isolation):

    1. moa:
    2. reference_layer:
    3. - role: logic_reviewer
    4. tools: [] # no tool permissions
    5. temperature: 0.3
    6. - role: domain_analyst
    7. tools: []
    8. temperature: 0.5
    9. - role: risk_checker
    10. tools: []
    11. temperature: 0.2
    12. aggregation_layer:
    13. role: executor
    14. tools: [terminal, filesystem, browser, log_service, monitoring]
    15. temperature: 0.1
    16. merge_strategy: weighted_consensus # options: first_only / consensus / weighted

    3. Global Routing: Sending Requests to the Right Layer

    Global routing determines which layer a request enters, which reference models participate, and whether tool execution is required. A routing key based on three dimensions is recommended: complexity, risk, and need for external information.

    • Complexity: casual chat and single-point Q&A go to single-model direct answers; multi-step reasoning, solution design, and code refactoring go to MoA.
    • Risk: requests involving deletion, permission changes, or production configuration are forced into the aggregation layer with human confirmation enabled.
    • External information needs: when retrieval or real-time data is required, route to the aggregation layer with tool permissions.

    For implementation, maintain a rule table at the gateway layer. Rules are matched top-down, and the first match returns. If nothing matches, apply the default strategy (single-model direct answer is recommended to control cost). Example rules:

    1. if risk_level == high -> route = moa_full, require_human_approval = true
    2. else if steps_estimate > 3 -> route = moa_full
    3. else if need_external_info -> route = single_with_tools
    4. else -> route = single_plain

    Routing observability is equally important. Log the matched rule, participating models, latency distribution, and token consumption for each request to determine whether the routing table is too conservative or too aggressive. Use general log services and monitoring alerts to build dashboards, and set threshold alerts for timeout rate, tool call failure rate, and human rejection rate.

    4. Rollout Configuration in Six Steps

    1. Define task tiers: identify which business tasks are “high complexity/high risk.” These are the target scenarios for MoA. Enabling it everywhere leads to uncontrolled costs.
    2. Select the reference model combination: prioritize differentiated specialties over raw parameter size. Lightweight models often offer better value in the divergent phase.
    3. Configure aggregation model permissions: open tools only to the aggregation layer, and add secondary confirmation and operation auditing for high-risk tools.
    4. Write routing rules and run a canary: first validate rule matching on a small traffic share, then gradually increase it.
    5. Build an evaluation set: sample historical real requests, annotate expected conclusions and key points, and form a regression baseline.
    6. Launch monitoring and iterate: review failure cases weekly and adjust the reference model combination, merge strategy, and routing thresholds.

    5. Tuning Tips and Common Pitfalls

    For merge strategies, when reference layer opinions diverge significantly, use weighted consensus instead of simple voting. For scenarios with high certainty requirements, the aggregation layer can explicitly list three categories of conclusions: “verified / to be verified / rejected,” improving auditability. For context control, feed the reference layer only necessary information to avoid long contexts diluting attention, while the aggregation layer retains full context to keep decisions coherent.

    Common pitfalls include: granting tool permissions to the reference layer, causing operation conflicts; overlapping specialties among reference models, leading to homogeneous discussion; overly coarse routing rules that send all requests to MoA, raising both cost and latency; and lacking an evaluation set, leaving tuning to subjective judgment. The way to avoid them is to treat “permission isolation, specialty differentiation, minimal necessary routing, and quantifiable evaluation” as four hard constraints.

    6. Observability and Cost Control

    Three categories of metrics are recommended: quality (human pass rate, key point coverage), efficiency (end-to-end latency, time share of each layer), and cost (token consumption, number of tool calls). Cost optimization measures include: using lightweight models in the reference layer and limiting output length; routing low-risk requests to a single model; introducing result caching for repeated questions; and structurally trimming tool call results before passing them to the aggregation layer. To handle burst traffic elastically, combine container platforms and message queues for asynchronous processing and peak shaving, moving non-real-time tasks out of the main path.

    7. Summary

    The value of MoA lies not in “more” but in “clear division of labor, converged permissions, and verifiability.” The reference layer handles divergence and error finding, the aggregation layer handles convergence and execution, and global routing sends the right problem to the right layer. Working together, they can noticeably reduce hallucinations and incomplete solutions without sacrificing control, making delivery quality for complex tasks more stable. For teams building such a layered agent architecture on Baidu AI Cloud, it is recommended to start with a minimal viable rule set, drive iteration with an evaluation set, and gradually expand scenario coverage.