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

Requires Python 3.9 or later. Create an API key in the AIRG dashboard.

Quick start

import os
from airg import AIRG

client = AIRG(
    base_url="https://api.airg.nov-tia.com",
    api_key=os.environ["GOVERNOR_API_KEY"],
)

decision = client.evaluate(
    tool="issue_refund",
    args={"order_id": "A-1001", "amount": 40, "currency": "GBP"},
    context={"session_id": "abc-123"},
)
print(decision["decision"])      # "allow" | "review"
print(decision["risk_score"])    # 0 – 100
print(decision["explanation"])

Configuration

Environment variable Description
GOVERNOR_URL Base URL of the Governor service (default http://localhost:8000; the hosted service is https://api.airg.nov-tia.com)
GOVERNOR_API_KEY API key (airg_…)

Or pass them explicitly:

client = AIRG(api_key="airg_...", base_url="https://api.airg.nov-tia.com")

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, *, review_mode="hold", hold_timeout=60) → 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".

Review decisions. By default (review_mode="hold", since 0.4.0) a "review" decision waits up to hold_timeout seconds for a reviewer. The call returns only if the action is approved; otherwise it raises ReviewRejectedError or ReviewExpiredError, so your code does not run it.

client.evaluate("wire_transfer", {"amount": 250000}, hold_timeout=120)
# returns once approved; raises ReviewRejectedError or ReviewExpiredError otherwise

To get the decision back at once instead, pass review_mode="proceed". Your code must then not run the action until a reviewer approves it; the first time this happens the client emits a ReviewNotEnforcedWarning.

Upgrading from 0.3.x: review_mode used to default to "proceed". Code that relied on that and handles reviews itself should pass review_mode="proceed" explicitly.

hold_timeout is capped at 300 seconds by the Governor.

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
ReviewNotEnforcedWarning Warning: a "review" decision returned without waiting (review_mode="proceed")

Requirements

  • Python ≥ 3.9
  • httpx ≥ 0.24.0

License

MIT © 2026 NOVTIA LTD. The full text is in the LICENSE file included in the package.

Metadata

Release files for airg-client 0.4.1

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.4.1
File Size Uploaded Provenance Actions
airg_client-0.4.1.tar.gz 7.2 kB Without provenance Details for airg_client-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 15.4 kB

Release files / airg_client-0.4.1.tar.gz

Download URL airg_client-0.4.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
ac531ab5919337b14fdce77e95c33c180ad74bf61653019c719e82363fba7c9d
BLAKE2b-256 checksum
How to use checksums
a3a4d1189bc70e00a6365a5bfd5e1d63edeec90246c5bbbfafde6cbfd2b26119
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

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

Download URL airg_client-0.4.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b675542eb2120128666cb07bead03ba660cd60e213a031c8ce2e3904b509cdcc
BLAKE2b-256 checksum
How to use checksums
bcdb30646ae5a09091984b581f62372a03176cb72b4f5b3c927f75a5b877be58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for airg-client 0.4.1

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