> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Enable Pii Redaction • AI Agent SDK

> enable_pii_redaction: Register a BEFORE_LLM hook that scrubs secrets from every message.

# enable\_pii\_redaction

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**redact**](../modules/redact) module.

Register a BEFORE\_LLM hook that scrubs secrets from every message.

Idempotent — calling twice leaves exactly one hook registered.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def enable_pii_redaction() -> str
```

### Returns

<ResponseField name="Returns" type="str">
  func:`disable_pii_redaction`).
</ResponseField>

## Uses

* `get_default_registry`
* `reg.register_function`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/redact.py#L190">
  `praisonaiagents/trace/redact.py` at line 190
</Card>
