governor
DPDP-compliant AI data security for Indian enterprises.
Zero dependencies. Runs locally. Works with any LLM provider.
pip install pygovernor
PII Detection and Redaction
Detects and redacts Indian PII (Aadhaar, PAN, UPI, IFSC, mobile, GST, bank accounts) and global PII (email, IP) — entirely locally, no network calls.
import governor
# Detect
entities = governor.detect("Customer Aadhaar: 2345 6789 0123, PAN: ABCDE1234F")
# [Entity(type='AADHAAR', value='2345 6789 0123', ...), Entity(type='PAN', ...)]
# Redact (token replacement)
result = governor.redact("Call me on 9876543210, UPI: rahul@okicici")
result.text # "Call me on [MOBILE_IN], UPI: [UPI_ID]"
result.count # 2
result.clean # False
# Redact (partial mask)
result = governor.redact("Aadhaar: 2345 6789 0123", replacement="mask")
result.text # "Aadhaar: XXXX XXXX 0123"
Wrap any LLM client
PII is redacted from every prompt before it leaves your network, and from every response before it's stored or displayed.
import governor, openai
client = governor.wrap(openai.OpenAI())
# Use exactly like openai.OpenAI() — PII is handled automatically
response = client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "user",
"content": "Assess loan for Aadhaar 9876 5432 1098, PAN ABCDE1234F"
# ↑ redacted to [AADHAAR_IN], [PAN_IN] before reaching OpenAI
}]
)
Anthropic:
import governor, anthropic
client = governor.wrap(anthropic.Anthropic())
Agent Audit Trail
Records every agent decision in an immutable, hash-chained audit log.
Required by DPDP §8 and the RBI FREE AI Framework.
from governor_tracer import GovernorTracer
tracer = GovernorTracer(agent_id="loan-processor-v2")
with tracer.run() as run:
run.data_access(
source="crm",
fields_accessed=["name", "income", "aadhaar"],
purpose="loan_processing",
data_principal_id="CUST-5821",
)
run.llm_call(
provider="openai",
model="gpt-4o",
prompt="Assess eligibility for [AADHAAR_IN] applicant", # already redacted
response="Eligible. Score: 72/100.",
redact_pii=True,
)
run.decision(
reason="Score above threshold (70)",
outcome="approve",
confidence=0.87,
)
# Human-in-the-loop checkpoint — required for high-risk decisions
run.human_checkpoint(
question="Approve ₹5L loan for this applicant?",
approved=True,
reviewer_id="anand.k",
)
# Verify the hash chain is intact
valid, err = run.verify()
assert valid, f"Audit chain broken: {err}"
Configuration
export GOVERNOR_TRACER_URL=https://agent-tracer.vercel.app # default (hosted)
# or point to your self-hosted Agent Tracer
Supported PII types
| Type | Pattern |
|---|---|
AADHAAR |
12-digit, masked and unmasked |
PAN |
ABCDE1234F format |
UPI_ID |
handle@provider |
IFSC |
11-character bank code |
MOBILE_IN |
6xxx–9xxx Indian mobile |
BANK_ACCOUNT |
9–18 digit account numbers |
GST |
22AAAAA0000A1Z5 |
EMAIL |
RFC 5322 |
IPV4 |
IPv4 addresses |
License
Apache 2.0 — governor.so · DPDP Guide · GitHub
Metadata
Release files for pygovernor 0.2.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 |
|---|---|---|---|---|
| pygovernor-0.2.0.tar.gz | 20.4 kB | With provenance | Details for pygovernor-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygovernor-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pygovernor-0.2.0-py3-none-any.whl |
Total release size: 45.0 kB
Release files / pygovernor-0.2.0.tar.gz
| Download URL | pygovernor-0.2.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff55c2b46d79e7e408d425f91b1de2257abb159b4b8ed15c97cf89bb994b6fac
|
|
BLAKE2b-256 checksum How to use checksums |
07429af1e21bc9d78afe7927e2e28802bd995ad0de12adadf62c174eebd5a30d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / pygovernor-0.2.0-py3-none-any.whl
| Download URL | pygovernor-0.2.0-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbab6e10d8e4d53de52b233439883490e64018ce18cd4a55682893ed8e899dad
|
|
BLAKE2b-256 checksum How to use checksums |
355f225086569852ee7673c67154b158fdf3fcca50942a1142ae87074fabb1e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logSecurity for pygovernor 0.2.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pygovernor-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logA 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.