Skip to main content
Swarm Type: MixtureOfAgents

Overview

The MixtureOfAgents swarm type brings together multiple specialized agents to work collaboratively on the same task. This architecture leverages the collective intelligence and diverse perspectives of multiple agents, combining their expertise to produce more comprehensive and nuanced solutions than any single agent could achieve alone. Key features:
  • Collaborative Analysis: Multiple agents work together on the same task
  • Diverse Perspectives: Different viewpoints and expertise areas
  • Comprehensive Solutions: Combined insights from multiple specialists
  • Enhanced Quality: Better results through collective intelligence

Architecture

Every specialist sees the same task, and their perspectives are combined into one answer.

Use Cases

  • Complex problem analysis requiring multiple viewpoints
  • Content creation with multiple expert perspectives
  • Research projects needing interdisciplinary approaches
  • Decision-making with diverse stakeholder input

API Usage

Basic MixtureOfAgents Example

Example Response:

Output Shape

Every swarm run is executed through a SwarmRouter with output_type forced to "dict" server-side (see api/swarm_completions.py), so output is a list of {"role": ..., "content": ...} conversation turns rather than a single string. MixtureOfAgents runs the requested agents in parallel as specialists, then an internal aggregator agent synthesizes their outputs into a consolidated answer. A full run’s output therefore typically contains one turn per specialist plus a final aggregator/synthesis turn (the abbreviated example above shows only the specialist turns); number_of_agents in the response still reflects only the specialists you supplied in agents, since the aggregator is not part of that roster.

Best Practices

  • Design agents with complementary but distinct expertise areas
  • Use for complex tasks requiring multiple perspectives
  • Ensure agents can work collaboratively on the same problem
  • Ideal for comprehensive analysis and decision-making