Hexarch Guardrails

Hexarch Guardrails is a lightweight, policy‑driven Python library for enforcing safety rules before a function runs. It is designed to stop destructive or expensive operations at the function boundary, with decisions recorded to an audit log for later review.

What it is (and what it isn’t)

It is:

It is not:

Core Capabilities

Install

pip install hexarch-guardrails==0.4.6b1
# Optional extras
pip install "hexarch-guardrails[cli,postgres]==0.4.6b1"

Minimal Example

from hexarch_guardrails import Guardian
from hexarch_guardrails.exceptions import PolicyViolation

guardian = Guardian()  # loads hexarch.yaml

@guardian.check("safe_delete")
def delete_user(user_id):
    print(f"Deleted user {user_id}")

try:
    delete_user("user_123")
except PolicyViolation as e:
    print(f"Blocked: {e}")

Auditing & Proof

Every policy decision is written to a decision ledger (decisions.db for SQLite, or Postgres in production). This record is your evidence trail for:

Note: you may see the package mirrored on other indexes (e.g., piwheels), but PyPI is the canonical source.