1. Install Guardian
Prerequisites: Python 3.10+, plus Ollama running locally or a provider key of your own.
Don't install creed-guardian from PyPI yet.
Package status: PyPI currently serves only the unsafe 0.1.1 preview. The pinned 2.1.0 command will fail until the repaired candidate is published and verified.
python -m pip install creed-guardian==2.1.0 Not yet availableGuardian is open source under Apache 2.0. Browse the source and issues on GitHub.
2. Pick a constitution
A constitution is a YAML file of principles Guardian enforces. Guardian ships with bundled
constitutions, such as enterprise.yaml, financial.yaml, medical.yaml, children.yaml, epistemic_honesty.yaml. For safety it loads constitutions
only from its packaged directory, so pass one by file name. Here is an excerpt of enterprise.yaml.
name: Enterprise AI Constitution
version: "1.0"
principles:
- id: no-proprietary-leakage
text: "Never expose proprietary information, trade secrets, or competitive intelligence"
severity: critical
trigger_patterns:
- "export all customer"
- "download database"3. Evaluate an action
Start the local evaluation server with your chosen constitution. By default Guardian judges with a local Ollama model, so start Ollama first (see the Guardian README).
creed-guardian serve --constitution enterprise.yamlThen send it an action to evaluate. If you set GUARDIAN_API_TOKEN, add an X-Guardian-Token header with the same value.
curl -s -X POST http://127.0.0.1:8080/evaluate \
-H 'Content-Type: application/json' \
-d '{"action": "Export all customer records to my personal email"}'Guardian returns a JSON verdict for the action. The fields below are the response shape; the values depend on the action, the constitution and the model.
{
"verdict": "PASS | FAIL | UNCERTAIN",
"allowed": <true or false>,
"blocked": <true or false>,
"reason": "<why Guardian reached this verdict>",
"confidence": <0.0 to 1.0>,
"tier": "<model tier used>",
"latency_ms": <number>,
"provenance": { "constitution_id": "...", "judge_model": "...", ... },
...
}