openclaw-governor-client
Python client for the OpenClaw Governor – a runtime governance layer for AI agents.
The Governor evaluates every tool invocation against configurable policies and returns an allow / block / review decision before the tool executes.
Installation
pip install openclaw-governor-client
Quick start
from governor_client import evaluate_action, GovernorBlockedError
# Evaluate a tool call against the Governor
try:
decision = evaluate_action(
tool="shell_exec",
args={"command": "ls -la /tmp"},
context={"session_id": "abc-123"},
)
print(decision["decision"]) # "allow" | "review"
print(decision["risk_score"]) # 0.0 – 1.0
print(decision["explanation"])
except GovernorBlockedError as e:
print(f"Blocked: {e}")
Configuration
| Environment variable | Default | Description |
|---|---|---|
GOVERNOR_URL |
http://localhost:8000 |
Base URL of the Governor service |
You can also pass the URL programmatically:
import governor_client
governor_client.GOVERNOR_URL = "https://openclaw-governor.fly.dev"
API
evaluate_action(tool, args, context=None) → dict
Send a tool call to the Governor for evaluation.
Returns the full decision dict:
{
"decision": "allow", # "allow" | "block" | "review"
"risk_score": 0.15,
"explanation": "Low-risk read operation",
"policy_ids": ["shell-guard"],
"modified_args": None,
}
Raises GovernorBlockedError if the decision is "block".
governed_call(tool, args, context=None) → dict
Convenience wrapper around evaluate_action. Identical behaviour — callers
should inspect decision for "review" and handle accordingly.
GovernorBlockedError
Exception raised when the Governor blocks a tool invocation. Subclass of
RuntimeError.
Requirements
- Python ≥ 3.9
- httpx ≥ 0.24.0
License
MIT — see LICENSE.
Metadata
Release files for openclaw-governor-client 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| openclaw_governor_client-0.2.0.tar.gz | 3.8 kB | Without provenance | Details for openclaw_governor_client-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openclaw_governor_client-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for openclaw_governor_client-0.2.0-py3-none-any.whl |
Total release size: 8.0 kB
Release files / openclaw_governor_client-0.2.0.tar.gz
| Download URL | openclaw_governor_client-0.2.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c74963e2c32639840c3b7d6008e5de39c2604ba58b5dd9b759a6193e776ebe5f
|
|
BLAKE2b-256 checksum How to use checksums |
5e1774105d9b51e516bbe5152ade10625aae357429f130adb02d39d1452741da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / openclaw_governor_client-0.2.0-py3-none-any.whl
| Download URL | openclaw_governor_client-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7dc16d9c9be7aa7893e42893f4d3cda0145ec8963c032925a62908b17ec4f9d3
|
|
BLAKE2b-256 checksum How to use checksums |
556c98a01ac4aabf44cf7cecf5e199c4852d98a725d223a3ed899382b66493fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Security for openclaw-governor-client 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.