Skip to main content

Overview

The Hybrid Hierarchical-Cluster Swarm (HHCS) is an advanced AI orchestration architecture that combines hierarchical decision-making with parallel processing capabilities. HHCS enables complex task solving by dynamically routing tasks to specialized agent swarms based on their expertise and capabilities.

Installation

Purpose

HHCS addresses the challenge of efficiently solving diverse and complex tasks by:
  • Intelligently routing tasks to the most appropriate specialized swarms
  • Enabling parallel processing of multifaceted problems
  • Maintaining a clear hierarchy for effective decision-making
  • Combining outputs from multiple specialized agents for comprehensive solutions

Architecture Diagram

The HHCS architecture follows a hierarchical structure with the router agent at the top level, specialized swarms at the middle level, and individual agents at the bottom level.

Attributes

str
default:"Hybrid Hierarchical-Cluster Swarm"
The name of the swarm instance
str
Brief description of the swarm’s functionality
List[Union[SwarmRouter, Callable]]
default:"[]"
List of available swarm routers (or callables) that the HHCS can route tasks to
int
default:"1"
Maximum number of processing loops
HistoryOutputType
default:"list"
Format for output (e.g., “list”, “json”)
str
default:"gpt-5.4"
LLM model used by the router agent for task analysis and routing decisions

Methods

run()

Processes a single task through the swarm system. The router agent analyzes the task and routes it to the most appropriate specialized swarm.
Parameters:
  • task (str): The task to process
Returns: The aggregated results from the selected swarm(s), formatted according to output_type (a list by default)

batched_run()

Processes multiple tasks in parallel through the swarm system.
Parameters:
  • tasks (List[str]): List of task strings to process
Returns: List of results, one for each task

find_swarm_by_name()

Retrieves a swarm by its name from the available swarms.
Parameters:
  • swarm_name (str): Name of the swarm to find
Returns: The matching SwarmRouter instance

route_task()

Routes a task to a specific swarm by name.
Parameters:
  • swarm_name (str): Name of the target swarm
  • task_description (str): The task to route
get_swarms_info() is not a method on HybridHierarchicalClusterSwarm. It is a standalone helper (from swarms.structs.multi_agent_exec import get_swarms_info) that the constructor calls internally to build the router agent’s system prompt from the swarms list.

Usage Examples

Features

  • Router-based task distribution: Central router agent analyzes incoming tasks and directs them to appropriate specialized swarms
  • Hybrid architecture: Combines hierarchical control with clustered specialization
  • Parallel processing: Multiple swarms can work simultaneously on different aspects of complex tasks
  • Flexible swarm types: Supports both sequential and concurrent workflows within swarms
  • Comprehensive result aggregation: Collects and combines outputs from all contributing swarms

How It Works

  1. Task Input: A task is submitted to the HHCS
  2. Router Analysis: The router agent analyzes the task requirements
  3. Swarm Selection: The most appropriate specialized swarm is selected based on the task analysis
  4. Task Routing: The task is routed to the selected swarm for processing
  5. Parallel Processing: The selected swarm’s agents process the task (sequentially or concurrently depending on swarm type)
  6. Result Collection: Outputs from all contributing agents are collected into the conversation history
  7. Final Output: The aggregated results are returned

Source Code

View the source code on GitHub