Skip to main content

Private agent

An agent that never sends personal details to the model. Messages are sanitized on the way in and the reply is rehydrated on the way out.

This example: a clinic intake assistant for patient messages. Names, ages and phone numbers are sanitized before the model sees them.

Example (replies vary)
You: Hi, I'm Dana Reyes, 45, call me on 415-555-0123 about my knee pain.

1. Sanitized: Hi, I'm [PII_1], [PII_2], call me on [PII_3] about my knee pain.
(this is all the model sees)
Model says: Thanks [PII_1]. Summary: knee pain, callback requested at [PII_3].

2. Rehydrated: Thanks Dana Reyes. Summary: knee pain, callback requested at
415-555-0123.
(this is what your user gets)
from custodian_labs import Custodian

app = Custodian(
model="gpt-6-luna",
system_prompt="You are a clinic intake assistant. Summarize what the patient needs.",
privacy_enabled=True,
).deploy()

reply = app.chat("Hi, I'm Dana Reyes, 45, call me on 415-555-0123 about my knee pain.")
print(reply.response) # Dana's details are back in the reply; the model never saw them

Which mode does privacy_enabled use?​

It uses Guardian Layer's Default mode, which is built for agents. It works in two steps:

  1. Sanitization. Personal details are replaced with labels such as [PII_1] before the model sees them.
  2. Rehydration. When the reply comes back, every original detail is put back, so your user gets a complete, personal answer.
DefaultTransformMaskingPlaceholder
Model or reader sees[PII_1]Maria LopezD*****[NAME]

Transform, Masking and Placeholder are for calling Guardian Layer directly.

By default it covers names, phone numbers, ages and dates.

Want a different style, or to mask data outside an agent? Call Guardian Layer yourself with the mode you need. See Guardian Layer and Mask PII before any LLM.

Learn more