Skip to main content

Universal AIGP (AI Governance Protocol) client — consent-based runtime AI governance

Project description

aigp-client

Universal AI Governance Protocol (AIGP) client — RFC-010 implementation.

Install

pip install aigp_client-1.0.0-py3-none-any.whl

Or in requirements.txt:

aigp-client @ file:///app/wheels/aigp_client-1.0.0-py3-none-any.whl

Usage

from aigp_client import AigpClient

client = AigpClient(
    gov_url="https://www.cyber-ai-gov.com",
    app_id="MY_APP",
    hmac_secret="your-shared-secret",
    mode="REPORT",  # or "ENFORCE"
)

# Heartbeat (run as background task)
await client.heartbeat()

# Pre-invocation check
decision = await client.check("my_use_case", "model-id", user_id="user@example.com")
if decision.denied:
    raise Exception(f"Blocked: {decision.reason}")

# Post-invocation record
await client.record(
    use_case="my_use_case", model_id="model-id",
    input_tokens=500, output_tokens=200,
    duration_ms=1200, user_id="user@example.com",
)

Use Cases Config

Instead of hardcoding use cases, ship an aigp-use-cases.json alongside your app:

{
  "app_id": "MY_APP",
  "use_cases": [
    {"id": "chat", "description": "General AI chat"},
    {"id": "analysis", "description": "Data analysis"}
  ]
}

The client auto-discovers this file at:

  • ./aigp-use-cases.json
  • /app/aigp-use-cases.json

Or pass explicitly:

client = AigpClient(..., use_cases_file="/path/to/aigp-use-cases.json")

Modes

Mode Behavior When GOV_APP unreachable
REPORT Log all, allow all Allow (fail-open)
ENFORCE Check policies, block violations Deny (fail-closed)

Protocol (RFC-010)

Message Endpoint Purpose
REGISTER GET /api/v1/register/{app_id} Heartbeat + declare use cases
REQUEST POST /api/v1/request Pre-invocation policy check
RECORD POST /api/v1/record Post-invocation telemetry

All messages are HMAC-SHA256 signed with headers:

  • X-AIGP-Signature: hmac-sha256={sig}
  • X-AIGP-Timestamp: {iso_timestamp}
  • X-AIGP-App-Id: {app_id}

Docker Integration

COPY wheels/ /app/wheels/
RUN pip install /app/wheels/aigp_client-1.0.0-py3-none-any.whl
COPY aigp-use-cases.json /app/aigp-use-cases.json

Build

cd HELPERS/aigp-client
make wheel    # → dist/aigp_client-1.0.0-py3-none-any.whl
make test     # run tests

Version

1.0.0 — Initial release. Single source of truth for all Deloitte Cyber apps.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aigp_client-1.1.1.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aigp_client-1.1.1-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file aigp_client-1.1.1.tar.gz.

File metadata

  • Download URL: aigp_client-1.1.1.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aigp_client-1.1.1.tar.gz
Algorithm Hash digest
SHA256 af26d1f10e1f23797894ec1ee857eeb29ed5e09dcaba54454f56e39c1a8ec73a
MD5 e1064c56e862636efabfd8cda99a13d8
BLAKE2b-256 6a38679659c13651a7af71b7d80d40ea9349373561865d0eaffd37b677cc9556

See more details on using hashes here.

File details

Details for the file aigp_client-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: aigp_client-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aigp_client-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3856a743cd7c7bfe1f4c02ce47e9c5c55fdcc937d50636bd4061a57811cdf05
MD5 57fb1b6bebb2ff805d9ff491b41673d4
BLAKE2b-256 948cfb847a4d6480bc8f9466bb030f6d2016832a6170954e84f581342240c120

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page