Skip to main content
Swarm Type: MultiAgentRouter

Overview

The MultiAgentRouter acts as an intelligent task dispatcher, distributing work across agents based on their capabilities and current workload. This architecture analyzes incoming tasks and automatically routes them to the most suitable agents, optimizing both efficiency and quality of outcomes. Key features:
  • Intelligent Routing: Automatically assigns tasks to best-suited agents
  • Capability Matching: Matches task requirements with agent specializations
  • Load Balancing: Distributes workload efficiently across available agents
  • Dynamic Assignment: Adapts routing based on agent performance and availability

Architecture

The router reads the task and dispatches it to the best-suited agent. Agents it does not pick, shown dashed, never run.

Use Cases

  • Customer service request routing
  • Content categorization and processing
  • Technical support ticket assignment
  • Multi-domain question answering

API Usage

Basic MultiAgentRouter 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. MultiAgentRouter runs an internal router step that inspects the task and hands it off via function calling — a task can be routed to a single specialist or split across several agents at once when the router decides more than one applies. output reflects the routing decision plus the response from each agent the router actually handed the task to; an agent in your agents array that the router does not select never runs and contributes no turn.

Best Practices

  • Design agents with clear, distinct specializations
  • Use for tasks that can be categorized and routed
  • Ensure agents have complementary capabilities
  • Ideal for customer service and support workflows