What pii() is for#
Keeping personal data from a model provider that might train on it is one reason to use pii(), but not the main one, and not one that applies to providers that do not train on or retain inputs. Four other purposes apply whichever provider you use, each at a different edge with a different action.
Keep the user’s own data from the model and your logs#
The user’s name, address or account number often does not need to reach the model for it to help. Redacting it on the prompt and on tool results means the provider, the run’s message history and your traces only ever hold placeholders, while tools and the user work with real values.
This is data minimization, which regulation asks for regardless of what the processor does with the data: GDPR Article 5(1)(c) and Article 25 (data protection by design), and HIPAA’s minimum necessary standard. The UK Information Commissioner’s Office treats prompts as personal data.
user_pii = enkrypt.pii(entities=["pii", "person"])
capabilities = [
InputGuardrail(guard=[user_pii]),
ToolGuardrail(guard=enkrypt.restore, result_guard=user_pii),
OutputGuardrail(guard=[enkrypt.restore]),
]
Example: Round trip.
Stop a tool call from carrying data out#
An agent that can read untrusted content and can call tools that reach the outside can be turned against its user: injected instructions tell the model to put private data into a URL or a request. Simon Willison calls the combination of private data, untrusted content and a way out the “lethal trifecta”; attacks of this kind include EchoLeak against Microsoft 365 Copilot (CVE-2025-32711) and image-link exfiltration from ChatGPT and Slack AI.
A block on the arguments of tools that reach the outside refuses the call when it carries personal data, so the request is never made:
ToolGuardrail(
guard=enkrypt.pii(entities=["pii", "person", "ip_address"], on_violation="block"),
tools=["fetch_url"],
)
This removes the data worth stealing, not the injection; pair it with injection_attack on tool results. Leave the url entity type out for a fetch tool: it flags the URLs the tool needs.
Example: Exfiltration.
Keep other people’s data out of the conversation#
Tools and retrieval return records about people other than the user asking: other customers in a ticket search, names in retrieved documents. Research on retrieval-augmented generation shows these records can be extracted through the model. Redacting tool results, with no restore, keeps them from both the model and the user:
ToolGuardrail(result_guard=enkrypt.pii(entities=["pii", "person", "ip_address"]))
Example: Tool results.
Catch personal data in the answer#
The model can put personal data in its answer from its training data, its instructions, earlier conversation, or a value detection missed on the way in. The OWASP Top 10 for LLM Applications lists a user receiving another user’s personal data as the first scenario of LLM02, Sensitive Information Disclosure, and the European Data Protection Board recommends output filters. A retry on the answer sends it back to be rewritten:
OutputGuardrail(guard=[enkrypt.pii(entities=["pii", "person"], on_violation="retry")])
Placeholders from earlier redaction are hidden from this check, so it does not fire on the model correctly repeating <<PERSON:1>>.
Example: Answers.
Choosing between them#
Purpose |
Edge |
Action |
Restore |
|---|---|---|---|
the user’s own data |
prompt, tool results |
|
yes |
data leaving through a tool |
tool arguments |
|
no |
other people’s data |
tool results |
|
no |
personal data in the answer |
answer |
|
no |
An agent can use all four, as the brokerage agent does.
Sources#
OWASP Top 10 for LLM Applications 2025, LLM02: Sensitive Information Disclosure. https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/
European Data Protection Board, Opinion 28/2024 on AI models.
GDPR Articles 5(1)(c) and 25; HIPAA Privacy Rule, minimum necessary standard.
Simon Willison, “The lethal trifecta for AI agents”. https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/
CVE-2025-32711 (EchoLeak).
Zeng et al., “The Good and The Bad: Exploring Privacy Issues in Retrieval-Augmented Generation”, ACL Findings 2024.