Privacy Guard
problem
Agents need customer data to do real work, like sending a reminder to the right person or paying the right account. Sending names, emails and IBANs to a model provider is a GDPR problem, and one-shot redaction makes the agent useless.
solution
A service between the agent and the model provider. It replaces personal data with stable tokens backed by an encrypted vault per conversation, and restores real values at the tool boundary, so the model never sees them but the agent can still act on them.
results
In production behind ecoai at Visma e-conomic, and open source. Tokens stay consistent across a whole conversation, and anything that can’t be restored stops the action instead of guessing.
Architecture
A Worker routes each request. Detection runs in Python containers: rule-based recognizers for structured data like emails and IBANs, and a GLiNER model for names and addresses. Mappings live in a Durable Object per vault, encrypted with AES-GCM, in the EU.
consistency
The same person, the same token, every turn
Before detection runs on new text, the vault replays every mapping it already holds into that text, longest value first. Detection then only has to find what is new, and a value seen in turn one gets the same token in turn twenty. Identical values are matched through a salted SHA-256 fingerprint, so plaintext is never stored.
safety
Failing closed at the tool boundary
Models sometimes damage a token while copying it. Tool arguments are restored before anything runs, and a token with no mapping is preserved and reported instead of silently dropped. The harness treats that as fatal for any action with side effects, so a damaged token can never send mail to the wrong address.
In production the model damaged a token in 0.61% of responses over a three-month sample.
availability
Detection that survives cold containers
Detector requests go to one of four container shards chosen by a hash of the content. If that shard is cold or restarting, the request moves around the ring with exponential backoff, up to two failover passes, so a container restart doesn’t fail the conversation.