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
curl -X POST "https://api.swarms.world/v1/swarm/completions" \ -H "x-api-key: $SWARMS_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Comprehensive Market Analysis", "description": "Multi-perspective market analysis combining various expert viewpoints", "swarm_type": "MixtureOfAgents", "task": "Analyze the current state and future prospects of the electric vehicle market from multiple perspectives", "agents": [ { "agent_name": "Technology Analyst", "description": "Analyzes technological trends and innovations", "system_prompt": "You are a technology analyst specializing in automotive and battery technologies. Focus on technological advancements, innovation trends, and technical challenges in the EV market.", "model_name": "gpt-4o", "max_loops": 1, "temperature": 0.3 }, { "agent_name": "Economic Analyst", "description": "Analyzes market economics and financial aspects", "system_prompt": "You are an economic analyst specializing in automotive markets. Focus on market economics, pricing trends, cost analysis, and financial viability of EV adoption.", "model_name": "gpt-4o", "max_loops": 1, "temperature": 0.3 }, { "agent_name": "Environmental Specialist", "description": "Analyzes environmental impact and sustainability", "system_prompt": "You are an environmental specialist focusing on sustainability. Analyze the environmental impact of EVs, lifecycle analysis, and sustainability benefits compared to traditional vehicles.", "model_name": "gpt-4o", "max_loops": 1, "temperature": 0.3 }, { "agent_name": "Policy Expert", "description": "Analyzes regulatory and policy landscape", "system_prompt": "You are a policy expert specializing in automotive regulations. Focus on government policies, incentives, regulatory requirements, and policy trends affecting the EV market.", "model_name": "gpt-4o", "max_loops": 1, "temperature": 0.3 } ], "max_loops": 1 }'
Example Response:
Copy
{ "job_id": "swarms-M17nZFDesmLHxCRoeyF3NVYvPaXk", "status": "success", "swarm_name": "Comprehensive Market Analysis", "description": "Multi-perspective market analysis combining various expert viewpoints", "swarm_type": "MixtureOfAgents", "output": [ { "role": "Technology Analyst", "content": "From a technological perspective, the EV market is experiencing rapid innovation in battery technology, with solid-state batteries and improved energy density..." }, { "role": "Economic Analyst", "content": "Economically, the EV market shows strong growth potential with declining battery costs and increasing consumer adoption..." }, { "role": "Environmental Specialist", "content": "Environmentally, EVs offer significant benefits in reducing greenhouse gas emissions, though the full lifecycle impact depends on electricity sources..." }, { "role": "Policy Expert", "content": "Policy-wise, governments worldwide are implementing various incentives and regulations to accelerate EV adoption..." } ], "number_of_agents": 4, "service_tier": "standard", "execution_time": 32.1, "usage": { "input_tokens": 40, "output_tokens": 2800, "total_tokens": 2840, "billing_info": { "cost_breakdown": { "agent_cost": 0.04, "input_token_cost": 0.00012, "output_token_cost": 0.042, "token_counts": { "total_input_tokens": 40, "total_output_tokens": 2800, "total_tokens": 2840 }, "num_agents": 4, "service_tier": "standard", "night_time_discount_applied": true }, "total_cost": 0.08212, "discount_active": true, "discount_type": "night_time", "discount_percentage": 75 } }}