liveBook · Manning

PII scrubbing

As explained in Designing AI Systems

PII redaction is the removal or masking of personally identifiable information from generated or transmitted content.

PII scrubbing removes or masks personally identifiable information from generated or transmitted content. In an AI assistant, it belongs at the output boundary: the system filters the model response before forwarding it to users or other audiences. section 10.7 section 6.9

Treat scrubbing as an execution policy rather than a standalone moderation feature. Output guardrails form one inspection point in a broader flow that also validates inputs, tool arguments, external responses, and actions. section 6.9

A production integration should make the filtering decision visible:

  • Run an output filter against the raw assistant response before returning content. section 10.7
  • Return the filtered content instead of the unmodified response. section 10.7
  • Record applied filters in a safety-flags field so the frontend can indicate that safety modifications occurred. section 10.7
  • Keep safety constraints declarative where possible, allowing compliance teams to edit policies while developers handle violation errors. section 6.9

Preventing accidental email disclosure

An assistant generates a response containing a user's email address, and that response is forwarded to a broader audience. The PII redaction policy catches the address, modifies the response, and exposes the applied filter so the interface can display a safety indicator rather than silently changing the text. section 10.7

Figure 10.7 Adding guardrails. Safety policies validate inputs, tool arguments, and outputs at multiple points in the request flow.

Use the guardrail-flow diagram to locate PII scrubbing at the output boundary alongside input and tool-action checks. section 10.7

How Designing AI Systems covers it

How deep it goes
Defines output filtering, response replacement, and safety flags but does not detail detection or masking algorithms.
Examples
Uses an assistant response containing a user's email address and a frontend safety indicator as concrete examples.
What it assumes
Assumes an agent loop with output filtering and frontend response handling; treats broader guardrail architecture as established.
What you can do after
Operate output filtering that replaces unsafe responses and reports applied safety modifications to the frontend.
How it connects
Connects PII redaction with output filtering, guardrails, declarative policies, and observability.

Also explained in

Compare how 2 books explain PII scrubbing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Systems. The section links point to the parts of the book it draws on.