From a56bf66db63c9cfa48b875224ac60b025f568895 Mon Sep 17 00:00:00 2001 From: Murat Kaan Meral Date: Fri, 12 Sep 2025 13:19:31 +0200 Subject: [PATCH 1/2] docs(swarm): Add configurable entry point --- docs/user-guide/concepts/multi-agent/swarm.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/user-guide/concepts/multi-agent/swarm.md b/docs/user-guide/concepts/multi-agent/swarm.md index 1b0f849f..1edaabb4 100644 --- a/docs/user-guide/concepts/multi-agent/swarm.md +++ b/docs/user-guide/concepts/multi-agent/swarm.md @@ -30,7 +30,7 @@ graph TD ## Creating a Swarm -To create a Swarm, you need to define a collection of agents with different specializations. The first agent in the list will receive the initial user request and act as the entry point for the swarm: +To create a Swarm, you need to define a collection of agents with different specializations. By default, the first agent in the list will receive the initial user request, but you can specify any agent as the entry point using the `entry_point` parameter: ```python import logging @@ -50,9 +50,10 @@ coder = Agent(name="coder", system_prompt="You are a coding specialist...") reviewer = Agent(name="reviewer", system_prompt="You are a code review specialist...") architect = Agent(name="architect", system_prompt="You are a system architecture specialist...") -# Create a swarm with these agents +# Create a swarm with these agents, starting with the researcher swarm = Swarm( - [researcher, coder, reviewer, architect], + [coder, researcher, reviewer, architect], + entry_point="researcher", # Start with the researcher max_handoffs=20, max_iterations=20, execution_timeout=900.0, # 15 minutes @@ -84,6 +85,7 @@ The [`Swarm`](../../../api-reference/multiagent.md#strands.multiagent.swarm.Swar | Parameter | Description | Default | |-----------|-------------|---------| +| `entry_point` | Name of the agent to start with (must match an agent's name) | None (uses first agent) | | `max_handoffs` | Maximum number of agent handoffs allowed | 20 | | `max_iterations` | Maximum total iterations across all agents | 20 | | `execution_timeout` | Total execution timeout in seconds | 900.0 (15 min) | From 7d04e80e2127c75f0d8faed9e5d27ea982656bc6 Mon Sep 17 00:00:00 2001 From: Murat Kaan Meral Date: Fri, 12 Sep 2025 14:49:37 +0200 Subject: [PATCH 2/2] Use agent instance as entry point parameter --- docs/user-guide/concepts/multi-agent/swarm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-guide/concepts/multi-agent/swarm.md b/docs/user-guide/concepts/multi-agent/swarm.md index 1edaabb4..e87af63b 100644 --- a/docs/user-guide/concepts/multi-agent/swarm.md +++ b/docs/user-guide/concepts/multi-agent/swarm.md @@ -53,7 +53,7 @@ architect = Agent(name="architect", system_prompt="You are a system architecture # Create a swarm with these agents, starting with the researcher swarm = Swarm( [coder, researcher, reviewer, architect], - entry_point="researcher", # Start with the researcher + entry_point=researcher, # Start with the researcher max_handoffs=20, max_iterations=20, execution_timeout=900.0, # 15 minutes @@ -85,7 +85,7 @@ The [`Swarm`](../../../api-reference/multiagent.md#strands.multiagent.swarm.Swar | Parameter | Description | Default | |-----------|-------------|---------| -| `entry_point` | Name of the agent to start with (must match an agent's name) | None (uses first agent) | +| `entry_point` | The agent instance to start with | None (uses first agent) | | `max_handoffs` | Maximum number of agent handoffs allowed | 20 | | `max_iterations` | Maximum total iterations across all agents | 20 | | `execution_timeout` | Total execution timeout in seconds | 900.0 (15 min) |