Quickstart

Get started with Guardian

Install Guardian, pick a constitution, and evaluate an action. Three steps to values-aligned deployment.

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 available

Guardian 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.

enterprise.yaml (excerpt)
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).

Terminal 1
creed-guardian serve --constitution enterprise.yaml

Then send it an action to evaluate. If you set GUARDIAN_API_TOKEN, add an X-Guardian-Token header with the same value.

Terminal 2
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.

Response shape (abbreviated)
{
  "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": "...", ... },
  ...
}

Next steps