Agent Harness Tutorial · End to end · Zoom level 3
How we take care of it: no_pii_echo
no_pii_echo catches personal data repeated back.
How we took care of it.
- Look for personal-data patterns: Aadhaar, PAN, phone, email, bank account.
- Runs after the model and before every reply.
| It reads | the reply text |
| Kind | rule |
| Provided by | agent |
| If it fails | safe reply |
| Where in the code | F policy rules · evaluators.yaml reply |
| Runs at | 3 · After the model, 8 · Before the reply |
Real exampleTelemetry has its own redact() too, so the trace never holds them either.
More on this: The trace.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
def no_pii_echo(ctx: Context) -> Verdict:
"""Never read a bank account, driving licence, Aadhaar or PAN number back
(AOAS `personal_data_in_conversation`): it puts it in a transcript, a log and
a screenshot. Aadhaar and PAN are the harness's patterns (A12), the same
ones redaction masks; a spaced Aadhaar number escaped `DIGITS` before."""
if DIGITS.search(ctx.text) or LICENCE.search(ctx.text):
return block("no_pii_echo", "an account- or licence-shaped number appeared in the reply")
if aadhaar_numbers(ctx.text) or PAN.search(ctx.text):
return block("no_pii_echo", "an Aadhaar or PAN number appeared in the reply")
return ALLOW