Skip to content

mdayan8/hive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


🐝 HIVE

Swarm Intelligence That Predicts Anything

Drop any scenario in. Get an intelligence brief back.


Quick Start MCP Architecture Use Cases



⭐ Stars 🐍 Python 📜 License 🔌 MCP ⚡ API
Stars Python MIT MCP FastAPI

Desktop UICLIMCP ServerREST APIPython Library



What is HIVE?

HIVE deploys a swarm of autonomous AI agents that research, debate, and forecast any scenario. Plug it into Claude Desktop, VS Code, or Cursor as an MCP tool — or run it as a standalone desktop app. One config line and your AI can run full swarm simulations on demand.

pip install -r requirements.txt && playwright install chromium && echo "LLM_API_KEY=sk-..." > .env
python main.py --serve    # ← Desktop UI at http://localhost:8765
python hive_mcp_server.py # ← MCP server for Claude/Cursor/VS Code


🔌 MCP Server

Add this to Claude Desktop → instantly get swarm intelligence.

{
  "mcpServers": {
    "hive": {
      "command": "python",
      "args": ["/path/to/hive/hive_mcp_server.py"]
    }
  }
}

Then ask Claude:

"Run a simulation on AI chip market trends for 2026-2027"
"Should I pivot my startup to AI agents?"
"What are the top cyber threats to cloud infrastructure?"

Same one-line config works for VS Code, Cursor, and any MCP-compatible host.


Tool What You Get
run_simulation Full intelligence verdict — probabilities, risks, narrative
list_runs All past simulations
get_run Agents, debate, scenarios, verdict — full detail
get_report Complete markdown report
# Or run standalone:
python hive_mcp_server.py
python hive_mcp_server.py --transport sse --port 8932


🚀 Quick Start

🐍 Source Install — 30 seconds
git clone https://github.com/mdayan8/hive.git
cd hive
pip install -r requirements.txt
playwright install chromium
cp .env.example .env    # Add your LLM_API_KEY
python main.py --serve  # Open http://localhost:8765

🤖 MCP Integration — 10 seconds

See 🔌 MCP Server above. One JSON config. Done.


🖥️ All Interfaces
# CLI — one-shot forecast
python main.py --goal "Will Web3 gaming take off?" --timeline "12 months"

# REST API — integrate anywhere
curl -X POST http://localhost:8765/api/run \
  -H "Content-Type: application/json" \
  -d '{"goal": "Analyze NVIDIA competitors"}'

# Python Library
from core.orchestrator import run_orchestration_stream
await run_orchestration_stream(goal="Evaluate this startup")


🧠 How It Works

        ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐   ┌───────────┐
        │  SEED    │   │  SWARM   │   │ RESEARCH │   │  DEBATE  │   │SIMULATE  │   │ FORECAST  │
        │ EXTRACT  │ → │ GENERATE │ → │ + TOOLS  │ → │ CONSENSUS│ → │ SCENARIOS│ → │ + VERDICT │
        └──────────┘   └──────────┘   └──────────┘   └──────────┘   └──────────┘   └───────────┘
Phase What Happens
🥇 Seed Decompose goal → research domains → agent personas
🥈 Swarm Spawn specialized agents (market, risk, strategy, finance, trend)
🥉 Research Each agent uses tools in parallel — search, APIs, MCP, CLI
🤝 Debate Agents cross-examine findings, challenge assumptions, converge
📊 Simulate 3 probabilistic scenarios: optimistic → realistic → catastrophic
🎯 Forecast GO/NO-GO verdict + probability breakdown + risks + narrative

All live-streamed via SSE — watch agents think in real-time on the graph UI.



🛠️ Tool System

Type What It Connects Example
http Any REST API DexScreener, CoinGecko, threat intel, news
mcp Any MCP server PostgreSQL, filesystem, browser, APIs
cli Shell commands curl, python analyze.py, custom scripts
python Inline functions Custom logic evaluated at runtime
builtin Always available search_web, search_news

Connect a DexScreener API — agents automatically discover and use it:

{
  "type": "http",
  "name": "dexscreener",
  "config": {
    "url": "https://api.dexscreener.com/latest/dex/search",
    "method": "GET",
    "path_template": "?q={token}"
  }
}

