Python client for the AI Runtime Governor – runtime AI-agent governance service
Project description
airg-client
Python client for the AI Runtime 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 airg-client
Quick start
from governor_client import evaluate_action, GovernorBlockedError
import governor_client
# Set your API key (or export GOVERNOR_API_KEY in your environment)
governor_client.GOVERNOR_API_KEY = "airg_your_key_here"
governor_client.GOVERNOR_URL = "https://ai-runtime-governor.fly.dev"
# 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 |
GOVERNOR_API_KEY |
(empty) | API key (airg_…) sent as X-API-Key header |
You can also set them programmatically:
import governor_client
governor_client.GOVERNOR_URL = "https://ai-runtime-governor.fly.dev"
governor_client.GOVERNOR_API_KEY = "airg_your_key_here"
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.
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 airg_client-0.3.0.tar.gz.
File metadata
- Download URL: airg_client-0.3.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cd7ed1b822f5cb7a2bec1b9417a83c86ce9b08ab5aeb7a51e557e3be3407122
|
|
| MD5 |
df40f4c92fd72d28f9d5f496d7ae6f4b
|
|
| BLAKE2b-256 |
b7535263f2621fa167248a1674d8d49c7cf2e7a4aeaf90f275c5c16bed072e49
|
File details
Details for the file airg_client-0.3.0-py3-none-any.whl.
File metadata
- Download URL: airg_client-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0ce963651353e0bf03ed0bdf366f40857d459109c8aff67ff4f33363ae91eb5
|
|
| MD5 |
73dab9b87def66ece7659f5d129e8c38
|
|
| BLAKE2b-256 |
645161036b81f94137de9de5b229e93bac7a6ed58ba9b7f08b5c8a02a5c39480
|