aigp-client
Universal client for the AIGP Runtime Governance Protocol (AIGP) v4.0 — consent-based runtime AI governance with jurisdictional enforcement.
Install
pip install aigp-client
Quick Start
from aigp_client import AigpClient
client = AigpClient("https://your-gov-server.com", "my-app", "hmac-secret")
# Declare governance context (once at startup)
client.declare_universal_context({"active": True, "principles": "ALL"})
# Every AI call: CHECK → invoke → RECORD
decision = await client.check("chat", "claude-4")
# ... invoke your model ...
await client.record(use_case="chat", model_id="claude-4", input_tokens=500, output_tokens=200, duration_ms=1200)
One-Line Governance
from aigp_client import govern
aigp = govern("https://gov-server.com", "my-app", "secret")
result = await aigp.wrap(my_ai_function) # CHECK + RECORD automatic
Jurisdictional Governance (v4.0)
Declare which legal frameworks govern your AI system:
from aigp_client import (
AigpClient, HumanitarianContext, RegulatoryContext,
AfricanContext, JapaneseContext,
)
client = AigpClient("https://gov.example.com", "my-app", "secret")
# Universal baseline (RFC-031) — all apps should declare this
client.declare_universal_context({"active": True, "principles": "ALL", "accountability_required": True})
# EU AI Act (RFC-028)
client.declare_regulatory_context(RegulatoryContext(
active=True, framework="EU_AI_ACT", risk_classification="HIGH_RISK",
deployer_jurisdiction="DE",
))
# Japan AI Promotion Act (RFC-030)
client.declare_japanese_context(JapaneseContext(
active=True, governance_framework="JAPAN_AI_PROMOTION_ACT",
sector="HEALTHCARE", innovation_priority=True,
))
# AU Continental AI Strategy (RFC-029)
client.declare_african_context(AfricanContext(
active=True, governance_framework="AU_CONTINENTAL_AI_STRATEGY",
member_state="KE", ubuntu_principle=True,
))
# IHL — conflict zones (RFC-027)
client.declare_humanitarian_context(HumanitarianContext(
active=True, legal_regime="IHL_GCIV", conflict_classification="NIAC",
operating_authority="ICRC",
))
All subsequent CHECK requests are evaluated against declared contexts. Priority: IHL → EU → AU → Japan → Universal.
User Feedback (RFC-026)
await client.feedback(request_id="req-123", session_id="ses-abc",
rating="thumbs_up", pseudonym_id="user-hash")
Multi-Agent Delegation
from aigp_client import SessionContext, DelegationToken
session = SessionContext(user_id="coordinator@company.com")
child = session.child(scope=["search_only"])
token = DelegationToken(issuer="coordinator", delegate="worker",
allowed_models=["claude-4"], max_tokens=10000)
encoded = token.encode("shared-secret")
Token Tracking
from aigp_client import TokenAccumulator
tokens = TokenAccumulator()
tokens.add_from_usage({"prompt_tokens": 500, "completion_tokens": 200}) # OpenAI
tokens.add_from_usage({"inputTokens": 300, "outputTokens": 150}) # Bedrock
print(f"Total: {tokens.total_input} in, {tokens.total_output} out")
Full Lifecycle Trace
from aigp_client import TraceBuilder
tb = TraceBuilder(request_id="req-1")
tb.start(1); tb.end(1, attributes={"user_id": "user@co.com"}) # Identity
tb.start(3); tb.end(3, attributes={"decision": "ALLOW"}) # CHECK
tb.start(9); tb.end(9, attributes={"model": "claude-4"}) # Invoke
tb.add_tool_span("search_docs", duration_ms=45) # Tool
tb.start(14); tb.end(14) # RECORD
spans, summary = tb.build()
await client.trace(trace_id=tb.trace_id, spans=spans, summary=summary)
Tool Governance
from aigp_client import ToolGovernance
tg = ToolGovernance(client=client)
decision = await tg.check_tool("execute_sql", params={"query": "SELECT *"})
Modes
| Mode | Behavior | When no decision is obtained |
|---|---|---|
REPORT |
Log all, allow all | UNCHECKED (proceeds, never reported as ALLOW) |
REPORT-TRACE |
Log + stage-level spans | UNCHECKED (proceeds, never reported as ALLOW) |
ENFORCE |
Check policies, block violations | Deny (fail-closed) |
"No decision" = server unreachable, non-2xx status, non-JSON body, or a body without a valid
decision (RFC-010). A non-decision is never cached. RATE_LIMITED blocks like DENY.
Supported Languages
| Python | TypeScript | Go | Java | C# | Rust | Ruby | Swift |
|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
All 8 SDKs have: declareHumanitarianContext, declareRegulatoryContext, declareAfricanContext, declareJapaneseContext, declareUniversalContext.
License
Proprietary — © 2025-2026 Kanjani AI Research & Causum. All rights reserved.
Metadata
Release files for maigp-client 5.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| maigp_client-5.5.0.tar.gz | 89.1 kB | Without provenance | Details for maigp_client-5.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| maigp_client-5.5.0-py3-none-any.whl | Python 3 | none | any | Details for maigp_client-5.5.0-py3-none-any.whl |
Total release size: 170.3 kB
Release files / maigp_client-5.5.0.tar.gz
| Download URL | maigp_client-5.5.0.tar.gz |
|---|---|
| Size | 89.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aed16e6a6efa116b9c9a8511fff35a91c21f21f08c28e98a4d38d6e9fd8348b4
|
|
BLAKE2b-256 checksum How to use checksums |
ba6112c15b5da7ec71114d0235c5b940be9ad2ec8dc1d75b46812f5f56f56f4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / maigp_client-5.5.0-py3-none-any.whl
| Download URL | maigp_client-5.5.0-py3-none-any.whl |
|---|---|
| Size | 81.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6026f8bf640e6091ea1aa88637f63419c75baf2019b90c32ab44e6416533f888
|
|
BLAKE2b-256 checksum How to use checksums |
f9adba5fddb250c44e9d63bf7a3bcc1ebcb96935c5951aeed40119b6d739805b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for maigp-client 5.5.0
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.