From 1dae904c43460131d0dd0b047db806773d965419 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Tue, 17 Jun 2025 18:18:52 +0000 Subject: [PATCH] docs: update minimal MultiAgentRouter example and documentation to use SwarmRouter interface --- .../examples/multi_agent_router_minimal.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/swarms/examples/multi_agent_router_minimal.md b/docs/swarms/examples/multi_agent_router_minimal.md index 17ad8bc3..71fc3076 100644 --- a/docs/swarms/examples/multi_agent_router_minimal.md +++ b/docs/swarms/examples/multi_agent_router_minimal.md @@ -1,9 +1,10 @@ # MultiAgentRouter Minimal Example -This example shows how to route a task to the most suitable agent using `MultiAgentRouter`. +This example shows how to route a task to the most suitable agent using `SwarmRouter` with `swarm_type="MultiAgentRouter"`. ```python -from swarms import Agent, MultiAgentRouter +from swarms import Agent +from swarms.structs.swarm_router import SwarmRouter agents = [ Agent( @@ -18,9 +19,15 @@ agents = [ ), ] -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) ``` -View the source on [GitHub](https://github.com/kyegomez/swarms/blob/master/examples/multi_agent/mar/multi_agent_router_minimal.py). +View the source on [GitHub](https://github.com/kyegomez/swarms/blob/master/examples/multi_agent/mar/multi_agent_router_minimal.py). \ No newline at end of file