Skip to main content

Multi-agent orchestration framework with supervisor, router, and consensus topologies.

Project description

NeuralHive

๐Ÿง  NeuralHive

Multi-Agent Orchestration Framework โ€” Supervisor, Router, and Swarm Topologies

Python 3.11+ License: MIT Tests Topologies

Build production multi-agent systems with pluggable routing, shared memory, and fault tolerance. Supports supervisor, peer-to-peer, hierarchical, and consensus topologies.


Why NeuralHive?

Single-agent architectures hit a wall at 5+ tools. NeuralHive provides:

  • Topology-agnostic orchestration โ€” same agents, different wirings
  • Shared memory โ€” agents read each other's outputs without message explosion
  • Fault isolation โ€” one agent fails, others continue with graceful degradation
  • Cost attribution โ€” per-agent token tracking for optimization

Topologies

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ SUPERVISOR              ROUTER                          โ”‚
โ”‚                                                         โ”‚
โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”                         โ”‚
โ”‚    โ”‚ Boss โ”‚            โ”‚Routerโ”‚                         โ”‚
โ”‚    โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜            โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜                         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”                        โ”‚
โ”‚   โ–ผ   โ–ผ   โ–ผ           โ–ผ   โ–ผ   โ–ผ                        โ”‚
โ”‚  [A] [B] [C]         [A] [B] [C]                       โ”‚
โ”‚  Sequential           One-shot routing                  โ”‚
โ”‚                                                         โ”‚
โ”‚ HIERARCHICAL          CONSENSUS                         โ”‚
โ”‚                                                         โ”‚
โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”                โ”‚
โ”‚    โ”‚ Lead โ”‚           โ”‚ A โ”‚โ†”โ”‚ B โ”‚โ†”โ”‚ C โ”‚                โ”‚
โ”‚    โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”˜                โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”           All vote, majority wins          โ”‚
โ”‚   โ–ผ       โ–ผ                                            โ”‚
โ”‚ [Team1] [Team2]                                        โ”‚
โ”‚  โ”Œโ”ดโ”     โ”Œโ”ดโ”                                          โ”‚
โ”‚ [A][B]  [C][D]                                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Quick Start

pip install neuralhive
from neuralhive import Hive, Agent, SupervisorTopology

# Define specialist agents
analyst = Agent(
    name="analyst",
    system_prompt="You analyze maintenance data and identify risks.",
    tools=[search_orders, get_order_details],
)

cost_expert = Agent(
    name="cost_expert",
    system_prompt="You analyze costs and budget variances.",
    tools=[get_costs, get_budget],
)

writer = Agent(
    name="writer",
    system_prompt="You synthesize findings into executive summaries.",
    tools=[],
)

# Create hive with supervisor topology
hive = Hive(
    agents=[analyst, cost_expert, writer],
    topology=SupervisorTopology(
        routing_strategy="sequential",  # or "parallel", "conditional"
    ),
)

result = await hive.run("What are the critical overdue orders and their cost impact?")
print(result.final_answer)
print(result.cost_breakdown)  # per-agent token costs

Architecture

from neuralhive import Hive, Agent, RouterTopology

# Router topology โ€” single dispatch based on intent
hive = Hive(
    agents=[analyst, cost_expert, writer],
    topology=RouterTopology(),  # routes to best agent per query
)

# Consensus topology โ€” all agents answer, majority/synthesized output
from neuralhive import ConsensusTopology
hive = Hive(
    agents=[agent_a, agent_b, agent_c],
    topology=ConsensusTopology(strategy="synthesis"),
)

Features

Feature Description
4 Topologies Supervisor, Router, Hierarchical, Consensus
Shared Memory Agents access prior outputs without message duplication
Fault Tolerance Agent failures don't crash the hive; graceful degradation
Cost Attribution Per-agent token tracking + budget limits
Streaming SSE streaming from any topology
Async Native Full async/await, concurrent agent execution
Pluggable LLM Works with any LiteLLM-supported model

Documentation

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuralhive_ai-2.0.0.tar.gz (10.4 kB view details)

Uploaded Source

File details

Details for the file neuralhive_ai-2.0.0.tar.gz.

File metadata

  • Download URL: neuralhive_ai-2.0.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for neuralhive_ai-2.0.0.tar.gz
Algorithm Hash digest
SHA256 dadfd4c9fff3735f0dc142500886d882c3426f240e5c60877311baea98486b55
MD5 5f2b1bd3c8771fffee97131e35146ab0
BLAKE2b-256 0ba9f011e5fad2287f591718d6a4518acda2b2230631a2f1ac2c032f26fcb56a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page