Skip to main content

๐Ÿง  Buni

The open-core hybrid edge-cloud framework for high-stakes, cryptographically grounded AI agents.

License PyPI version Python Version MCP Compatible Discord

Quickstart โ€ข Architecture โ€ข MCP Integration โ€ข Documentation โ€ข Buni Cloud


๐Ÿ’ก What is Buni?

Buni is a local-first CLI, gateway daemon, and MCP server that allows developers to build AI agents for industries where hallucinations and unverified outputs are unacceptable (healthcare, legal, finance, and enterprise compliance).

It acts as an intelligent hybrid router: routine, low-risk requests execute locally on your machine via Ollama ($0 COGS, zero network latency), while high-complexity or high-risk queries automatically escalate to the hosted buni_cognitive Cloud Engine for verifiable RAG grounding, deterministic safety scoring, and model arbitrage.

                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚    LOCAL DEVELOPER ENVIRONMENT        โ”‚
                      โ”‚  Your App / Cursor / Claude Desktop   โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                          โ”‚
                                          โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚    buni-cli Daemon (localhost:8000)   โ”‚
                      โ”‚    - Local ETAT+ Safety Evaluator     โ”‚
                      โ”‚    - Confidence Score Check (โ‰ฅ0.85)   โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                   โ”‚
             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
             โ”‚ Routine / Low-Risk                                    โ”‚ High-Risk / Low Confidence
             โ–ผ                                                       โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Tier 1: Local Ollama   โ”‚                            โ”‚ Tier 2: Buni Cloud       โ”‚
โ”‚  (llama3.2, qwen2.5)    โ”‚                            โ”‚ (buni_cognitive Engine)  โ”‚
โ”‚  - $0 COGS / 0ms Net    โ”‚                            โ”‚ - Global pgvector RAG    โ”‚
โ”‚  - 100% Private         โ”‚                            โ”‚ - Cryptographic SHA-256  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                            โ”‚ - Gemini Flash / GPT-4.1 โ”‚
                                                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ฅ Key Features

  • ๐ŸŽ๏ธ Local-First Hybrid Cascading: Run routine prompts locally via Ollama or LM Studio. Only pay for cloud compute when queries breach your risk or uncertainty thresholds.
  • ๐Ÿ›ก๏ธ Deterministic Safety Fallbacks: Python-enforced rule evaluation prevents critical edge cases from relying purely on LLM guesswork.
  • ๐Ÿ” Cryptographic Truth (dataset_hash): Cloud completions attach an immutable SHA-256 fingerprint proving the exact vector snapshot used during RAG generation.
  • ๐Ÿ”Œ Native MCP Server: Plugs directly into Claude Desktop, Cursor, or autonomous agents to expose standardized risk-scoring and grounded RAG tools.
  • โšก Dynamic COGS Arbitrage: Cloud requests automatically route low-risk queries to low-cost models (Gemini Flash at ~$0.0015/req) and escalate high-risk cases to GPT-4.1.
  • ๐Ÿ’ณ Dual-Rail Billing Ready: Built-in credit check proxy supporting prepaid local rails (M-Pesa, Paystack) and post-paid global rails (Metronome, Stripe, x402).

๐Ÿš€ Quickstart in 60 Seconds

1. Install via PyPI

pip install buni-cli

2. Initialize and Probe Local Models

Run buni init in your project directory. Buni will automatically scan your machine for running local LLM providers (e.g., Ollama at http://localhost:11434):

$ buni init

[Buni] Probing local environment...
[Buni] โœ“ Apple Silicon M-Series GPU detected.
[Buni] โœ“ Local Ollama instance found at http://localhost:11434.

Available local models:
  1) llama3.2:3b         (Installed - Recommended for local triage)
  2) qwen2.5-coder:7b    (Installed)
  3) Custom Endpoint...
  4) None (Cloud-Only Route)

Select primary local model [1-4]: 1

[Buni] Created buni.yaml successfully!

3. Start the Local Gateway Daemon

buni serve --port 8000

Your local daemon is now listening on http://localhost:8000/v1/chat/completions with full OpenAI API parity.


๐Ÿ’ป Code Example

You can point any standard OpenAI SDK directly to your local Buni daemon:

