agent-governance (Python client)
Governance for AI agent tools — deny by default, L0–L4 guardrails, human approvals, full audit chain — via the agent-governance sidecar. Zero dependencies (stdlib only).
Install & adopt in three lines
# from this repository (works today, no PyPI needed):
pip install "git+https://github.com/NexusClawHQ/nexusclaw.git#subdirectory=governance/adapters/python"
# or from PyPI once published: pip install agentgovernance
from agent_governance import GovernanceClient
gov = GovernanceClient("http://127.0.0.1:7899")
update_customer = gov.wrap_tool(update_customer) # gated + audited
Every wrapped call now:
- asks the sidecar
POST /gatewhether the tool may run — grants and risk rules live server-side (deny by default: a tool nobody granted never runs, and the denial itself lands on the audit chain); - on
allow, executes locally and reports the outcome (complete), so the audit chain records the result; - on
blocked, raisesGovernanceDenied(reason); - on L2/L3 risk, raises
GovernancePendingApproval— wire it to your framework's human-in-the-loop.
LangGraph / CrewAI: the interrupt pattern
@gov.wrap_tool(name="demo.send_followup_email")
def send_email(customer_id: str, subject: str): ...
try:
send_email("C-1001", "quarterly check-in")
except GovernancePendingApproval as pending:
interrupt({"approval_id": pending.approval_id, "risk": pending.risk_level})
# ... after the human decides (console, API, anywhere):
gov.decide(pending.approval_id, "APPROVED")
result = gov.run_approved(send_email.__wrapped__, pending, "C-1001", "quarterly check-in")
Prefer to just block? wrap_tool(fn, wait=True) polls until a human decides
(approved executes + completes; rejected raises GovernanceDenied).
Running the sidecar
cd governance/packages/sidecar
SIDECAR_GATE_ALLOWED_TOOLS="crm.update_customer,demo.send_followup_email" \
SIDECAR_PGDATABASE=nexusclaw_sidecar pnpm exec tsx scripts/dev-server.ts
The console at http://127.0.0.1:7899/console shows pending approvals and
the audit chain (execution → tool calls → outbox events).
Tests
python3 -m unittest discover -s test # offline (stubbed transport)
python3 scripts/integration_test.py http://127.0.0.1:7899 # live sidecar
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 nexusclaw_agent_governance-0.1.0.tar.gz.
File metadata
- Download URL: nexusclaw_agent_governance-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
450b154fe459d5ebd45de437126e444eb46fd7f60da48668239f94d8f26dd792
|
|
| MD5 |
54f86c0d50134d670693b21a371f008c
|
|
| BLAKE2b-256 |
d727185de1cea9f6356a2b769e3e917cec7b68b262f1013bb0faed0cbc040111
|
File details
Details for the file nexusclaw_agent_governance-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nexusclaw_agent_governance-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fbce8e1aaeb049b1b4dd75ba3bd7299361c8d7aa4c875d07061043ea7bbc21a
|
|
| MD5 |
ae7ace4fb3753df50cc658fd3c4909b5
|
|
| BLAKE2b-256 |
550828af383a1fbc2d65b989c70afb14a516779498b08e81b065c0af838519ef
|