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.0.0.tar.gz (4.9 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.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aigp_client-1.0.0.tar.gz
  • Upload date:
  • Size: 4.9 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.0.0.tar.gz
Algorithm Hash digest
SHA256 1878ecf3a6f16d523801fbb7202fde9f6b72c9acb29e0928f8682b46eb470eae
MD5 59b9c0b04c0a8adad028d2ca34dcd394
BLAKE2b-256 e66109cfed125806bfb2e893ec526d36a9e49c8afc1322f0ee483af66b1d4404

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aigp_client-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 69dd4b47bcec56bf49570882229d37f35996c72865d537f6b12576382e8fbc25
MD5 5d1a4d239892b265b5edf498ae62e82d
BLAKE2b-256 abe1d5185aa5a893e87e2a8e62f7049192ad4428d2c988f13c7cbaae958d2a75

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