AAegis

Open-source PII firewall for AI agents

Keep Nigerian customer identifiers out of your LLM prompts.

Aegis is an OpenAI-compatible proxy that runs inside your network. It swaps BVNs, NINs, account numbers, phone numbers, emails and names for Placeholders before a request reaches an external model, then puts the real values back in the reply. A Wire Tap shows exactly what left.

Read the evidence
aegis — Wire Tap preview
# What your agent sends to Aegis
- [pre-scrub text stays in your network]
# What the external model receives (Wire Tap)
+ Transfer ₦50,000 to [[PERSON_1]], BVN [[BVN_1]], phone [[PHONE_1]]
# What your agent gets back
+ Transfer initiated to Chinedu Okafor.
Telemetry control plane
post-scrub only
Boundary eventreq_••••
Upstream received
Transfer to [[PERSON_1]]
[[BVN_1]] · [[PHONE_1]]

entities

03

status

ok

Wire Tap

ready

Entity flow
PERSON
01
BVN
02
PHONE
03
No pre-scrub text.
No Session Map contents.

NDPA 2023 and GAID 2025

Transfers need a basis.
Section 41 allows personal data to leave Nigeria only on an adequacy basis or a section 43 ground such as informed consent, and requires you to record the basis. Penalties for breach can reach the greater of ₦10m or 2% of annual gross revenue for organisations of major importance.
Agents multiply the exposure.
Prompts, tool arguments and tool results all carry customer data to an external API.
Rewriting prompts by hand does not scale.
Custom redaction code is brittle, misses tool calls, and leaves no evidence.

How it works

01

Scrub, locally.

Rules detect phones, BVN/NIN-format numbers, account numbers (with context) and emails. A name gazetteer and a small local model detect person names. Nothing is sent anywhere for detection.

02

Remember, briefly.

The Session Map lives in Redis with snapshots and append-only logging disabled and a sliding expiry. Same person, same Placeholder across a conversation (when the client sends X-Aegis-Session).

03

Reinject.

Placeholders in the reply, including inside tool-call arguments, are swapped back before your app sees them. If state is lost, Aegis returns placeholders rather than guessing.

Agent

│ request with identifiers

▼

Aegis

├─ Scrubber → Placeholders

├─ Session Map → Redis, short expiry

└─ Wire Tap → post-scrub evidence

▼

Upstream

│ reply with Placeholders

▼

Reinjector → Agent

One-line integration

Works with the official OpenAI SDK and Anthropic SDK, including streaming and tool calls.

from openai import OpenAI
client = OpenAI(
    base_url="http://aegis.internal:8000/v1",   # was https://api.openai.com/v1
    api_key=os.environ["OPENAI_API_KEY"],
)

Evidence (measured, with hardware and date)

MeasureResultSource
PerformanceMeasure rule and model overhead on your own hardwarebench_scrub.py
Leak test0 leaks / 35 planted entities across 12 promptstest_no_leak.py
Per-type recall and precision (synthetic regression set, project-authored)PERSON: 96.9% recall, 61.9% precisioneval_recall.py

Numbers are from our own sets on the stated hardware. Deliberate evasion (leetspeak, spelled-out digits) is a known limitation. Read the methodology.

Evidence for the people who sign off.

Pseudonymisation as a technical security measure (NDPA s.39(2)(a)).
A record of what crossed the boundary, per request (supports s.41(2) transfer records). Export format: roadmap.
Inputs for your DPIA (s.28) and the cross-border section of your annual compliance audit return. Templates: roadmap.
A live dashboard of counts, timings and post-scrub payloads. It never shows pre-scrub text.

Deploy where your data lives

Docker image (model included)
docker compose
Kubernetes (Helm: roadmap)

Runs in your VPC or on-prem. No telemetry leaves your network.

What Aegis does not do

It does not make a transfer lawful on its own. Pseudonymised data can still be personal data.
Names are detected by a model, so recall is not 100%. Structured IDs are rule-detected.
It does not protect against the upstream provider's own retention. Check your provider terms.
Streaming holds back incomplete Placeholders; it does not wait for the whole reply.

Building with agents in a Nigerian bank, fintech or hospital?

We are looking for a small number of design partners to test Aegis on real formats and policy needs. Free self-hosted pilot.

Explore the pilot