Quickstart
Deploy Universal Guardrail on your infrastructure in under 5 minutes.
Data stays on your infra
Universal Guardrail runs entirely within your environment. No prompt data, user inputs, or audit logs are ever sent to our servers.
Prerequisites
- โ Docker Engine 20.10+
- โ Docker Compose v2+
- โ 2 vCPU / 4 GB RAM minimum (8 GB recommended for semantic model)
- โ Your Universal Guardrail license key (set as env var)
Install
Pull the Docker image using your license key and start the stack.
# Pull the latest image (requires your license key as registry token) docker login ghcr.io -u LICENSE -p YOUR_LICENSE_KEY docker pull ghcr.io/universal-guardrail/guardrail:latest # Or clone for self-build: git clone https://github.com/SimilePlease/UniversalGuardRail.git cd universal-guardrail
# Start the full stack (API + Dashboard) GUARDRAIL_API_KEYS=your-api-key docker-compose up -d
The guardrail API will be available at
http://localhost:8000 and the SOC dashboard at http://localhost:5173.
Configure
Edit guard_config.yaml to match your use case. The container
hot-reloads config changes without restart.
# guard_config.yaml โ minimal production config
global:
active_industry: finance # finance | healthcare | general
deployment_mode: active # active | passive (log-only)
audit_log_path: logs/compliance_audit.jsonl
rbac:
enabled: true
roles:
admin:
allow_finance: true
user:
allow_finance: false
semantic_rails:
enabled: true
banned_topics:
- hack
- exploit credentials
- bypass firewall
similarity_threshold: 0.45 # 0.0โ1.0. Lower = stricter.
input_rails:
pii_redaction:
enabled: true # Redacts email, phone, CC, SSN
See the full Configuration Reference for every option.
Integrate
Route your existing AI application through the guardrail API. Works as a drop-in proxy โ no SDK required.
import requests
GUARDRAIL_URL = "http://localhost:8000"
API_KEY = "your-api-key"
def safe_llm_call(user_prompt: str, user_role: str = "user"):
"""Drop-in wrapper that validates before and after LLM call."""
response = requests.post(
f"{GUARDRAIL_URL}/api/chat",
json={
"prompt": user_prompt,
"role": user_role, # Maps to your RBAC roles
"history": []
},
headers={"x-api-key": API_KEY}
)
result = response.json()
if not result["allowed"]:
# Guardrail blocked โ return the safe response
return result["response"]
return result["response"] # LLM response, validated
# Usage โ identical to calling OpenAI directly
reply = safe_llm_call("Explain our refund policy", "user")
What happens under the hood:
- Your prompt is validated through Input Rails (injection, PII, semantic, RBAC)
- If allowed, it's forwarded to your configured upstream LLM
- The LLM response is validated through Output Rails (hallucination, code safety, canary leak)
- The clean response is returned to your app โ all events logged to SQLite
Monitor
Open the SOC Dashboard to view real-time threat telemetry.
SOC Dashboard
Real-time WebSocket threat feed, block rate charts, top offenders.
http://localhost:5173
Analytics API
JSON endpoint for 24h threat summary, cost savings, trend data.
GET /api/analytics
# Pull 24h analytics snapshot
curl -H "x-api-key: your-api-key" \
http://localhost:8000/api/analytics
# Example response:
# { "allowed": 1823, "blocked": 47, "flagged": 12,
# "avg_latency_ms": 38.4, "cost_saved_usd": 0.021 }