Always start with one agent. Never build two agents simultaneously unless you know exactly what you’re doing. The more agents you have, the harder it becomes to train them on specific tasks.
Orchestration Patterns
Agency Swarm supports flexible orchestration patterns. Unlike all other frameworks, communication flows in Agency Swarm are uniform, meaning they can be defined in any way you want.
Scroll table to the right to see the full description of each pattern.
Examples:
- Handoff: Creative script writing with planner and script writer agents - requires tight user feedback at each stage to refine the story direction
- Orchestrator-Worker: News aggregation and research from various sources - quality of individual sources isn’t critical, main agent filters and compiles them
Handoff Pattern
Control transfers completely to another agent who takes over the interaction. The receiving agent gets full conversation history and continues from there.Orchestrator-Worker Pattern
One agent assigns tasks to multiple other agents and compiles their responses. Agents use other agents as specialized tools through theSendMessage mechanism. Control always returns to the orchestrator after each delegation.
Understanding Communication Flows
Communication flows are defined using tuples in thecommunication_flows parameter:
(sender, receiver), (sender > receiver), or (receiver < sender) defines a directional communication path. Entry points are agents that can communicate with users.
In the example above, the CEO can transfer the user to the Developer and the developer will proceed to interact with the user directly.
At the same time, the CEO can assign tasks to both Developer and Virtual Assistant, so they will run in parallel in different threads and come back with their results to the CEO.
Under the Hood
Agency Swarm uses aSendMessage tool for inter-agent communication. Defining communication flows adds recipients to this tool.
For advanced customization, see Custom Communication Flows.