From f8f148d6e5d3892b4c2f052c88fbd5e715cfee53 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Tue, 17 Jun 2025 18:15:42 +0000 Subject: [PATCH] fix: update minimal MultiAgentRouter example and documentation --- .../mar/multi_agent_router_minimal.py | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/examples/multi_agent/mar/multi_agent_router_minimal.py b/examples/multi_agent/mar/multi_agent_router_minimal.py index 2930c175..898ccef3 100644 --- a/examples/multi_agent/mar/multi_agent_router_minimal.py +++ b/examples/multi_agent/mar/multi_agent_router_minimal.py @@ -1,19 +1,25 @@ -from swarms import Agent, MultiAgentRouter +from swarms import Agent +from swarms.structs.swarm_router import SwarmRouter -if __name__ == "__main__": - agents = [ - Agent( - agent_name="Researcher", - system_prompt="Answer questions briefly.", - model_name="gpt-4o-mini", - ), - Agent( - agent_name="Coder", - system_prompt="Write small Python functions.", - model_name="gpt-4o-mini", - ), - ] +agents = [ + Agent( + agent_name="Researcher", + system_prompt="Answer questions briefly.", + model_name="gpt-4o-mini", + ), + Agent( + agent_name="Coder", + 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) \ No newline at end of file