fix: update minimal MultiAgentRouter example and documentation

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

@ -1,7 +1,7 @@
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.",
@ -12,8 +12,14 @@ if __name__ == "__main__":
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