Policy engine for governing AI agent tool execution.
Project description
GuardianAngel
A lightweight Python SDK for governing AI agent tool execution.
GuardianAngel intercepts agent actions, evaluates policy, and decides whether they should be allowed, denied, or require approval — before the tool runs.
Why
Autonomous AI agents can call tools — merge PRs, delete branches, send messages, deploy services. GuardianAngel gives you deterministic, policy-based control over what agents are allowed to do.
Install
pip install guardian-angel
Quickstart
from guardian_angel import GuardianAngel, ActionRequest, Rule, DENY
guard = GuardianAngel(rules=[
Rule(
name="block_sensitive_action",
tool="resource.delete",
decision=DENY,
attributes={"risk_level": "high"},
),
])
decision = guard.authorize(
ActionRequest(
tool="resource.delete",
attributes={"risk_level": "high"},
)
)
print(decision.status)
# deny
YAML Policy
Define rules in a YAML file:
# policy.yaml
rules:
- name: block_sensitive_action
tool: resource.delete
attributes:
risk_level: high
decision: deny
Load and evaluate:
from guardian_angel import GuardianAngel, ActionRequest
guard = GuardianAngel.from_yaml("policy.yaml")
decision = guard.authorize(
ActionRequest(tool="resource.delete", attributes={"risk_level": "high"})
)
print(decision.status) # "deny"
Tool Decorator
Wrap Python functions to enforce policy automatically:
guard = GuardianAngel.from_yaml("policy.yaml")
@guard.tool(name="resource.delete")
def delete_resource(resource_id: str, *, attributes: dict | None = None):
return {"deleted": True, "resource_id": resource_id}
# This raises PolicyDeniedError if policy blocks it.
# Otherwise the function executes normally.
delete_resource("doc-123", attributes={"risk_level": "high"})
How It Works
Agent tool call
↓
ActionRequest
↓
GuardianAngel.authorize(request)
↓
Decision (allow / deny / require_approval)
Rules are evaluated top to bottom, first match wins. If no rule matches, the default decision is allow.
Roadmap
- v0.1 — Local policy evaluation, YAML rules, decorator (current)
- v0.2 — Richer identity / resource models, better validation
- v0.3 —
guardian-angel simulateCLI, policy testing - v0.4 — Lightweight framework adapters (LangGraph, OpenAI, CrewAI)
- v0.5+ — Remote policy sources, audit sinks, approval stores
License
MIT
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 guardian_angel-0.1.0.tar.gz.
File metadata
- Download URL: guardian_angel-0.1.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dd458f2c0873ccabd27c9ff8212a9857e16093e3fbb3b66005050f594ba4836
|
|
| MD5 |
c10d850198162f2f8a217c7de79a5a38
|
|
| BLAKE2b-256 |
78deee080d533e7679aba4015b562025ccaf138d50068e0961f00445d2ee3152
|
File details
Details for the file guardian_angel-0.1.0-py3-none-any.whl.
File metadata
- Download URL: guardian_angel-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
377a5a56e7f4f5d404ab05262c7fcc4bacf34f14147b4c1ce368fafb62cc2898
|
|
| MD5 |
209d7ef8aff9957182b5e4b983eced07
|
|
| BLAKE2b-256 |
1c27f466ca4ab5e803af5a1f6594f125c13b0a733884bd53c874fb22fbf7029f
|