mirror of
https://github.com/Heretek-AI/heretek-openclaw.git
synced 2026-07-01 12:23:18 -04:00
feat: Add LiteLLM infrastructure with Ollama Llama 3.1 default
This commit is contained in:
+197
@@ -0,0 +1,197 @@
|
||||
# ==============================================================================
|
||||
# Heretek OpenClaw — Environment Configuration
|
||||
# ==============================================================================
|
||||
# Copy this file to .env and update with your values
|
||||
# Usage: cp .env.example .env
|
||||
#
|
||||
# Generated: 2026-03-28
|
||||
# NOTE: This configuration uses LiteLLM A2A (Agent-to-Agent) protocol.
|
||||
# Matrix communication is DEPRECATED.
|
||||
|
||||
# ==============================================================================
|
||||
# LITELELLM GATEWAY CONFIGURATION
|
||||
# ==============================================================================
|
||||
|
||||
# LiteLLM Master Key (REQUIRED — change in production!)
|
||||
LITELLM_MASTER_KEY=heretek-master-key-change-me
|
||||
|
||||
# LiteLLM Salt Key (used for encryption)
|
||||
LITELLM_SALT_KEY=heretek-salt-change-me
|
||||
|
||||
# LiteLLM UI Credentials
|
||||
LITELLM_UI_USERNAME=admin
|
||||
LITELLM_UI_PASSWORD=heretek-admin
|
||||
|
||||
# LiteLLM Host
|
||||
LITELLM_HOST=http://localhost:4000
|
||||
|
||||
# ==============================================================================
|
||||
# DATABASE CONFIGURATION
|
||||
# ==============================================================================
|
||||
|
||||
POSTGRES_PASSWORD=heretek
|
||||
|
||||
# ==============================================================================
|
||||
# LITELELLM A2A AGENT CONFIGURATION
|
||||
# ==============================================================================
|
||||
|
||||
# Current agent name (steward, triad, examiner, explorer, sentinel, coder)
|
||||
AGENT_NAME=steward
|
||||
|
||||
# Agent configuration JSON
|
||||
# Each agent has: role, session (unique workspace identifier)
|
||||
# Roles: orchestrator (steward), triad (alpha/beta/charlie), interrogator (examiner),
|
||||
# scout (explorer), guardian (sentinel), artisan (coder)
|
||||
AGENTS='{
|
||||
"steward": {
|
||||
"role": "orchestrator",
|
||||
"session": "agent:heretek:steward"
|
||||
},
|
||||
"alpha": {
|
||||
"role": "triad",
|
||||
"session": "agent:heretek:alpha"
|
||||
},
|
||||
"beta": {
|
||||
"role": "triad",
|
||||
"session": "agent:heretek:beta"
|
||||
},
|
||||
"charlie": {
|
||||
"role": "triad",
|
||||
"session": "agent:heretek:charlie"
|
||||
},
|
||||
"examiner": {
|
||||
"role": "interrogator",
|
||||
"session": "agent:heretek:examiner"
|
||||
},
|
||||
"explorer": {
|
||||
"role": "scout",
|
||||
"session": "agent:heretek:explorer"
|
||||
},
|
||||
"sentinel": {
|
||||
"role": "guardian",
|
||||
"session": "agent:heretek:sentinel"
|
||||
},
|
||||
"coder": {
|
||||
"role": "artisan",
|
||||
"session": "agent:heretek:coder"
|
||||
}
|
||||
}'
|
||||
|
||||
# ==============================================================================
|
||||
# MODEL PROVIDERS (Add your API keys)
|
||||
# ==============================================================================
|
||||
|
||||
# MiniMax API
|
||||
# Get your key from: https://platform.minimaxi.ai
|
||||
# MINIMAX_API_KEY=your-minimax-key-here
|
||||
|
||||
# GLM (Zhipu AI)
|
||||
# Get your key from: https://open.bigmodel.cn
|
||||
# GLM_API_KEY=your-glm-key-here
|
||||
|
||||
# Qwen (Alibaba Cloud)
|
||||
# Get your key from: https://dashscope.console.aliyun.com
|
||||
# QWEN_API_KEY=your-qwen-key-here
|
||||
|
||||
# Kimi (Moonshot AI)
|
||||
# Get your key from: https://platform.moonshot.cn
|
||||
# KIMI_API_KEY=your-kimi-key-here
|
||||
|
||||
# Ollama (Local Models)
|
||||
# Install: https://ollama.ai
|
||||
# NOTE: Set OLLAMA_HOST to http://host.docker.internal:11434 for Docker
|
||||
OLLAMA_API_KEY=not-required
|
||||
OLLAMA_HOST=http://localhost:11434
|
||||
|
||||
# OpenAI (Optional)
|
||||
# Get your key from: https://platform.openai.com
|
||||
# OPENAI_API_KEY=your-openai-key-here
|
||||
|
||||
# Anthropic (Optional)
|
||||
# Get your key from: https://console.anthropic.com
|
||||
# ANTHROPIC_API_KEY=your-anthropic-key-here
|
||||
|
||||
# Google Gemini (Optional)
|
||||
# Get your key from: https://aistudio.google.com/app/apikey
|
||||
# GEMINI_API_KEY=your-gemini-key-here
|
||||
|
||||
# ==============================================================================
|
||||
# EMBEDDING MODELS
|
||||
# ==============================================================================
|
||||
|
||||
# Qwen Embedding (via Ollama)
|
||||
# OLLAMA_EMBEDDING_MODEL=qwen3-embedding:8b
|
||||
|
||||
# Or use OpenAI embeddings
|
||||
# OPENAI_EMBEDDING_MODEL=text-embedding-3-small
|
||||
|
||||
# ==============================================================================
|
||||
# OPENCLAW SPECIFIC SETTINGS
|
||||
# ==============================================================================
|
||||
|
||||
# OpenClaw data directory
|
||||
OPENCLAW_DATA_DIR=./data
|
||||
|
||||
# Collective memory directory
|
||||
COLLECTIVE_MEMORY_DIR=./memory
|
||||
|
||||
# Skills directory
|
||||
SKILLS_DIR=./skills
|
||||
|
||||
# ==============================================================================
|
||||
# NETWORK CONFIGURATION
|
||||
# ==============================================================================
|
||||
|
||||
# LiteLLM Host
|
||||
LITELLM_HOST=http://localhost:4000
|
||||
|
||||
# LiteLLM API Key (use master key)
|
||||
LITELLM_API_KEY=${LITELLM_MASTER_KEY}
|
||||
|
||||
# ==============================================================================
|
||||
# RATE LIMITING & CACHING (Redis)
|
||||
# ==============================================================================
|
||||
|
||||
# Redis URL
|
||||
REDIS_URL=redis://localhost:6379/0
|
||||
|
||||
# Rate limit settings (requests per minute)
|
||||
RATE_LIMIT_ENABLED=true
|
||||
RATE_LIMIT_REQUESTS_PER_MINUTE=60
|
||||
|
||||
# Cache settings
|
||||
CACHE_ENABLED=true
|
||||
CACHE_TTL_SECONDS=3600
|
||||
|
||||
# ==============================================================================
|
||||
# LOGGING & MONITORING
|
||||
# ==============================================================================
|
||||
|
||||
# Log level: DEBUG, INFO, WARNING, ERROR
|
||||
LOG_LEVEL=INFO
|
||||
|
||||
# Enable detailed request logging
|
||||
LITELLM_REQUEST_LOGGING=true
|
||||
|
||||
# ==============================================================================
|
||||
# SECURITY
|
||||
# ==============================================================================
|
||||
|
||||
# CORS allowed origins (comma-separated)
|
||||
CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173
|
||||
|
||||
# Admin emails for alerts
|
||||
# ADMIN_EMAILS=admin@heretek.local
|
||||
|
||||
# ==============================================================================
|
||||
# BACKUP & RECOVERY
|
||||
# ==============================================================================
|
||||
|
||||
# Enable automatic backup
|
||||
AUTO_BACKUP_ENABLED=true
|
||||
|
||||
# Backup interval (hours)
|
||||
BACKUP_INTERVAL_HOURS=24
|
||||
|
||||
# Backup retention (days)
|
||||
BACKUP_RETENTION_DAYS=7
|
||||
@@ -0,0 +1,192 @@
|
||||
# Heretek OpenClaw — Infrastructure Services
|
||||
# LiteLLM Gateway + PostgreSQL (pgvector) + Redis
|
||||
#
|
||||
# Architecture:
|
||||
# ┌─────────────────────────────────────────────────────────┐
|
||||
# │ Heretek OpenClaw │
|
||||
# │ ┌───────────┐ ┌───────────┐ ┌───────────────────┐ │
|
||||
# │ │ Agents │──│ LiteLLM │──│ External APIs │ │
|
||||
# │ │ (Steward, │ │ :4000 │ │ (OpenAI, Anthropic,│ │
|
||||
# │ │ Triad, │ │ │ │ Google, etc.) │ │
|
||||
# │ │ etc.) │ └─────┬─────┘ └───────────────────┘ │
|
||||
# │ └───────────┘ │ │
|
||||
# │ │ │
|
||||
# │ ┌───────┴───────┐ │
|
||||
# │ │ │ │
|
||||
# │ ┌─────▼─────┐ ┌─────▼─────┐ │
|
||||
# │ │ PostgreSQL │ │ Redis │ │
|
||||
# │ │ :5432 │ │ :6379 │ │
|
||||
# │ │ + pgvector │ │ (cache, │ │
|
||||
# │ │ (RAG, │ │ rate- │ │
|
||||
# │ │ vector DB)│ │ limiting)│ │
|
||||
# │ └───────────┘ └───────────┘ │
|
||||
# └─────────────────────────────────────────────────────────┘
|
||||
#
|
||||
# Usage:
|
||||
# docker-compose up -d
|
||||
# docker-compose logs -f litellm
|
||||
# docker-compose down (stops containers)
|
||||
# docker-compose down -v (stops + removes volumes)
|
||||
#
|
||||
# Default Ports:
|
||||
# litellm: 4000 (Gateway + A2A)
|
||||
# postgres: 5432 (Database + Vector)
|
||||
# redis: 6379 (Cache + Rate Limiting)
|
||||
|
||||
services:
|
||||
# ==============================================================================
|
||||
# LiteLLM Gateway — Unified LLM API with A2A (Agent-to-Agent) Protocol
|
||||
# ==============================================================================
|
||||
litellm:
|
||||
image: ghcr.io/berriai/litellm:main-latest
|
||||
container_name: heretek-litellm
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "127.0.0.1:4000:4000"
|
||||
volumes:
|
||||
- ./litellm_config.yaml:/app/config.yaml:ro
|
||||
environment:
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
# LiteLLM Core Settings
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
- LITELLM_MASTER_KEY=${LITELLM_MASTER_KEY:-heretek-master-key-change-me}
|
||||
- LITELLM_SALT_KEY=${LITELLM_SALT_KEY:-heretek-salt-change-me}
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
# Database & Cache Connections
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
- DATABASE_URL=postgresql://heretek:${POSTGRES_PASSWORD:-heretek}@postgres:5432/heretek
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
# Model Settings
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
- OLLAMA_HOST=http://ollama:11434
|
||||
- STORE_MODEL_IN_DB=True
|
||||
- LITELLM_DROP_PARAMS=True
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
# A2A (Agent-to-Agent) Protocol Settings
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
- AGENT_MODE_ENABLED=true
|
||||
- AGENT_A2A_VERSION=1.0
|
||||
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
# UI & Monitoring
|
||||
# ─────────────────────────────────────────────────────────────────────────
|
||||
- LITELLM_UI_USERNAME=${LITELLM_UI_USERNAME:-admin}
|
||||
- LITELLM_UI_PASSWORD=${LITELLM_UI_PASSWORD:-heretek-admin}
|
||||
|
||||
command: [
|
||||
"--config", "/app/config.yaml",
|
||||
"--port", "4000",
|
||||
"--num_workers", "4"
|
||||
]
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
ollama:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:4000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 60s
|
||||
networks:
|
||||
- heretek-network
|
||||
|
||||
# ==============================================================================
|
||||
# PostgreSQL with pgvector — Vector Database for RAG
|
||||
# ==============================================================================
|
||||
postgres:
|
||||
image: pgvector/pgvector:pg17
|
||||
container_name: heretek-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: heretek
|
||||
POSTGRES_USER: heretek
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-heretek}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "127.0.0.1:5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U heretek -d heretek"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- heretek-network
|
||||
|
||||
# ==============================================================================
|
||||
# Redis — Caching & Rate Limiting
|
||||
# ==============================================================================
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: heretek-redis
|
||||
restart: unless-stopped
|
||||
command: >
|
||||
redis-server
|
||||
--appendonly yes
|
||||
--maxmemory 256mb
|
||||
--maxmemory-policy allkeys-lru
|
||||
--tcp-keepalive 60
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
ports:
|
||||
- "127.0.0.1:6379:6379"
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- heretek-network
|
||||
|
||||
# ==============================================================================
|
||||
# Ollama — Local LLM Runtime (Optional, for local models)
|
||||
# ==============================================================================
|
||||
# NOTE: Run `docker exec heretek-ollama ollama pull llama3.1` to pull the default model
|
||||
# Or use the healthcheck to auto-pull on first run
|
||||
# ==============================================================================
|
||||
ollama:
|
||||
image: ollama/ollama:latest
|
||||
container_name: heretek-ollama
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ollama_data:/root/.ollama
|
||||
ports:
|
||||
- "127.0.0.1:11434:11434"
|
||||
environment:
|
||||
- OLLAMA_HOST=0.0.0.0
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:11434/"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
networks:
|
||||
- heretek-network
|
||||
|
||||
# ==============================================================================
|
||||
# Volumes — Persistent Data Storage
|
||||
# ==============================================================================
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
ollama_data:
|
||||
driver: local
|
||||
|
||||
# ==============================================================================
|
||||
# Networks — Container Communication
|
||||
# ==============================================================================
|
||||
networks:
|
||||
heretek-network:
|
||||
driver: bridge
|
||||
ipam:
|
||||
config:
|
||||
- subnet: 172.28.0.0/16
|
||||
@@ -0,0 +1,265 @@
|
||||
# ==============================================================================
|
||||
# Heretek OpenClaw — LiteLLM Configuration
|
||||
# ==============================================================================
|
||||
# Model routing, embeddings, and caching for Heretek OpenClaw
|
||||
#
|
||||
# DEFAULT MODEL: Ollama Llama 3.1 (llama3.1)
|
||||
# This file is mounted to the LiteLLM container at /app/config.yaml
|
||||
# ==============================================================================
|
||||
|
||||
# ==============================================================================
|
||||
# MODEL LIST — Available Models
|
||||
# ==============================================================================
|
||||
model_list:
|
||||
# ---------------------------------------------------------------------------
|
||||
# DEFAULT MODEL: Ollama Llama 3.1 (Primary)
|
||||
# ---------------------------------------------------------------------------
|
||||
- model_name: llama3.1
|
||||
litellm_params:
|
||||
model: ollama/llama3.1
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: llama3.1:70b
|
||||
litellm_params:
|
||||
model: ollama/llama3.1:70b
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: llama3.1:8b
|
||||
litellm_params:
|
||||
model: ollama/llama3.1:8b
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Additional Ollama Models
|
||||
# ---------------------------------------------------------------------------
|
||||
- model_name: llama3
|
||||
litellm_params:
|
||||
model: ollama/llama3
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: qwen2.5:72b
|
||||
litellm_params:
|
||||
model: ollama/qwen2.5:72b
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: qwen2.5:32b
|
||||
litellm_params:
|
||||
model: ollama/qwen2.5:32b
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: qwen2.5:14b
|
||||
litellm_params:
|
||||
model: ollama/qwen2.5:14b
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: qwen2.5:7b
|
||||
litellm_params:
|
||||
model: ollama/qwen2.5:7b
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: mistral
|
||||
litellm_params:
|
||||
model: ollama/mistral
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: phi4
|
||||
litellm_params:
|
||||
model: ollama/phi4
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Ollama Embedding Models
|
||||
# ---------------------------------------------------------------------------
|
||||
- model_name: llama3-embedding
|
||||
litellm_params:
|
||||
model: ollama/llama3-embedding
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
- model_name: nomic-embed-text
|
||||
litellm_params:
|
||||
model: ollama/nomic-embed-text
|
||||
api_key: os.environ/OLLAMA_API_KEY
|
||||
api_base: http://host.docker.internal:11434
|
||||
num_retries: 0
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Cloud Models (Optional — requires API keys)
|
||||
# ---------------------------------------------------------------------------
|
||||
- model_name: minimax/M2.5
|
||||
litellm_params:
|
||||
model: minimax/M2.5
|
||||
api_key: os.environ/MINIMAX_API_KEY
|
||||
api_base: https://api.minimaxi.chat/v1
|
||||
|
||||
- model_name: minimax/M2.7
|
||||
litellm_params:
|
||||
model: minimax/M2.7
|
||||
api_key: os.environ/MINIMAX_API_KEY
|
||||
api_base: https://api.minimaxi.chat/v1
|
||||
|
||||
- model_name: glm-5
|
||||
litellm_params:
|
||||
model: glm-5
|
||||
api_key: os.environ/GLM_API_KEY
|
||||
api_base: https://open.bigmodel.cn/api/paas/v4
|
||||
|
||||
- model_name: qwen3.5
|
||||
litellm_params:
|
||||
model: qwen3.5
|
||||
api_key: os.environ/QWEN_API_KEY
|
||||
api_base: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||
|
||||
- model_name: kimi
|
||||
litellm_params:
|
||||
model: kimi
|
||||
api_key: os.environ/KIMI_API_KEY
|
||||
api_base: https://api.moonshot.cn/v1
|
||||
|
||||
- model_name: gpt-4o
|
||||
litellm_params:
|
||||
model: openai/gpt-4o
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
|
||||
- model_name: gpt-4o-mini
|
||||
litellm_params:
|
||||
model: openai/gpt-4o-mini
|
||||
api_key: os.environ/OPENAI_API_KEY
|
||||
|
||||
- model_name: claude-sonnet-4-20250514
|
||||
litellm_params:
|
||||
model: anthropic/claude-sonnet-4-20250514
|
||||
api_key: os.environ/ANTHROPIC_API_KEY
|
||||
|
||||
- model_name: gemini-2.0-flash
|
||||
litellm_params:
|
||||
model: gemini/gemini-2.0-flash
|
||||
api_key: os.environ/GEMINI_API_KEY
|
||||
|
||||
# ==============================================================================
|
||||
# LITELLM SETTINGS
|
||||
# ==============================================================================
|
||||
litellm_settings:
|
||||
# Default model (Llama 3.1)
|
||||
default_model: llama3.1
|
||||
|
||||
# Drop unsupported params (compatibility)
|
||||
drop_params: true
|
||||
|
||||
# Disable verbose logging by default
|
||||
set_verbose: false
|
||||
|
||||
# Request timeout (seconds)
|
||||
request_timeout: 300
|
||||
|
||||
# Retry settings
|
||||
num_retries: 2
|
||||
retry_after: 2
|
||||
|
||||
# Enable caching
|
||||
cache: true
|
||||
cache_params:
|
||||
ttl: 3600
|
||||
redis_url: redis://redis:6379/0
|
||||
|
||||
# Custom embeddings base
|
||||
custom_embeddings_base: "http://host.docker.internal:11434"
|
||||
|
||||
# ==============================================================================
|
||||
# GENERAL SETTINGS
|
||||
# ==============================================================================
|
||||
general_settings:
|
||||
# Database connection for LiteLLM to store model configs
|
||||
database_url: postgresql://heretek:heretek@postgres:5432/heretek
|
||||
|
||||
# Redis for caching and rate limiting
|
||||
redis_url: redis://redis:6379/0
|
||||
|
||||
# Master key for authentication
|
||||
master_key: os.environ/LITELLM_MASTER_KEY
|
||||
|
||||
# Environment
|
||||
environment: heretek-openclaw
|
||||
|
||||
# ==============================================================================
|
||||
# A2A (AGENT-TO-AGENT) PROTOCOL SETTINGS
|
||||
# ==============================================================================
|
||||
a2a_settings:
|
||||
# Enable A2A protocol
|
||||
enabled: true
|
||||
|
||||
# Default agent timeout (seconds)
|
||||
agent_timeout: 300
|
||||
|
||||
# Session management
|
||||
session_persistence: redis
|
||||
session_ttl: 86400 # 24 hours
|
||||
|
||||
# Agent endpoints
|
||||
agent_endpoint_format: "/v1/agents/{agent_name}"
|
||||
send_message_endpoint: "/v1/agents/{agent_name}/send"
|
||||
receive_message_endpoint: "/v1/agents/{agent_name}/receive"
|
||||
|
||||
# Health check
|
||||
health_check_endpoint: "/health"
|
||||
health_check_timeout: 10
|
||||
|
||||
# ==============================================================================
|
||||
# RATE LIMITING
|
||||
# ==============================================================================
|
||||
router_settings:
|
||||
# Routing strategy: simple-shuffle, latency-based-routing, usage-based-routing
|
||||
routing_strategy: latency-based-routing
|
||||
|
||||
# Enable rate limiting
|
||||
enable_rate_limiting: true
|
||||
|
||||
# Default limits
|
||||
default_limit_requests: 60
|
||||
default_limit_period: 60 # per minute
|
||||
|
||||
# Model-specific limits (can override default)
|
||||
model_limits:
|
||||
llama3.1:
|
||||
requests_per_minute: 30
|
||||
llama3.1:70b:
|
||||
requests_per_minute: 10
|
||||
gpt-4o:
|
||||
requests_per_minute: 20
|
||||
|
||||
# ==============================================================================
|
||||
# FALLBACK MODELS (if default fails)
|
||||
# ==============================================================================
|
||||
fallback_models:
|
||||
- llama3.1
|
||||
- qwen2.5:14b
|
||||
- mistral
|
||||
|
||||
# ==============================================================================
|
||||
# GUARDRAILS (Content Filtering)
|
||||
# ==============================================================================
|
||||
# guardrails:
|
||||
# - guardrail_name: "content_filter"
|
||||
# actions:
|
||||
# - block
|
||||
+317
@@ -0,0 +1,317 @@
|
||||
{
|
||||
"$schema": "https://docs.openclaw.ai/schema/openclaw-agent.json",
|
||||
"version": "1.0.0",
|
||||
"collective": {
|
||||
"name": "Heretek OpenClaw",
|
||||
"description": "Self-improving autonomous agent collective with LiteLLM A2A protocol",
|
||||
"created": "2026-03-28",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"agents": [
|
||||
{
|
||||
"id": "steward",
|
||||
"name": "Steward",
|
||||
"role": "orchestrator",
|
||||
"description": "Orchestrates the collective. Monitors agent health, enforces workflow, coordinates deliberation, manages proposals, triggers agent cycles, resolves deadlocks.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:steward",
|
||||
"capabilities": [
|
||||
"health_monitoring",
|
||||
"workflow_enforcement",
|
||||
"deliberation_coordination",
|
||||
"proposal_management",
|
||||
"agent_cycle_triggering",
|
||||
"deadlock_resolution"
|
||||
],
|
||||
"skills": [
|
||||
"steward-orchestrator",
|
||||
"triad-sync-protocol",
|
||||
"fleet-backup"
|
||||
],
|
||||
"parameters": {
|
||||
"max_deliberation_cycles": 5,
|
||||
"health_check_interval": 60,
|
||||
"auto_recovery": true,
|
||||
"consensus_threshold": 0.66
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "steward",
|
||||
"AGENT_ROLE": "orchestrator",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "alpha",
|
||||
"name": "Alpha",
|
||||
"role": "triad",
|
||||
"description": "Triad member Alpha. Primary deliberator on proposals, maintains consensus ledger, participates in governance decisions.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:alpha",
|
||||
"capabilities": [
|
||||
"proposal_deliberation",
|
||||
"consensus_ledger_maintenance",
|
||||
"governance_voting",
|
||||
"proposal_creation"
|
||||
],
|
||||
"skills": [
|
||||
"governance-modules",
|
||||
"triad-sync-protocol",
|
||||
"curiosity-engine"
|
||||
],
|
||||
"parameters": {
|
||||
"voting_weight": 1.0,
|
||||
"can_create_proposals": true,
|
||||
"can_veto": false,
|
||||
"deliberation_timeout": 300
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "alpha",
|
||||
"AGENT_ROLE": "triad",
|
||||
"TRIAD_NODE_ID": "alpha",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "beta",
|
||||
"name": "Beta",
|
||||
"role": "triad",
|
||||
"description": "Triad member Beta. Secondary deliberator, provides alternative perspectives, challenges assumptions.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:beta",
|
||||
"capabilities": [
|
||||
"proposal_deliberation",
|
||||
"consensus_ledger_maintenance",
|
||||
"critical_analysis",
|
||||
"assumption_challenge"
|
||||
],
|
||||
"skills": [
|
||||
"governance-modules",
|
||||
"triad-sync-protocol",
|
||||
"curiosity-engine"
|
||||
],
|
||||
"parameters": {
|
||||
"voting_weight": 1.0,
|
||||
"can_create_proposals": true,
|
||||
"can_veto": false,
|
||||
"deliberation_timeout": 300
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "beta",
|
||||
"AGENT_ROLE": "triad",
|
||||
"TRIAD_NODE_ID": "beta",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "charlie",
|
||||
"name": "Charlie",
|
||||
"role": "triad",
|
||||
"description": "Triad member Charlie. Final deliberator, ensures process integrity, validates consensus completeness.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:charlie",
|
||||
"capabilities": [
|
||||
"proposal_deliberation",
|
||||
"consensus_ledger_maintenance",
|
||||
"process_validation",
|
||||
"final_approval"
|
||||
],
|
||||
"skills": [
|
||||
"governance-modules",
|
||||
"triad-sync-protocol",
|
||||
"curiosity-engine"
|
||||
],
|
||||
"parameters": {
|
||||
"voting_weight": 1.0,
|
||||
"can_create_proposals": true,
|
||||
"can_veto": true,
|
||||
"deliberation_timeout": 300
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "charlie",
|
||||
"AGENT_ROLE": "triad",
|
||||
"TRIAD_NODE_ID": "charlie",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "examiner",
|
||||
"name": "Examiner",
|
||||
"role": "interrogator",
|
||||
"description": "Questions and challenges decisions. Validates logic, identifies blind spots, ensures thorough reasoning.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:examiner",
|
||||
"capabilities": [
|
||||
"decision_questioning",
|
||||
"logic_validation",
|
||||
"blind_spot_identification",
|
||||
"risk_assessment"
|
||||
],
|
||||
"skills": [
|
||||
"triad-sync-protocol",
|
||||
"gap-detector"
|
||||
],
|
||||
"parameters": {
|
||||
"question_depth": "deep",
|
||||
"challenge_threshold": 0.5,
|
||||
"report_format": "detailed"
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "examiner",
|
||||
"AGENT_ROLE": "interrogator",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "explorer",
|
||||
"name": "Explorer",
|
||||
"role": "scout",
|
||||
"description": "Gathers intelligence and explores opportunities. Monitors upstream, identifies capabilities, discovers anomalies.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:explorer",
|
||||
"capabilities": [
|
||||
"upstream_monitoring",
|
||||
"capability_discovery",
|
||||
"anomaly_detection",
|
||||
"opportunity_identification",
|
||||
"intel_gathering"
|
||||
],
|
||||
"skills": [
|
||||
"curiosity-engine",
|
||||
"upstream-monitor",
|
||||
"gap-detector"
|
||||
],
|
||||
"parameters": {
|
||||
"scan_interval": 300,
|
||||
"min_confidence": 0.7,
|
||||
"exploration_depth": "broad"
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "explorer",
|
||||
"AGENT_ROLE": "scout",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "sentinel",
|
||||
"name": "Sentinel",
|
||||
"role": "guardian",
|
||||
"description": "Protects collective safety and integrity. Reviews proposals for concerns, enforces security policies, advocates for caution.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:sentinel",
|
||||
"capabilities": [
|
||||
"safety_review",
|
||||
"security_enforcement",
|
||||
"concern_raising",
|
||||
"veto_recommendation",
|
||||
"policy_enforcement"
|
||||
],
|
||||
"skills": [
|
||||
"governance-modules",
|
||||
"detect-corruption",
|
||||
"triad-signal-filter"
|
||||
],
|
||||
"parameters": {
|
||||
"safety_threshold": 0.8,
|
||||
"can_raise_concerns": true,
|
||||
"can_recommend_veto": true,
|
||||
"review_depth": "thorough"
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "sentinel",
|
||||
"AGENT_ROLE": "guardian",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "coder",
|
||||
"name": "Coder",
|
||||
"role": "artisan",
|
||||
"description": "Implements solutions and writes code. Executes approved proposals, maintains codebase, ensures quality.",
|
||||
"model": "llama3.1",
|
||||
"session": "agent:heretek:coder",
|
||||
"capabilities": [
|
||||
"code_implementation",
|
||||
"code_review",
|
||||
"testing",
|
||||
"deployment",
|
||||
"rollback_capability"
|
||||
],
|
||||
"skills": [
|
||||
"triad-sync-protocol",
|
||||
"self-improver"
|
||||
],
|
||||
"parameters": {
|
||||
"auto_test": true,
|
||||
"code_review_required": true,
|
||||
"deployment_strategy": "blue_green"
|
||||
},
|
||||
"environment": {
|
||||
"AGENT_NAME": "coder",
|
||||
"AGENT_ROLE": "artisan",
|
||||
"LITELLM_HOST": "${LITELLM_HOST}",
|
||||
"LITELLM_API_KEY": "${LITELLM_MASTER_KEY}"
|
||||
}
|
||||
}
|
||||
],
|
||||
"governance": {
|
||||
"consensus_threshold": 0.66,
|
||||
"triad_vote_required": true,
|
||||
"sentinel_review_required": true,
|
||||
"examiner_challenge_period": 60,
|
||||
"proposal_timeout": 600,
|
||||
"inviolable_parameters": [
|
||||
"consensus_threshold",
|
||||
"can_veto",
|
||||
"safety_threshold"
|
||||
]
|
||||
},
|
||||
"communication": {
|
||||
"protocol": "A2A",
|
||||
"version": "1.0",
|
||||
"gateway": "${LITELLM_HOST}",
|
||||
"endpoints": {
|
||||
"send_message": "/v1/agents/{agent_name}/send",
|
||||
"receive_message": "/v1/agents/{agent_name}/receive",
|
||||
"health": "/health",
|
||||
"models": "/v1/models"
|
||||
},
|
||||
"session_persistence": "redis",
|
||||
"session_ttl": 86400
|
||||
},
|
||||
"storage": {
|
||||
"postgres": {
|
||||
"host": "postgres",
|
||||
"port": 5432,
|
||||
"database": "heretek",
|
||||
"pgvector": true
|
||||
},
|
||||
"redis": {
|
||||
"host": "redis",
|
||||
"port": 6379,
|
||||
"caching": true,
|
||||
"rate_limiting": true
|
||||
}
|
||||
},
|
||||
"backup": {
|
||||
"strategy": "per_agent_branch",
|
||||
"schedule": "daily",
|
||||
"retention_days": 7,
|
||||
"agents": {
|
||||
"steward": "backup-steward",
|
||||
"alpha": "backup-alpha",
|
||||
"beta": "backup-beta",
|
||||
"charlie": "backup-charlie",
|
||||
"examiner": "backup-examiner",
|
||||
"explorer": "backup-explorer",
|
||||
"sentinel": "backup-sentinel",
|
||||
"coder": "backup-coder"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
#!/bin/bash
|
||||
# ==============================================================================
|
||||
# Heretek OpenClaw — Health Check Script
|
||||
# ==============================================================================
|
||||
# Verifies all infrastructure services are running and responding
|
||||
#
|
||||
# Usage:
|
||||
# ./health-check.sh # Check all services
|
||||
# ./health-check.sh litellm # Check specific service
|
||||
# ./health-check.sh --watch # Continuous monitoring
|
||||
# ==============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Service endpoints
|
||||
LITELLM_HOST="${LITELLM_HOST:-http://localhost:4000}"
|
||||
POSTGRES_HOST="${POSTGRES_HOST:-localhost}"
|
||||
REDIS_HOST="${REDIS_HOST:-localhost}"
|
||||
REDIS_PORT="${REDIS_PORT:-6379}"
|
||||
|
||||
# ==============================================================================
|
||||
# Functions
|
||||
# ==============================================================================
|
||||
|
||||
print_header() {
|
||||
echo "=============================================="
|
||||
echo " Heretek OpenClaw — Health Check"
|
||||
echo "=============================================="
|
||||
echo ""
|
||||
}
|
||||
|
||||
check_litellm() {
|
||||
echo -n "Checking LiteLLM Gateway... "
|
||||
|
||||
if curl -sf --connect-timeout 5 "$LITELLM_HOST/health" > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
|
||||
# Get LiteLLM version
|
||||
version=$(curl -s "$LITELLM_HOST/health" 2>/dev/null | grep -o '"version":"[^"]*"' | cut -d'"' -f4 || echo "unknown")
|
||||
echo " Version: $version"
|
||||
|
||||
# Check models endpoint
|
||||
models=$(curl -s "$LITELLM_HOST/v1/models" 2>/dev/null | grep -o '"id":"[^"]*"' | wc -l || echo "0")
|
||||
echo " Available models: $models"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_postgres() {
|
||||
echo -n "Checking PostgreSQL... "
|
||||
|
||||
if pg_isready -h "$POSTGRES_HOST" -p 5432 -U heretek > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
|
||||
# Check pgvector extension
|
||||
vector_ext=$(psql -h "$POSTGRES_HOST" -p 5432 -U heretek -d heretek -t -c "SELECT 1 FROM pg_extension WHERE extname='vector';" 2>/dev/null || echo "")
|
||||
if [ "$vector_ext" = "1" ]; then
|
||||
echo " pgvector: ${GREEN}enabled${NC}"
|
||||
else
|
||||
echo " pgvector: ${YELLOW}not installed${NC}"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_redis() {
|
||||
echo -n "Checking Redis... "
|
||||
|
||||
if redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" ping > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
|
||||
# Get Redis info
|
||||
info=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" info server 2>/dev/null | grep "redis_version" | cut -d: -f2 | tr -d '\r' || echo "unknown")
|
||||
echo " Version: $info"
|
||||
|
||||
# Check memory usage
|
||||
mem=$(redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" info memory 2>/dev/null | grep "used_memory_human" | cut -d: -f2 | tr -d '\r' || echo "unknown")
|
||||
echo " Memory: $mem"
|
||||
return 0
|
||||
else
|
||||
echo -e "${RED}✗ FAILED${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_docker() {
|
||||
echo -n "Checking Docker containers... "
|
||||
|
||||
containers=$(docker ps --filter "name=heretek-" --format "{{.Names}}" 2>/dev/null | wc -l || echo "0")
|
||||
|
||||
if [ "$containers" -gt 0 ]; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
echo " Running containers: $containers"
|
||||
docker ps --filter "name=heretek-" --format " • {{.Names}} ({{.Status}})" 2>/dev/null
|
||||
return 0
|
||||
else
|
||||
echo -e "${YELLOW}⚠ No containers running${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_a2a_agents() {
|
||||
echo -n "Checking A2A Agents... "
|
||||
|
||||
if curl -sf --connect-timeout 5 -H "Authorization: Bearer ${LITELLM_MASTER_KEY:-heretek-master-key-change-me}" \
|
||||
"$LITELLM_HOST/v1/agents" > /dev/null 2>&1; then
|
||||
echo -e "${GREEN}✓ OK${NC}"
|
||||
|
||||
# Get agent list
|
||||
agents=$(curl -s -H "Authorization: Bearer ${LITELLM_MASTER_KEY:-heretek-master-key-change-me}" \
|
||||
"$LITELLM_HOST/v1/agents" 2>/dev/null | grep -o '"agent_name":"[^"]*"' | cut -d'"' -f4 | tr '\n' ' ' || echo "")
|
||||
|
||||
if [ -n "$agents" ]; then
|
||||
echo " Registered agents: $agents"
|
||||
else
|
||||
echo " No agents registered yet"
|
||||
fi
|
||||
return 0
|
||||
else
|
||||
echo -e "${YELLOW}⚠ A2A endpoint not available${NC}"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
print_summary() {
|
||||
local status=$1
|
||||
echo ""
|
||||
echo "=============================================="
|
||||
if [ $status -eq 0 ]; then
|
||||
echo -e " ${GREEN}All services healthy!${NC}"
|
||||
else
|
||||
echo -e " ${RED}Some services failed${NC}"
|
||||
fi
|
||||
echo "=============================================="
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# Main
|
||||
# ==============================================================================
|
||||
|
||||
main() {
|
||||
local service="$1"
|
||||
local watch=false
|
||||
local failed=0
|
||||
|
||||
# Parse arguments
|
||||
if [ "$1" = "--watch" ]; then
|
||||
watch=true
|
||||
shift
|
||||
fi
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
service="$1"
|
||||
fi
|
||||
|
||||
if [ "$watch" = true ]; then
|
||||
echo "Watching services (Ctrl+C to exit)... "
|
||||
echo ""
|
||||
while true; do
|
||||
print_header
|
||||
failed=0
|
||||
|
||||
check_litellm || failed=1
|
||||
check_postgres || failed=1
|
||||
check_redis || failed=1
|
||||
check_docker || failed=1
|
||||
check_a2a_agents || failed=1
|
||||
|
||||
print_summary $failed
|
||||
sleep 30
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
print_header
|
||||
|
||||
# Run selected checks
|
||||
case "$service" in
|
||||
litellm)
|
||||
check_litellm
|
||||
failed=$?
|
||||
;;
|
||||
postgres)
|
||||
check_postgres
|
||||
failed=$?
|
||||
;;
|
||||
redis)
|
||||
check_redis
|
||||
failed=$?
|
||||
;;
|
||||
docker)
|
||||
check_docker
|
||||
failed=$?
|
||||
;;
|
||||
a2a|agents)
|
||||
check_a2a_agents
|
||||
failed=$?
|
||||
;;
|
||||
all|"")
|
||||
check_litellm || failed=1
|
||||
check_postgres || failed=1
|
||||
check_redis || failed=1
|
||||
check_docker || failed=1
|
||||
check_a2a_agents || failed=1
|
||||
;;
|
||||
*)
|
||||
echo "Unknown service: $service"
|
||||
echo "Available: litellm, postgres, redis, docker, a2a, all"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
print_summary $failed
|
||||
exit $failed
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in New Issue
Block a user