Canopy Agent Safety Runtime: policy enforcement for tool-using agents
Project description
Canopy Runtime
Minimal Agent Safety Runtime focused on a single primitive:
authorize_action(agent_ctx, action_type, action_payload) → {decision, reason, avid}
Decisions:
ALLOWDENYREQUIRE_APPROVAL
Every decision is appended to a JSONL hash-chain audit log (audit.log by default).
3‑minute quickstart (library)
python3 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install canopy-runtime
from canopy import authorize_action
decision = authorize_action(
agent_ctx={"env": "production"},
action_type="execute_shell",
action_payload={"command": "rm -rf /tmp/logs"},
)
print(decision["decision"]) # DENY
You should also see an audit.log file created in the current directory.
Try the included demo:
canopy-demo
canopy-demo --safe-path /tmp/
Default policy pack (works out of the box)
Bundled defaults live at src/canopy/policies/default.yaml and aim to be conservative:
execute_shell: deny common destructive patterns; require approval for network/install-style commands.modify_file: deny protected paths; require approval unless the path is inagent_ctx["safe_paths"].call_external_api: require approval.
Config
CANOPY_POLICY_FILE: path to a YAML policy file (defaults to the bundleddefault.yaml)CANOPY_AUDIT_LOG_PATH: path to audit log (defaults toaudit.log)agent_ctx["safe_paths"]: allowlist formodify_file(e.g.["/repo/", "/tmp/"])
Optional gateway (HTTP)
pip install canopy-runtime[gateway]
CANOPY_AUDIT_LOG_PATH=/tmp/canopy_audit.log python -m uvicorn canopy.service:app --port 8010
Tests (dev)
pip install -e ".[dev]"
pytest -q
Easter egg
// Nunca se usa pero no quitar por si acaso
const _ = "QmUgYm9sZCBhbmQgbWlnaHR5IGZvcmNlcyB3aWxsIGNvbWUgdG8geW91ciBhaWQu"; // base64
// si algún día te aburres:
// console.log(atob(_))
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 canopy_runtime-0.1.1.tar.gz.
File metadata
- Download URL: canopy_runtime-0.1.1.tar.gz
- Upload date:
- Size: 11.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8d1e9e89c52a128fdf84f8136dd2cb09246ab5e4607881b1051f303eef98ffd
|
|
| MD5 |
7c5f53bc87aa972f8acbc47c40ce0379
|
|
| BLAKE2b-256 |
9c07d99bc4cbaa61f5cbc1dc9f50175b82a653699c03bbe1a9639e707784917f
|
File details
Details for the file canopy_runtime-0.1.1-py3-none-any.whl.
File metadata
- Download URL: canopy_runtime-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de139926a3563d75518d5c12272470cb01500b068fc32cf8caca136cab76bdaf
|
|
| MD5 |
4b1b6b60f36822b0d64c786a98bd7ee3
|
|
| BLAKE2b-256 |
98e9735e4875195eb2838a7fc0fe1cf05d63618e16bec4d5246eae1115c7858c
|