Skip to main content
Swarm Type: HierarchicalSwarm

Overview

The HierarchicalSwarm implements a multi-level organizational structure where supervisor agents coordinate and manage specialized worker agents. This architecture mirrors real-world organizational hierarchies, allowing for complex task decomposition, quality control, and efficient resource allocation across multiple levels of responsibility. Key features:
  • Multi-Level Structure: Supervisor and worker agent hierarchy
  • Task Decomposition: Complex tasks broken down into manageable subtasks
  • Quality Control: Supervisors oversee and validate worker outputs
  • Resource Coordination: Efficient allocation and management of agent resources

Use Cases

  • Complex project management and coordination
  • Multi-stage research and analysis workflows
  • Content creation with editorial oversight
  • Quality assurance and validation processes

API Usage

Basic HierarchicalSwarm Example

Example Response:

Configuring the Director

HierarchicalSwarm runs a director agent that decomposes the task and delegates it to your worker agents. The director is created by the swarm itself rather than supplied in the agents array, so it is configured through two top-level SwarmSpec fields.
A lower temperature on the director produces more consistent task decomposition and delegation, while worker agents can keep a higher temperature for creative output.

Best Practices

  • Design clear supervisor-worker relationships
  • Ensure supervisors can effectively coordinate and synthesize results
  • Use a capable director_model_name — the director’s plan determines how well the workers perform
  • Lower the director’s temperature for more deterministic task decomposition
  • Use for complex projects requiring oversight and coordination
  • Ideal for research, content creation, and project management