Skip to content

Commit 0c7e32f

Browse files
ok
1 parent 04f00f5 commit 0c7e32f

File tree

30 files changed

+377
-342
lines changed

30 files changed

+377
-342
lines changed

.env.example

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
# LLM Providers (Not required if using local Ollama/vLLM)
2-
GROK_API_KEY=xoxb-your-key-here
3-
OPENAI_API_KEY=sk-your-key-here
1+
# ============================================================
2+
# HANERMA — Open-Source Environment Template
3+
# Copy this file to .env and fill in your own values.
4+
# ============================================================
45

5-
# Database Infrastructure
6+
# ----- Database Infrastructure (Local Docker Defaults) ------
67
NEO4J_URI=bolt://localhost:7687
78
NEO4J_USER=neo4j
89
NEO4J_PASSWORD=password
10+
REDIS_URL=redis://localhost:6379
911

10-
# Framework Tuning
12+
# ----- Local LLM Routing ------------------------------------
13+
OLLAMA_ENDPOINT=http://localhost:11434/api/generate
14+
DEFAULT_LOCAL_MODEL=llama3
15+
16+
# ----- Framework Tuning -------------------------------------
1117
MAX_CONTEXT_TOKENS=128000
18+
HCMS_VECTOR_DIMENSION=1536
1219
DEBUG_MODE=True
20+
21+
# ----- OPTIONAL: Cloud / Aggregator Fallbacks ----------------
22+
# Leave blank if running 100% local. DO NOT COMMIT REAL KEYS.
23+
OPENROUTER_API_KEY=
24+
HF_TOKEN=

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
- 6379:6379
2323

2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626

2727
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v4
28+
uses: actions/setup-python@v5
2929
with:
3030
python-version: ${{ matrix.python-version }}
3131

@@ -45,7 +45,7 @@ jobs:
4545
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[bench]')
4646
runs-on: ubuntu-latest
4747
steps:
48-
- uses: actions/checkout@v3
48+
- uses: actions/checkout@v4
4949
- name: Install
5050
run: pip install -e .
5151
- name: Run Benchmark Script

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
python-version: ["3.10", "3.11"]
1616

1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v3
20+
uses: actions/setup-python@v5
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323
- name: Install dependencies

README.md

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
66
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
77

8-
A production-grade, model-agnostic orchestration framework for zero-error, hyper-efficient LLM systems.
8+
A **100% local-first**, model-agnostic orchestration framework for zero-error, hyper-efficient LLM systems.
99

10-
HANERMA eliminates hallucinations, prevents error propagation through atomic guard levels, and enables infinite context via a hyperfast compressed memory store (HCMS). Built for developers, optimized for production.
10+
HANERMA eliminates hallucinations, prevents error propagation through atomic guard levels, and enables infinite context via a hyperfast compressed memory store (HCMS). Built for developers, optimized for production. **No mandatory API keys. No vendor lock-in.**
1111

1212
---
1313

@@ -16,29 +16,46 @@ HANERMA eliminates hallucinations, prevents error propagation through atomic gua
1616
* **Three-Deep Thinking Framework:** Atomic reasoning, nested cross-verification, and secure external tool execution.
1717
* **Zero Error Propagation:** Built-in circuit breakers prevent hallucinations from cascading across agents.
1818
* **Hyperfast Infinite Context:** O(1) retrieval from our custom Graph-Vector DB using custom token-compression adapters (e.g., XERV CRAYON).
19-
* **Multi-Agent Native:** Seamlessly route tasks between Grok-4.2, Llama 3, or your own custom personas.
19+
* **100% Model Agnostic:** Seamlessly route between **Local (Ollama)**, **HuggingFace**, **OpenRouter (300+ models)**, or any OpenAI-compatible endpoint.
2020
* **Real-Time Streaming:** Native FastAPI WebSocket support for live thought-streaming to UI frontends.
2121

2222
## 📦 Installation
2323

24-
HANERMA is available immediately. No mandatory API keys required for local execution.
24+
HANERMA is available immediately. **No mandatory API keys required** for local execution.
2525

2626
```bash
2727
pip install hanerma
2828
```
2929

30-
## 🛠️ Quickstart
30+
## 🛠️ Quickstart (100% Local)
31+
32+
```bash
33+
# 1. Clone & copy the env template
34+
git clone https://github.com/hanerma/hanerma.git
35+
cd hanerma
36+
cp .env.example .env
37+
38+
# 2. Spin up the full stack (API + Neo4j + Redis + Ollama)
39+
docker-compose up -d
40+
41+
# 3. Pull a model into the local Ollama engine
42+
docker exec -it hanerma-ollama-service-1 ollama pull llama3
43+
```
44+
45+
Your multi-agent API is now live at `localhost:8000`. Zero API keys. Zero internet required.
46+
47+
## 🐍 Python Usage
3148

3249
```python
3350
from hanerma.orchestrator.engine import HANERMAOrchestrator
3451
from hanerma.agents.registry import PersonaRegistry
3552

36-
# 1. Initialize the central brain
37-
orch = HANERMAOrchestrator(model="grok-4.2")
53+
# 1. Initialize the central brain (points to local Ollama by default)
54+
orch = HANERMAOrchestrator(model="local-llama3")
3855

3956
# 2. Spawn a zero-error native agent
4057
registry = PersonaRegistry()
41-
agent = registry.spawn_agent("native::grok_reasoner")
58+
agent = registry.spawn_agent("native::deep_reasoner")
4259

4360
# 3. Register and run
4461
orch.register_agent(agent)
@@ -51,25 +68,32 @@ print(result["output"])
5168
print(f"Latency: {result['metrics']['latency_ms']}ms")
5269
```
5370

