|
|
|
@ -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_name="Researcher",
|
|
|
|
|
system_prompt="Answer questions briefly.",
|
|
|
|
@ -12,8 +12,14 @@ if __name__ == "__main__":
|
|
|
|
|
system_prompt="Write small Python functions.",
|
|
|
|
|
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)
|