Or a PostgreSQL database via MCP:

{
  "type": "mcp",
  "name": "db_analyst",
  "config": {
    "command": "npx",
    "args": ["-y", "@mcp/postgres", "postgresql://..."]
  }
}

Configure via the UI or API:

curl -X POST http://localhost:8765/api/tools/configure \
  -H "Content-Type: application/json" \
  -d '{"tools": [{"type": "http", "name": "coin_price", "config": {"url": "https://api.coingecko.com/api/v3/simple/price", "method": "GET", "path_template": "?ids={coin}&vs_currencies=usd"}}]}'


📖 Use Cases

Scenario What HIVE Does Outcome
🚀 Startup Validation "Should I launch a B2B SaaS for dental clinics?"
8 agents research market size, competition, regulations, sales cycles. Debate reveals 3 blind spots.
68%
CONDITIONAL-GO
🛡️ Threat Assessment "Top cloud threats in 2026?"
Agents map attack surfaces, zero-day trends, actor motivations. Cross-reference CVE databases.
Threat matrix
+ mitigations
📈 Trading Strategy "Evaluate a market-neutral crypto strategy"
Connect CoinGecko, on-chain data, sentiment. Analyze correlations & drawdowns.
72%
CONDITIONAL-GO


⚙️ Configuration

Environment Variables
Variable Default Required
LLM_API_KEY ✅ Yes
LLM_BASE_URL https://api.deepseek.com/v1/chat/completions ❌ No
LLM_MODEL_NAME deepseek-v4-flash ❌ No
ORCHESTRATOR_MODEL LLM_MODEL_NAME ❌ No
AGENT_MODEL LLM_MODEL_NAME ❌ No
Provider Examples
# DeepSeek (default)
LLM_API_KEY=sk-deepseek-key
LLM_BASE_URL=https://api.deepseek.com/v1/chat/completions
LLM_MODEL_NAME=deepseek-v4-flash

# Alibaba Qwen
LLM_API_KEY=sk-qwen-key
LLM_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
LLM_MODEL_NAME=qwen-plus

# OpenAI
LLM_API_KEY=sk-openai-key
LLM_BASE_URL=https://api.openai.com/v1/chat/completions
LLM_MODEL_NAME=gpt-4o


📋 API Reference

Method Endpoint Description
GET / 🖥️ Desktop UI
GET /api/events 📡 Live SSE stream — real-time swarm feed
POST /api/run 🎯 Start a new simulation
GET /api/runs 📂 List past runs
GET /api/runs/{id} 🔍 Full run details (agents, debate, scenarios, verdict)
GET /api/runs/{id}/report 📄 Download markdown report
GET /api/tools 🔧 List registered tools with schemas
POST /api/tools/configure ➕ Register custom tools
GET /api/tools/usage 📊 Tool call log
POST /api/agent/chat 💬 Chat with an agent


📁 Project Structure

hive/
├── main.py                    # CLI & desktop server entry point
├── hive_mcp_server.py         # 🔌 MCP server — start here for AI integration
│
├── core/                      # 🧠 Swarm engine
│   ├── agents.py              # Agent lifecycle & tool-calling
│   ├── orchestrator.py        # Pipeline orchestration
│   ├── tools.py               # Pluggable tool registry
│   ├── server.py              # FastAPI + SSE streaming
│   ├── search.py              # Web search
│   ├── llm.py                 # LLM abstraction
│   ├── seed.py                # Goal decomposition
│   ├── debate.py              # Multi-agent debate
│   ├── simulation.py          # Scenario engine
│   ├── report.py              # Report generator
│   ├── memory.py              # Run persistence
│   ├── events.py              # Event bus
│   ├── blackboard.py          # Citation graph
│   ├── prompts.py             # Prompt loader
│   ├── prompts/               # Agent system prompts
│   └── static/                # Desktop UI
│
├── requirements.txt
├── .env.example
├── LICENSE
└── README.md


GitHub MIT Python

Built with FastAPI, Playwright, and DeepSeek. MCP protocol by Anthropic.

About

Swarm Intelligence That Predicts Anything. HIVE deploys autonomous AI agents to research, debate, and forecast any scenario — delivering intelligence briefs with probability scores, risk analysis, and actionable strategy.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors