Scrub Pii Text • AI Agent SDK
scrub_pii_text: Redact API keys, passwords, SSNs, credit cards, and emails from free text.
scrub_pii_text
Function
</div>
This function is defined in the redact module.
Redact API keys, passwords, SSNs, credit cards, and emails from free text.
Reuses REDACT_KEYS for `key=value` pairs and adds value-pattern rules for naked secrets. Zero dependency (stdlib re only).
Signature
def scrub_pii_text(text: str) -> strParameters
ParamField
strInput string — returned unchanged if empty or None.
Returns
ResponseField
strScrubbed string with literal secrets replaced by `[REDACTED*]`.
Uses
redact_stringpat.sub
Source
View on GitHubpraisonaiagents/trace/redact.py at line 152