fix: update minimal MultiAgentRouter example and documentation

pull/896/head
Pavan Kumar 2 weeks ago
parent f9bfecf771
commit f8f148d6e5

@ -1,19 +1,25 @@
from swarms import Agent, MultiAgentRouter from swarms import Agent
from swarms.structs.swarm_router import SwarmRouter
if __name__ == "__main__": agents = [
agents = [ Agent(
Agent( agent_name="Researcher",
agent_name="Researcher", system_prompt="Answer questions briefly.",
system_prompt="Answer questions briefly.", model_name="gpt-4o-mini",
model_name="gpt-4o-mini", ),
), Agent(
Agent( agent_name="Coder",
agent_name="Coder", system_prompt="Write small Python functions.",
system_prompt="Write small Python functions.", model_name="gpt-4o-mini",
model_name="gpt-4o-mini", ),
), ]
]
router = MultiAgentRouter(agents=agents) router = SwarmRouter(
name="multi-agent-router-demo",
description="Routes tasks to the most suitable agent",
agents=agents,
swarm_type="MultiAgentRouter"
)
result = router.route_task("Write a function that adds two numbers") result = router.run("Write a function that adds two numbers")
print(result)
Loading…
Cancel
Save