@@ -29,7 +29,7 @@ GROQ_API_KEY=""
2929
3030``` python
3131from swarms import Agent
32- from swarms.structs.swarm_router import SwarmRouter, SwarmType
32+ from swarms.structs.swarm_router import SwarmRouter
3333
3434# Initialize specialized agents
3535data_extractor_agent = Agent(
@@ -61,7 +61,7 @@ sequential_router = SwarmRouter(
6161 name = " SequentialRouter" ,
6262 description = " Process tasks in sequence" ,
6363 agents = [data_extractor_agent, summarizer_agent, financial_analyst_agent],
64- swarm_type = SwarmType. SequentialWorkflow,
64+ swarm_type = " SequentialWorkflow" ,
6565 max_loops = 1
6666)
6767
@@ -76,7 +76,7 @@ concurrent_router = SwarmRouter(
7676 name = " ConcurrentRouter" ,
7777 description = " Process tasks concurrently" ,
7878 agents = [data_extractor_agent, summarizer_agent, financial_analyst_agent],
79- swarm_type = SwarmType. ConcurrentWorkflow,
79+ swarm_type = " ConcurrentWorkflow" ,
8080 max_loops = 1
8181)
8282
@@ -91,8 +91,8 @@ rearrange_router = SwarmRouter(
9191 name = " RearrangeRouter" ,
9292 description = " Dynamically rearrange agents for optimal task processing" ,
9393 agents = [data_extractor_agent, summarizer_agent, financial_analyst_agent],
94- swarm_type = SwarmType. AgentRearrange,
95- flow = f " { data_extractor_agent.agent_name} -> { summarizer_agent.agent_name} -> { financial_analyst_agent.agent_name} " ,
94+ swarm_type = " AgentRearrange" ,
95+ rearrange_flow = f " { data_extractor_agent.agent_name} -> { summarizer_agent.agent_name} -> { financial_analyst_agent.agent_name} " ,
9696 max_loops = 1
9797)
9898
@@ -107,7 +107,7 @@ mixture_router = SwarmRouter(
107107 name = " MixtureRouter" ,
108108 description = " Combine multiple expert agents" ,
109109 agents = [data_extractor_agent, summarizer_agent, financial_analyst_agent],
110- swarm_type = SwarmType. MixtureOfAgents,
110+ swarm_type = " MixtureOfAgents" ,
111111 max_loops = 1
112112)
113113
@@ -137,14 +137,35 @@ router = SwarmRouter(
137137 name = " CustomRouter" ,
138138 description = " Custom router configuration" ,
139139 agents = [data_extractor_agent, summarizer_agent, financial_analyst_agent],
140- swarm_type = SwarmType. SequentialWorkflow,
140+ swarm_type = " SequentialWorkflow" ,
141141 max_loops = 3 ,
142142 autosave = True ,
143143 verbose = True ,
144144 output_type = " json"
145145)
146146```
147147
148+ # SwarmType Reference
149+
150+ ## Valid SwarmType Values
151+
152+ | Value | Description |
153+ | -------| -------------|
154+ | ` "SequentialWorkflow" ` | Execute agents in sequence |
155+ | ` "ConcurrentWorkflow" ` | Execute agents concurrently |
156+ | ` "AgentRearrange" ` | Dynamically rearrange agent execution order |
157+ | ` "MixtureOfAgents" ` | Combine outputs from multiple agents |
158+ | ` "GroupChat" ` | Enable group chat between agents |
159+ | ` "MultiAgentRouter" ` | Route tasks to appropriate agents |
160+ | ` "AutoSwarmBuilder" ` | Automatically build swarm configuration |
161+ | ` "HiearchicalSwarm" ` | Hierarchical agent organization |
162+ | ` "MajorityVoting" ` | Use majority voting for decisions |
163+ | ` "MALT" ` | Multi-Agent Learning and Training |
164+ | ` "CouncilAsAJudge" ` | Council-based evaluation system |
165+ | ` "InteractiveGroupChat" ` | Interactive group chat with agents |
166+ | ` "HeavySwarm" ` | Heavy swarm for complex tasks |
167+ | ` "auto" ` | Automatically select swarm type |
168+
148169# Best Practices
149170
150171## Choose the appropriate swarm type based on your task requirements:
@@ -187,7 +208,7 @@ Here's a complete example showing how to use SwarmRouter in a real-world scenari
187208``` python
188209import os
189210from swarms import Agent
190- from swarms.structs.swarm_router import SwarmRouter, SwarmType
211+ from swarms.structs.swarm_router import SwarmRouter
191212
192213# Initialize specialized agents
193214research_agent = Agent(
@@ -216,7 +237,7 @@ router = SwarmRouter(
216237 name = " ResearchAnalysisRouter" ,
217238 description = " Process research and analysis tasks" ,
218239 agents = [research_agent, analysis_agent, summary_agent],
219- swarm_type = SwarmType. SequentialWorkflow,
240+ swarm_type = " SequentialWorkflow" ,
220241 max_loops = 1 ,
221242 verbose = True
222243)
0 commit comments