Skip to main content
Explore all available swarm architectures supported by the Swarms API. The /v1/swarms/available endpoint provides information about different swarm types, their capabilities, and use cases.
Different swarm types are optimized for different workflows - choose the right architecture for your specific needs.

Quick Start

  • Python
  • JavaScript
  • cURL
import requests
import json
import os
from dotenv import load_dotenv

load_dotenv()

API_KEY = os.getenv("SWARMS_API_KEY")
BASE_URL = "https://swarms-api-285321057562.us-east1.run.app"

headers = {
    "x-api-key": API_KEY,
    "Content-Type": "application/json"
}

def get_swarm_types():
    """Get all available swarm types"""
    response = requests.get(
        f"{BASE_URL}/v1/swarms/available",
        headers=headers
    )

    if response.status_code == 200:
        return response.json()
    else:
        print(f"Error: {response.status_code} - {response.text}")
        return None

# Get swarm types
swarm_data = get_swarm_types()
if swarm_data:
    print("✅ Swarm types retrieved successfully!")
    print(json.dumps(swarm_data, indent=2))

Swarm Type Selection Guide

For Different Use Cases

  • Complex Problem Solving
  • Step-by-Step Processes
  • Parallel Processing
  • Dynamic Optimization
# Use MixtureOfAgents for diverse expertise
swarm_config = {
    "name": "Research Swarm",
    "description": "Multi-disciplinary research team",
    "agents": [
        {
            "agent_name": "Data Analyst",
            "model_name": "gpt-4o",
            "role": "analyst"
        },
        {
            "agent_name": "Domain Expert",
            "model_name": "gpt-4o",
            "role": "expert"
        }
    ],
    "swarm_type": "MixtureOfAgents",
    "task": "Analyze market trends and provide strategic recommendations"
}

Swarm Type Comparison

Swarm TypeBest ForExecutionComplexityScalability
MixtureOfAgentsComplex problems, diverse expertiseParallelHighHigh
SequentialWorkflowStep-by-step processes, pipelinesSequentialMediumMedium
ConcurrentWorkflowIndependent tasks, batch processingParallelLowHigh
AgentRearrangeAdaptive workflows, optimizationDynamicHighMedium
GroupChatCollaborative discussions, brainstormingInteractiveMediumLow
HierarchicalSwarmStructured organizations, managementHierarchicalHighMedium

Advanced Swarm Configuration

  • Hierarchical Swarm
  • Group Chat Swarm
swarm_config = {
    "name": "Corporate Analysis Department",
    "description": "Hierarchical corporate structure",
    "agents": [
        {
            "agent_name": "CEO Agent",
            "model_name": "gpt-4o",
            "role": "executive"
        },
        {
            "agent_name": "Manager Agent",
            "model_name": "gpt-4o",
            "role": "manager"
        },
        {
            "agent_name": "Analyst Agent 1",
            "model_name": "gpt-4o-mini",
            "role": "analyst"
        },
        {
            "agent_name": "Analyst Agent 2",
            "model_name": "gpt-4o-mini",
            "role": "analyst"
        }
    ],
    "swarm_type": "HierarchicalSwarm",
    "rules": "CEO delegates to managers, managers coordinate analysts",
    "task": "Conduct comprehensive market analysis"
}

Swarm Performance Optimization

  • Load Balancing
  • Cost Optimization
  • Quality Optimization
def optimize_swarm_for_load(tasks, available_resources):
    """Optimize swarm configuration based on load"""
    task_count = len(tasks)
    resource_count = len(available_resources)

    if task_count > resource_count * 2:
        # High load - use concurrent processing
        return {
            "swarm_type": "ConcurrentWorkflow",
            "max_concurrent": resource_count,
            "task_distribution": "round_robin"
        }
    elif task_count > resource_count:
        # Medium load - use mixture of agents
        return {
            "swarm_type": "MixtureOfAgents",
            "load_balancing": True
        }
    else:
        # Low load - use sequential for quality
        return {
            "swarm_type": "SequentialWorkflow",
            "optimize_quality": True
        }

Best Practices

Swarm Design

  1. Match Type to Task: Choose swarm type based on your specific requirements
  2. Agent Diversity: Use diverse agents with different expertise areas
  3. Clear Roles: Define clear roles and responsibilities for each agent
  4. Communication Protocols: Establish clear communication patterns

Performance Optimization

  1. Resource Allocation: Allocate resources based on task complexity
  2. Load Balancing: Distribute work evenly across agents
  3. Monitoring: Monitor swarm performance and adjust configuration
  4. Scalability: Design swarms that can scale with increased load

Quality Assurance

  1. Testing: Test swarm configurations with sample tasks
  2. Validation: Validate outputs against expected results
  3. Feedback Loops: Implement feedback mechanisms for improvement
  4. Version Control: Track swarm configuration versions

Cost Management

  1. Model Selection: Choose appropriate models based on task requirements
  2. Resource Limits: Set appropriate limits to control costs
  3. Usage Monitoring: Monitor resource usage and costs
  4. Optimization: Continuously optimize for cost efficiency
I