- The user types real names and reads real names.
- The tools (MCP servers, databases, APIs) receive real values in their arguments and return real data.
- The LLM provider sees only placeholders such as
[PERSON_1]and[EMAIL_1]. - Databunker Pro holds the values, each one an encrypted token.
ext_proc) protocol, so it works with any API gateway that supports that protocol, such as agentgateway, as a separate gRPC service.
What each party sees
A user asks an agent with a BigQuery MCP tool:
The model still reasons about the data: it knows there is one person, one email and one phone, and which is which. Business data the Zero-PII gateway does not classify as personal, such as products, amounts, dates and cities, reaches the model unchanged, so it can summarize and calculate.
Architecture
The API gateway sends each model request to the Zero-PII gateway before forwarding it, and each answer before returning it. The MCP route does not go through the Zero-PII gateway: tool calls carry real values, and stay between the agent and your own tools.Example: agentgateway
agentgateway is an open-source gateway for AI agents, with LLM and MCP routes in one place. ItsextProc policy sends the LLM route through the Zero-PII gateway, with no change to agentgateway itself:
ai.routestells agentgateway that the route speaks the Anthropic Messages API, so it forwards requests in that format instead of translating them.extProccalls the Zero-PII gateway for every request and every streamed answer on this route. The MCP route has noextProc, so tool calls pass through with real values.failureMode: failClosedrejects the request if the Zero-PII gateway is down.
CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS keeps Claude Code to request fields agentgateway already knows. mcp.json lists agentgateway’s MCP route:
One request through the Zero-PII gateway
- Request. The Zero-PII gateway reads the whole request and finds the conversation it belongs to. It loads that conversation’s vault from Databunker Pro and masks every user message, assistant message, tool call and tool result in it. New values are tokenized with one
TokenCreateBulkcall, and the masked request goes on to the provider. - Answer. Agents stream, so the Zero-PII gateway restores the answer chunk by chunk, in text and in tool-call arguments. A placeholder split across two chunks (
[PERS+ON_1]) is held back until it is complete. Values inside tool arguments are JSON-escaped, so a restored name never breaks the arguments.
The whole agent run
One question can take several model calls, with tool calls in between. Every model call is masked, every answer is restored, and the tools run on real values: A follow-up question in the same conversation, such as “What was the day of his last purchase?”, uses the same vault: Michael Johnson is still[PERSON_1].
Conversations and sessions
Each conversation has its own vault, so[PERSON_1] means one person in one conversation and nothing outside it. The Zero-PII gateway finds the conversation from the agent’s session header, or from the session id in the request metadata. Without either, the first user message identifies it.
The vault lives in Databunker Pro, as in Tokenize LLM prompts: one token per value with unique: true and a sliding expiry, and a session file that maps the conversation’s placeholders to token UUIDs. API gateway and Zero-PII gateway instances keep no state between requests, so you can restart or scale them, and a conversation continues on any instance.
Telling the model about placeholders
A model that sees[PERSON_1] may say the name is “redacted”, or refuse to put a placeholder into SQL. The Zero-PII gateway adds a short note at the end of the system prompt:
Failure handling
The API gateway is configured to fail closed: if the Zero-PII gateway is not reachable, the model request is rejected instead of being sent unmasked. If Databunker Pro is not reachable, the Zero-PII gateway cannot load or save the vault, and the request fails the same way.What this does not protect
Everything in What this does not protect applies, and the gateway adds a few points of its own:- Tools see real data. That is the point, and it means a tool that sends data to a third party sends real data. Put only tools you trust behind the gateway.
- The model writes queries with placeholders. A value the model has to change, rather than copy, cannot be restored. For example,
LIKE '%[PERSON_1]%'works, but splitting a name into first and last name does not. - Thinking stays masked. The provider signs extended-thinking blocks, so the Zero-PII gateway does not restore them. The user may see placeholders there.
- Images and documents are not scanned. Only text, tool calls and tool results are masked.
- Compressed answers are not restored. The Zero-PII gateway asks the provider for uncompressed answers. If a provider compresses anyway, the answer passes through unchanged and the Zero-PII gateway logs a warning.
Related
- Tokenize LLM prompts: the same masking inside your own application, placeholders, vault and expiry in detail
- Format-preserving tokenization: token types, expiry, bulk operations
- File vault: where the session files are stored
- Access control: scoping the Zero-PII gateway’s credential