from openai import OpenAI

# Point your client to the local Buni daemon
client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="buni_cloud_key_optional_for_local"
)

response = client.chat.completions.create(
    model="buni-auto",  # Buni automatically routes local vs cloud
    messages=[
        {"role": "user", "content": "Patient reports mild headache for 2 hours."}
    ]
)

# Standard completion content
print(response.choices[0].message.content)

# Access Buni cryptographic metadata
x_buni = response.model_extra.get("x_buni", {})
print(f"Routed Tier: {x_buni.get('routed_tier')}")     # 'local' or 'cloud'
print(f"Dataset Hash: {x_buni.get('dataset_hash')}")    # SHA-256 RAG proof

๐Ÿ”Œ MCP Server Support (Claude & Cursor)

Buni includes a native Model Context Protocol (MCP) server so your AI coding assistants and autonomous agents can invoke grounded reasoning tools.

Cursor / Claude Desktop Configuration

Add Buni to your claude_desktop_config.json or Cursor MCP settings:

{
  "mcpServers": {
    "buni": {
      "command": "buni",
      "args": ["mcp", "serve"],
      "env": {
        "BUNI_API_KEY": "buni_cloud_sk_..."
      }
    }
  }
}

Available MCP Tools

  • evaluate_risk: Analyzes input text against deterministic rules engines and outputs a severity score (1โ€“5).
  • execute_grounded_query: Performs full vector RAG search and generates an answer backed by a cryptographic dataset_hash.

โš™๏ธ Configuration (buni.yaml)

Control your edge-to-cloud escalation limits directly in buni.yaml:

version: "1.0"

# Local Edge Provider
local:
  provider: ollama
  endpoint: "http://localhost:11434"
  model: "llama3.2:3b"
  confidence_threshold: 0.85  # Escalate to cloud if local logprobs < 0.85

# Cloud Escalation Settings
cloud:
  api_key: "${BUNI_API_KEY}"
  endpoint: "https://api.buni.health/v1/cognitive/execute"
  auto_escalate_severity: 3   # Always send Severity >= 3 to cloud
  verify_rag_hash: true

๐Ÿ“Š Local vs Cloud Decision Matrix

Metric / Gate Local Execution (Ollama) Cloud Execution (buni_cognitive)
Severity Score Severity 1โ€“2 (Routine, simple prompts) Severity 3โ€“5 (High risk, critical alerts)
Model Confidence Local logprobs >= 0.85 Local logprobs < 0.85
RAG Requirement Local cached knowledge base Global verified dataset with SHA-256 proof
Latency & Cost < 50ms / $0.00 COGS Sub-700ms P95 / Billed via Cloud Credits

๐ŸŒ Community & Commercial Ecosystem

  • Open-Core Engine: The buni-cli gateway, local Ollama router, and MCP server are 100% free and open source under the Apache 2.0 License.
  • Buni Cloud (Managed Platform): Sign up at buni.health for managed vector index hosting, international Metronome/Stripe billing, M-Pesa local pre-paid developer wallets, and 99.99% cloud uptime SLAs.

๐Ÿ“„ License

Distributed under the Apache License 2.0. See LICENSE for more information.

Download files

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

Source Distribution

buni_cli-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

buni_cli-0.1.0-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file buni_cli-0.1.0.tar.gz.

File metadata

  • Download URL: buni_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.4 Linux/7.0.0-30-generic

File hashes

Hashes for buni_cli-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4db9252cbd5329360ea6ce9fcb7bdd3204a98fb3c97053d58d2eff75b769bcdc
MD5 42d90504c4f8c87eb77d1636f308d311
BLAKE2b-256 ab39597263fb47283513c1d6d1a07c46b43bad6591ac235ff960b358afbe9e6e

See more details on using hashes here.

File details

Details for the file buni_cli-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: buni_cli-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.14.4 Linux/7.0.0-30-generic

File hashes

Hashes for buni_cli-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a20a385a57768b41b46acecaca137d838be7d2eada95328706ae43101dbc4c4a
MD5 14dc63e45e4f4d3e93494168a63cf9f9
BLAKE2b-256 e57458e3b68b1633dc7a0f25e09be150a2faca0fe124e99887056f236addb772

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Supported by

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