enforra
Local-first Python SDK for Enforra OSS.
Install
From this repository:
python3 -m pip install -e ".[dev]"
Usage
from enforra import EnforraClient
client = EnforraClient(
policy_path="policies/starter/support-agent.yaml",
audit_path=".enforra/audit.jsonl",
agent="support-agent",
)
result = client.run_tool(
tool_name="stripe.refund",
args={"amount": 75, "customer_id": "cus_123"},
handler=lambda: {"refund_id": "ref_123", "status": "succeeded"},
context={"environment": "production"},
)
Features
- Load local YAML policies with
version: 1 - Evaluate
allow,block,require_approval, andlog_only - Support observe mode via
mode: observeorobserve_only: true - Write local JSONL audit events with redacted args and context
- Provide a sync, typed
EnforraClient.run_tool(...)API
Supported Policy Fields
versionmodeobserve_onlydefaults.decisionpolicies[].idpolicies[].prioritypolicies[].match.agentpolicies[].match.toolpolicies[].decisionpolicies[].conditions
Supported Condition Operators
eqneqgtgteltltecontainsnot_contains
Conditions can be expressed as:
- A flat list where every condition must pass
allgroupsanygroups- Combined
allandanygroups
Observe Mode
In observe mode, matched block and require_approval decisions are shadowed to an effective
decision of allow. The audit log includes:
enforcement_modeobserved_decisioneffective_decisionshadowobserve_mode
Development
python3 -m pytest
Metadata
Release files for enforra 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| enforra-0.1.0.tar.gz | 13.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| enforra-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.7 kB
Release files / enforra-0.1.0.tar.gz
| Download URL | enforra-0.1.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8edb29ee5a322b7bddbdde2b7e8b056dad16328d2e07a80871d742a45d0cdad8
|
|
BLAKE2b-256 checksum How to use checksums |
444c66f37a0e59d42949f5f87671695b04baeb68ef358d9add2da5ea8f34efd9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.10
|
Release files / enforra-0.1.0-py3-none-any.whl
| Download URL | enforra-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5daf119a9d70934c995b1b9614f6f118d401b0eebf600f3283959fb83da7da5a
|
|
BLAKE2b-256 checksum How to use checksums |
d639b1d86958013c960dd409110672d17cac18c978fc9f165fef16e898b63a5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.10
|