Local AI safety for any device. Free forever.
Project description
Creed Guardian
Local AI safety for any device. Free forever.
Creed Guardian is a lightweight AI safety layer that evaluates agent actions locally before execution. It uses Ollama-powered models to catch unsafe actions without cloud dependencies, API costs, or data egress.
Quick Start
# Install Guardian
pip install creed-guardian
# Install Ollama (required)
# macOS: brew install ollama
# Linux: curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama
ollama serve
from creed_guardian import Guardian
guardian = Guardian() # Auto-selects best model for your hardware
result = guardian.check(
action="Delete all files in /home",
context="User said: clean up my downloads"
)
if result.allowed:
execute_action()
else:
print(f"Blocked: {result.reason}")
Features
- Offline-first: Works without internet
- Privacy-preserving: Data never leaves your device
- Zero marginal cost: No API fees for local evaluation
- Fail-safe: Blocks on uncertainty (configurable)
- Auto-scaling: Selects optimal model for your hardware
Model Tiers
Guardian automatically selects the best model based on available RAM:
| Tier | Model | Size | RAM | Accuracy | Use Case |
|---|---|---|---|---|---|
| 1.5b | qwen2.5:1.5b | ~1GB | 2GB | 60% (100% recall) | IoT, embedded |
| 3b | qwen2.5:3b | ~2GB | 4GB | 72% | Tablets, light laptops |
| 7b | qwen2.5:7b | ~5GB | 8GB | 82% | Laptops, dev machines |
| 14b | qwen2.5:14b | ~9GB | 12GB | 91% | Servers, workstations |
| 32b | qwen2.5:32b | ~19GB | 20GB | 91% | High-security |
All tiers should typically catch 100% of obvious safety violations (100% recall). Higher tiers reduce false positives.
Usage
Basic Check
from creed_guardian import Guardian
guardian = Guardian()
# Check an action
result = guardian.check(
action="Send email to user@example.com",
context="User requested password reset"
)
print(result.verdict) # PASS | FAIL | UNCERTAIN
print(result.reason) # Human-readable explanation
print(result.latency_ms) # Evaluation time
Synchronous API
# For non-async code
result = guardian.check_sync(action="test action")
Decorator Protection
@guardian.protect
async def delete_files(path: str):
"""This function is protected by Guardian."""
os.rmdir(path)
# Raises PermissionError if Guardian blocks
await delete_files("/tmp/data")
Custom Principles
result = guardian.check(
action="Post message to social media",
context="Marketing campaign",
principle="Never post without explicit user approval"
)
Explicit Tier Selection
# Force a specific tier
guardian = Guardian(tier="7b") # Use 7B model
# Available: "auto", "1.5b", "3b", "7b", "14b", "32b"
Async Context Manager
async with Guardian() as guardian:
result = await guardian.check(action="test")
# Automatically closes when done
Configuration
Guardian(
tier="auto", # Model tier (auto-selects based on RAM)
ollama_url="http://localhost:11434", # Ollama server URL
fail_closed=True, # Block uncertain cases (default: True)
auto_download=True, # Download model if not available
evaluation_timeout=30.0, # Timeout in seconds
)
Response Object
@dataclass
class GuardianResult:
verdict: Literal["PASS", "FAIL", "UNCERTAIN"]
allowed: bool # True if PASS
blocked: bool # True if FAIL
uncertain: bool # True if UNCERTAIN
reason: str # Human-readable explanation
confidence: float # 0.0-1.0
source: str # "pattern" | "local" | "cloud"
tier: str # Model tier used
latency_ms: float # Evaluation time
Requirements
- Python 3.9+
- Ollama running locally
- 2GB+ RAM (4GB+ recommended)
Need More?
Creed Guardian is free forever for local evaluation.
For cloud features (escalation, fleet management, custom constitutions), check out Creed Space:
| Feature | Guardian (Free) | Creed Space |
|---|---|---|
| Local evaluation | Unlimited | Unlimited |
| All model tiers | Yes | Yes |
| Cloud escalation | - | Yes |
| Custom constitutions | - | Yes |
| Fleet dashboard | - | Yes |
| Analytics | - | Yes |
Links
License
MIT License - see LICENSE for details.
Built by Creed Space - AI safety infrastructure for the real world.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file creed_guardian-0.1.0.tar.gz.
File metadata
- Download URL: creed_guardian-0.1.0.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
addce969bc473af7832fa69dfb883d4d93ae5233e1385f59efe04a2c251add93
|
|
| MD5 |
61cb385f4215ad0faa9068e1c0188bfa
|
|
| BLAKE2b-256 |
b379a96857a519284c5b7feea06e0aa4d0fa4b9c26e7e24342f3a791d6e1bf73
|
File details
Details for the file creed_guardian-0.1.0-py3-none-any.whl.
File metadata
- Download URL: creed_guardian-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0951cd8a4895f572daaa856b532a52506f6dbe2948eef9dca937e96af7205c7a
|
|
| MD5 |
d8e25272cf57c0a83260bd618b1a3c06
|
|
| BLAKE2b-256 |
be91e70957cbca3ec150b20b4fe190dcc4ada83400771d42045172d541057900
|