Multi-Agent Orchestration with Strands
Why Multi-Agent Systems?
Single agents hit a ceiling when tasks require diverse expertise. Multi-agent systems decompose complex problems across specialized agents that collaborate to achieve outcomes no single agent could.
In strands there are multiple ways to build multi agent systems:
1. Agent as a Tool - This the simplest way to develop a multi agent system in strands. In this specialized agents are given to orchestrator agent as a tool. Which decide when to call which agent.
2. Graph - Graph gives a determinitic approach to multi agent system execution. In this approach specialized agents fucntion as nodes and data flow is defined by edges connecting them.
3. Swarm - This is the most advanced way to develop a multi agent system in strands. In this agents are given a common goal and they collaborate to achieve it.
Defining Multi Agents
import logging
from strands import Agent
from strands.multiagent import Swarm
# Enable debug logs and print them to stderr
logging.getLogger("strands.multiagent").setLevel(logging.DEBUG)
logging.basicConfig(
format="%(levelname)s | %(name)s | %(message)s",
handlers=[logging.StreamHandler()]
)
# Create specialized agents
researcher = Agent(name="researcher", system_prompt="You are a research specialist...")
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, starting with the researcher
swarm = Swarm(
[coder, researcher, reviewer, architect],
entry_point=researcher, # Start with the researcher
max_handoffs=20,
max_iterations=20,
execution_timeout=900.0, # 15 minutes
node_timeout=300.0, # 5 minutes per agent
repetitive_handoff_detection_window=8, # There must be >= 3 unique agents in the last 8 handoffs
repetitive_handoff_min_unique_agents=3
)
Running the agents
# Execute the swarm on a task
result = swarm("Design and implement a simple REST API for a todo app")
# Or use invoke_async for async execution: result = await swarm.invoke_async(...)
# Access the final result
print(f"Status: {result.status}")
print(f"Node history: {[node.node_id for node in result.node_history]}")
Conclusion
Multi-agent orchestration is the future of complex AI workflows. Strands provides a clean abstraction for designing these systems. Strands provides various ways to develope multi agent systems that can achieve different agentic pattern.
Stay ahead of the AI Curve
Get our curated weekly digest of tutorials, deep-dives, and industry insights.
No spam. Only high-signal AI engineering content. Unsubscribe at any time.