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.0.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.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aigp_client-1.1.0.tar.gz
Algorithm Hash digest
SHA256 e4a24983fb87ea79196ad075ecc8a5b2ddd0efc557aa0374a083495ab5b4b3db
MD5 56f59d7d80c784513763ad3ec6cfc6f7
BLAKE2b-256 e7b74b24c1e1f3806c53c5fd5d7d235f8ef1f4450a6cf455207089622c6d328d

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for aigp_client-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7351dec61dd7ede0db4b5d785f48b8d8a98dc812459ca74cd62f73971cef40a
MD5 366789429cd074b70aef52e177c69866
BLAKE2b-256 9b62a4871b97572223b7615d90160477f80ef28fcbdc31220ca4ed438bf5a6ff

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