Integrate the SDK

Connect your AI agent in three minutes. Zero new dependencies for PII detection.

PyPI →GitHub →
1
Install
Zero runtime dependencies. Python 3.10+ · pip
pip install pygovernor
2
Wrap your LLM client
Drop-in replacement — PII is detected and redacted locally before any prompt leaves your codebase.
import governor import openai # Drop-in replacement — PII is redacted before prompts leave your code client = governor.wrap(openai.OpenAI()) response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": "Loan for Aadhaar 9876 5432 1098, PAN ABCDE1234F" }] ) # "Aadhaar 9876 5432 1098" → "[AADHAAR_IN]" # "PAN ABCDE1234F" → "[PAN_IN]"
What gets redacted
AADHAAR_INPAN_INUPI_INMOBILE_INIFSC_INBANK_ACCOUNT_INGST_INVOTER_IDPASSPORT_INDL_INEMAILIBANSSN_USMRN
3
Add the audit tracer
Every LLM call is automatically logged as a hash-chained audit event. Pass tracer= to wrap() to do both in one line.
import governor import openai from governor_tracer import GovernorTracer tracer = GovernorTracer(agent_id="loan-processor-v2") # PII redaction + hash-chained audit trail in one call client = governor.wrap(openai.OpenAI(), tracer=tracer) # FastAPI / asyncio agents — use arun() instead # async with tracer.arun() as run: # run.data_access("crm", ["aadhaar", "pan"], "kyc") # run.llm_call("openai", "gpt-4o", prompt, response) # valid, err = await run.verify()
4
Verify chain integrity
Call verify() at the end of any run to get cryptographic proof the audit trail hasn't been tampered with.
with tracer.run() as run: run.data_access( source="crm", fields_accessed=["aadhaar", "pan", "income"], purpose="loan_processing", data_principal_id="CUST-5821", ) run.decision("Score above threshold", "approve", confidence=0.87) run.human_checkpoint( question="Approve ₹5L loan?", approved=True, reviewer_id="anand.k" ) valid, err = run.verify() print(valid, err) # True, "chain intact"
What this covers
DPDP
Aadhaar, PAN, UPI detection
Consent-backed audit log
DPDP DPIA auto-generation
RBI FREE self-assessment
DPDP Guide →
GDPR
IBAN, NHS, passport detection
Art. 22 decision logging
72h breach notification trail
DPIA readiness tracking
GDPR Guide →
HIPAA
All 18 Safe Harbor identifiers
PHI de-identification logs
§164.312(b) audit controls
BAA-ready audit trail
HIPAA Guide →