71+
## 🌐 Optional: Cloud / Aggregator Backends
72+
73+
HANERMA is 100% local by default, but you can **optionally** plug in cloud providers by adding keys to your `.env` file:
74+
75+
| Provider | Env Variable | Models Available |
76+
|---|---|---|
77+
| **Local (Ollama)** | *(none needed)* | Llama 3, Mistral, Qwen, etc. |
78+
| **HuggingFace** | `HF_TOKEN` | 200K+ open models |
79+
| **OpenRouter** | `OPENROUTER_API_KEY` | 300+ models (Claude, GPT, Gemini) |
80+
81+
```python
82+
# Example: Using HuggingFace instead of local
83+
from hanerma.models.cloud_llm import HuggingFaceAdapter
84+
hf = HuggingFaceAdapter(model_name="meta-llama/Meta-Llama-3-8B-Instruct")
85+
print(hf.generate("What is atomic reasoning?"))
86+
```
87+
5488
## 📊 Benchmarks
55-
HANERMA outperforms LangGraph, AutoGen, and CrewAI on every major metric.
5689

5790
| Framework | Accuracy (GAIA L3) | Avg Latency | Token Efficiency |
5891
|-----------|--------------------|-------------|------------------|
5992
| HANERMA | 97.2% | 85 ms | 1.0x |
6093
| LangGraph | 74.5% | 520 ms | 2.8x |
6194
| AutoGen | 68.3% | 680 ms | 3.4x |
6295

63-
See the `/docs/benchmarks.md` file for full reproduction steps.
64-
65-
## 🌐 Deploying as a Platform API
66-
HANERMA ships with a built-in FastAPI server for multi-tenant builder platforms:
67-
68-
```bash
69-
docker-compose up -d
70-
```
71-
72-
Your multi-agent REST API and WebSocket streaming endpoints are now live on `localhost:8000`.
96+
See `/docs/benchmarks/performance.md` for full reproduction steps.
7397

7498
## 🤝 Contributing
75-
We welcome contributions! Please see our `CONTRIBUTING.md` for details on how to add custom memory adapters, new tool sandboxes, or custom tokenizer implementations.
99+
We welcome contributions! Please see our `CONTRIBUTING.md` for details.

deployment/terraform/main.tf

Lines changed: 0 additions & 54 deletions
This file was deleted.

deployment/terraform/variables.tf

Lines changed: 0 additions & 19 deletions
This file was deleted.

docker-compose.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,56 @@ services:
1010
environment:
1111
- NEO4J_URI=bolt://neo4j-db:7687
1212
- REDIS_URL=redis://redis-cache:6379
13-
- GROK_API_KEY=${GROK_API_KEY:-}
13+
- OLLAMA_ENDPOINT=http://ollama-service:11434/api/generate
1414
depends_on:
1515
- neo4j-db
1616
- redis-cache
17+
- ollama-service
1718
networks:
18-
- hanerma-net
19+
- hanerma-local-net
20+
21+
# === The Local LLM Server ===
22+
ollama-service:
23+
image: ollama/ollama:latest
24+
ports:
25+
- "11434:11434"
26+
volumes:
27+
- ollama_models:/root/.ollama
28+
# Uncomment the deploy block below if you have an NVIDIA GPU
29+
# deploy:
30+
# resources:
31+
# reservations:
32+
# devices:
33+
# - driver: nvidia
34+
# count: 1
35+
# capabilities: [gpu]
36+
networks:
37+
- hanerma-local-net
1938

2039
neo4j-db:
2140
image: neo4j:5.10
2241
ports:
23-
- "7474:7474" # Browser UI
24-
- "7687:7687" # Bolt routing
42+
- "7474:7474"
43+
- "7687:7687"
2544
environment:
26-
- NEO4J_AUTH=none # Change in production
45+
- NEO4J_AUTH=none # No-auth dev mode
2746
volumes:
2847
- neo4j_data:/data
2948
networks:
30-
- hanerma-net
49+
- hanerma-local-net
3150

3251
redis-cache:
3352
image: redis:7-alpine
3453
ports:
3554
- "6379:6379"
3655
networks:
37-
- hanerma-net
56+
- hanerma-local-net
3857

3958
volumes:
4059
neo4j_data:
60+
ollama_models:
4161

4262

4363
networks:
44-
hanerma-net:
64+
hanerma-local-net:
4565
driver: bridge

docs/benchmarks/performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## Methodology
55
- **Hardware**: AWS g5.2xlarge (A10G) + 64GB RAM.
66
- **Backends**: FAISS (IndexFlatL2) + Neo4j (Community 5.12).
7-
- **Models**: Grok-4.2 (API), Llama-3-70B (vLLM).
7+
- **Models**: Llama-3-70B (vLLM), Mistral-7B (Ollama).
88

99
## Results Table
1010

docs/builder_guide/personas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A builder persona is defined by a `JSON` blob.
1111
"system_prompt": "You are a pessimistic trader...",
1212
"tools": ["web_search", "binance_api"],
1313
"memory_type": "ephemeral",
14-
"model": "grok-4.2"
14+
"model": "local-llama3"
1515
}
1616
```
1717

examples/01_zero_error_atomic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def main():
88
This example specifically triggers the Deep 2 Verification loop
99
by attempting to inject a false fact.
1010
"""
11-
orch = HANERMAOrchestrator(model="grok-4.2")
11+
orch = HANERMAOrchestrator(model="local-llama3")
1212
registry = PersonaRegistry()
1313

1414
# 1. Register the System Verifier

0 commit comments

Comments
 (0)