Mixture of Agents (MoA) Example
TheMixtureOfAgents (MoA) architecture processes tasks by feeding them to multiple “expert” agents in parallel. Their diverse outputs are then synthesized by an aggregator agent to produce a final, high-quality result. This pattern achieves state-of-the-art performance by leveraging the collective expertise of multiple specialized agents.
How Mixture of Agents Works
The MoA pattern follows a two-phase approach:- Parallel Expert Phase: Multiple specialized agents process the task independently and simultaneously
- Aggregation Phase: A dedicated aggregator agent synthesizes all expert outputs into a coherent final result
Key Characteristics
- Expert Diversity: Each agent brings unique perspective and expertise
- Parallel Processing: All experts work simultaneously for efficiency
- Intelligent Synthesis: Aggregator combines insights rather than simple concatenation
- Enhanced Quality: Multiple perspectives lead to more comprehensive results
Basic Example: Investment Analysis
This example demonstrates how to combine financial, market, and risk analysis:How This Example Works
- Task Distribution: The question “Should we invest in NVIDIA stock right now?” is sent to all three expert agents simultaneously
- Expert Analysis: Each agent analyzes from their domain:
- Financial Analyst examines financial metrics, earnings, valuation
- Market Analyst reviews market trends, sector performance, momentum
- Risk Analyst assesses volatility, market risks, downside scenarios
- Collection: All three expert analyses are gathered
- Synthesis: The Investment Advisor aggregator receives all analyses and synthesizes them into a unified recommendation
- Final Output: A comprehensive recommendation that considers all perspectives
The MoA Pattern
The Mixture of Agents pattern is particularly powerful because:Diverse Expertise
Each agent can be specialized in a specific domain, providing depth that a single generalist agent cannot match.Parallel Efficiency
All experts work simultaneously, maintaining the speed of concurrent processing while adding intelligent synthesis.Quality Enhancement
The aggregator can:- Identify consensus among experts
- Highlight disagreements and explain trade-offs
- Weigh different perspectives based on relevance
- Produce more nuanced and comprehensive outputs
Scalability
Easy to add new expert agents without redesigning the entire system.Real-World Examples
Content Creation Team
Combine writing experts with an editor aggregator:Medical Diagnosis System
Combine specialist doctors with a general practitioner:Product Strategy Team
Combine different business perspectives:Research Paper Review
Combine academic reviewers with a meta-reviewer:Using with SwarmRouter
You can also use MoA through the SwarmRouter for flexible orchestration:Best Practices
1. Specialized Experts
Ensure each expert agent has a clearly defined specialty:2. Comprehensive Aggregator
The aggregator should understand how to synthesize diverse inputs:3. Optimal Number of Experts
- Too few (1-2): Loses the benefit of diverse perspectives
- Optimal (3-5): Provides diversity without overwhelming the aggregator
- Too many (7+): Can create noise and make synthesis difficult
4. Complementary Perspectives
Choose experts that provide different but complementary viewpoints:Advantages of MoA
- Higher Quality: Multiple perspectives lead to more comprehensive outputs
- Reduced Bias: Different viewpoints help identify and mitigate individual biases
- Better Coverage: Experts ensure all aspects of complex problems are addressed
- Flexible Scaling: Easy to add or remove experts without major restructuring
- State-of-the-Art Results: Research shows MoA achieves superior performance
When to Use MoA
Mixture of Agents is ideal for:- Complex Decision Making: Requires multiple perspectives (investment, hiring, strategy)
- Multi-Disciplinary Tasks: Needs expertise from different domains (product development, research)
- Quality-Critical Output: When accuracy and comprehensiveness matter more than speed
- Expert Synthesis: When combining specialized knowledge adds value
When NOT to Use MoA
- Simple Tasks: Overhead not justified for straightforward problems
- Speed Critical: The aggregation step adds latency
- Limited Resources: Running multiple agents + aggregator is resource-intensive
- Sequential Dependencies: When steps must happen in order (use SequentialWorkflow)
Related Architectures
- ConcurrentWorkflow: Similar parallel execution without aggregation
- HierarchicalSwarm: Director coordinates workers with feedback loops
- SwarmRouter: Switch between MoA and other patterns