Skip to main content

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.

Metadata

Release files for airg-client 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for airg-client 0.3.2
File Size Uploaded Provenance Actions
airg_client-0.3.2.tar.gz 5.1 kB Without provenance Details for airg_client-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for airg-client 0.3.2
File Interpreter ABI Platform Actions
airg_client-0.3.2-py3-none-any.whl Python 3 none any Details for airg_client-0.3.2-py3-none-any.whl

Total release size: 11.2 kB

Release files / airg_client-0.3.2.tar.gz

Download URL airg_client-0.3.2.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5948faedc9a1cf4492f2ca183054714f6b4b000e514767f3effd12acb8c41af5
BLAKE2b-256 checksum
How to use checksums
f5ed00d0b3716d3b376d217f7a5f1b37cdd7bc3b07c1a340fe18d5a7447d5285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / airg_client-0.3.2-py3-none-any.whl

Download URL airg_client-0.3.2-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03e18b4b583bf752909ca667bb1afb1c09dfaf23b809532df1cb9247a6ec60f7
BLAKE2b-256 checksum
How to use checksums
a092628c672f025164b044bfce2f79061cc558f86a5f4c42b7393c9fdb40da45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Security for airg-client 0.3.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page