Skip to main content
Glama
README.md
#  Ensemble Pro: Multi-Model AI Council

**Ensemble Pro** is an open-source Model Context Protocol (MCP) server that allows multiple LLMs to debate, critique, and vote on any question to reach a consensus. 

Built with a universal OpenAI-compatible API interface, it works with **any** model (OpenAI, NVIDIA NIM, Ollama, LM Studio, Groq, etc.) and can be integrated into **any** MCP-compatible client (Cursor, Claude Desktop, Chatbox, Zed).

---

##  Why Ensemble Pro?

Standard LLMs give you one probabilistic answer. Ensemble Pro gives you an **argued consensus**.

- **Resilient (Failover & Hot-Swap):** If an API goes down mid-debate, the system automatically swaps in a backup model without interrupting the council.
- **Universal:** Works with any OpenAI-compatible API. Mix local Ollama models with cloud GPT-4o.
- **Multilingual:** Models are instructed to respond in the language of your prompt.
- **Self-Cleaning:** Automatically deletes debate logs older than 72 hours.
- **Zero-Cost:** Run it entirely on free tiers or local models.

---

##  How It Works

When you ask a question, Ensemble Pro runs a 5-stage council:

```text
 [ USER QUESTION ]
        │
        ▼
┌───────────────────────────────────────────────────────┐
│  STAGE 1: PROPOSAL (Parallel)                         │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐                │
│  │ Model A │  │ Model B │  │ Model C │  (Anonymized)  │
│  └────┬────┘  └────┬────┘  └────┬────┘                │
│       │            │            │                     │
│       ▼            ▼            ▼                     │
│  STAGE 2: REVIEW (Parallel)                           │
│  Each model critiques the others' proposals.          │
│       │            │            │                     │
│       ▼            ▼            ▼                     │
│  STAGE 3: REBUTTAL (Parallel)                         │
│  Each model defends its proposal from criticism.      │
│       │            │            │                     │
│       ▼            ▼            ▼                     │
│  STAGE 4: VOTE (Parallel)                             │
│  Models rank the proposals (Borda Count).             │
│       │                                               │
│       ▼                                               │
│  [ WINNER DECLARED ]                                  │
│       │                                               │
│       ▼                                               │
│  STAGE 5: SYNTHESIS                                   │
│  The winning model synthesizes the final answer.      │
│       │                                               │
│       ▼                                               │
│ [ FINAL CONSENSUS ]                                   │
└───────────────────────────────────────────────────────┘
```

###  Failover & Hot-Swap Logic

```text
 [ COUNCIL STARTS ]
       │
       ▼
 HEALTH CHECK ──> Model A: OK
                Model B: FAIL (Rate Limit)
                Model C: OK
       │
       ▼
 FAILOVER ─────> Replaces Model B with Backup Model D
       │
       ▼
 COUNCIL RUNS ─> Model A + Model C + Model D
       │
       ▼
 MID-DEBATE ───> Model C Crashes!
       │
       ▼
 HOT-SWAP ─────> Coordinator drops Model C, brings in Model E
       │
       ▼
 COUNCIL FINISHES (Uninterrupted)
```

---

##  Installation

### Prerequisites
- Python 3.10+
- `curl` or `git` to download the repo

### Quick Install

1. Download the package.
2. Run the installer:

```bash
bash install.sh
```

The installer will:
1. Create an isolated Python virtual environment in `~/.ensemble-pro`.
2. Ask you for your API keys and model IDs (OpenAI, NVIDIA, Ollama, or Custom).
3. Generate the JSON configuration block needed for your MCP client.

---

##  Integration

Ensemble Pro works with **any** MCP client. Use the JSON generated by `install.sh`.

**Example for Cursor / Claude Desktop / Chatbox:**

```json
{
  "mcpServers": {
    "ensemble-pro": {
      "command": "/home/user/.ensemble-pro/.venv/bin/python",
      "args": ["-m", "src.mcp_server"],
      "cwd": "/home/user/.ensemble-pro",
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "NVIDIA_API_KEY": "nvapi-...",
        "OLLAMA_BASE_URL": "http://localhost:11434/v1"
      }
    }
  }
}
```

### Usage in Chat
Once connected, simply ask your AI assistant to use the council:

> *"Use ensemble_pro to debate: Is Rust better than C++ for systems programming?"*

The main model will trigger the MCP tool, run the council in the background, and return the synthesized consensus.

---

##  Uninstall

To completely remove Ensemble Pro and its sandbox:

```bash
bash uninstall.sh
# or manually:
rm -rf ~/.ensemble-pro
```

---

##  License
MIT License. Built upon the open-source `ensemble` framework.