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 airg import AIRG
client = AIRG()
decision = client.evaluate(
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"])
Configuration
| Environment variable | Description |
|---|---|
GOVERNOR_URL |
Base URL of the Governor service |
GOVERNOR_API_KEY |
API key (airg_…) |
Or pass them explicitly:
client = AIRG(api_key="airg_...", base_url="https://...")
API
AIRG(*, api_key=None, base_url=None, timeout=10.0)
Create a client. Reads GOVERNOR_API_KEY and GOVERNOR_URL from
environment variables when not provided.
client.evaluate(tool, args, context=None) → dict
Evaluate a tool call. Returns the decision dict:
{
"decision": "allow", # "allow" | "block" | "review"
"risk_score": 0.15,
"explanation": "Low-risk read operation",
"policy_ids": ["shell-guard"],
"modified_args": None,
}
Raises BlockedError if the decision is "block".
client.scan(text, agent_id=None, session_id=None, context=None) → dict
Scan agent output for threats before sending to users.
client.verify(action_id, tool, result, context=None) → dict
Post-execution verification. Raises VerificationError on violations.
client.ingest_spans(spans) → dict
Batch-ingest agent trace spans.
client.list_traces(**filters) → list
List traces with optional filters (agent_id, session_id, has_blocks, limit, offset).
client.get_trace(trace_id) → dict
Fetch full trace detail.
client.delete_trace(trace_id) → dict
Delete all spans for a trace.
Exceptions
| Exception | Description |
|---|---|
AIRGError |
Base exception |
BlockedError |
Governor blocked the action |
ReviewRejectedError |
Human reviewer rejected |
ReviewExpiredError |
Review timed out |
VerificationError |
Post-execution violation |
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.2.tar.gz.
File metadata
- Download URL: airg_client-0.3.2.tar.gz
- Upload date:
- Size: 5.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 |
5948faedc9a1cf4492f2ca183054714f6b4b000e514767f3effd12acb8c41af5
|
|
| MD5 |
30074ca470046bed6a08eee7d4d6da01
|
|
| BLAKE2b-256 |
f5ed00d0b3716d3b376d217f7a5f1b37cdd7bc3b07c1a340fe18d5a7447d5285
|
File details
Details for the file airg_client-0.3.2-py3-none-any.whl.
File metadata
- Download URL: airg_client-0.3.2-py3-none-any.whl
- Upload date:
- Size: 6.2 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 |
03e18b4b583bf752909ca667bb1afb1c09dfaf23b809532df1cb9247a6ec60f7
|
|
| MD5 |
b79d64703da2a20700e9c9e19949c71f
|
|
| BLAKE2b-256 |
a092628c672f025164b044bfce2f79061cc558f86a5f4c42b7393c9fdb40da45
|