Core Concept
Hives & Swarms
Understanding the collaborative architecture of Bothive agents.
What is a Hive?
A Hive is a single autonomous agent defined using HiveLang. It has a name, description, memory, and a set of tools it can use. A Hive can act independently or collaborate with other Hives in a Swarm.
Hive Properties
- Name: A unique identifier for the agent
- Description: What the agent does (used for routing)
- Tools: External capabilities (APIs, integrations)
- Memory: Persistent state across conversations
What is a Swarm?
A Swarm is a collection of Hives working together. When a request comes in, an orchestrator routes it to the most appropriate Hive based on its description and capabilities.
Swarm Benefits
- ✅ Specialization: Each Hive focuses on one task
- ✅ Parallel Execution: Multiple Hives can work simultaneously
- ✅ Fault Tolerance: If one Hive fails, others can compensate
- ✅ Scalability: Add new Hives without rewriting existing ones
Swarm Architecture
┌─────────────────────────────────────┐
│ Swarm Router │
│ (Routes requests to best agent) │
└──────────────┬──────────────────────┘
│
┌───────┼───────┐
▼ ▼ ▼
┌──────┐ ┌──────┐ ┌──────┐
│Hive 1│ │Hive 2│ │Hive 3│
│Search│ │Writer│ │Coder │
└──────┘ └──────┘ └──────┘
Defining a Swarm in HiveLang
You can define multiple agents in a single .hive file:
bot "ResearchSwarm"
description "A team of agents for research tasks"
agent "Searcher"
description "Finds information online"
on input
call integrations.google.search(query: input) as results
say f"Found: {results}"
end
end
agent "Summarizer"
description "Summarizes long content"
on input
call ai.generate(prompt: f"Summarize: {input}") as summary
say summary
end
end
end