> ## 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.

# redact • AI Agent SDK

> Redaction utilities for action trace.

# redact

<Badge color="blue">AI Agent</Badge>

Redaction utilities for action trace.

Provides deterministic redaction of sensitive data in tool arguments
and results. Uses only stdlib for zero dependencies.

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.trace import redact
```

## Functions

<CardGroup cols={2}>
  <Card title="redact_dict()" icon="function" href="../functions/redact_dict">
    Redact sensitive values from a dictionary.
  </Card>

  <Card title="scrub_pii_text()" icon="function" href="../functions/scrub_pii_text">
    Redact API keys, passwords, SSNs, credit cards, and emails from free text.
  </Card>

  <Card title="enable_pii_redaction()" icon="function" href="../functions/enable_pii_redaction">
    Register a BEFORE\_LLM hook that scrubs secrets from every message.
  </Card>

  <Card title="disable_pii_redaction()" icon="function" href="../functions/disable_pii_redaction">
    Unregister the PII-redaction hook. No-op if never enabled.
  </Card>

  <Card title="redact_string()" icon="function" href="../functions/redact_string">
    Redact potential secrets from a string.
  </Card>
</CardGroup>

### Constants

| Name                 | Value                                                                                                                                                                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_REDACT_PATTERN`    | `re.compile('(' + '\|'.join((re.escape(k) for k in REDACT_KEYS)) + ')')`                                                                                                                                      |
| `_REDACT_KV_PATTERN` | `re.compile('(["\\\']?)(' + '\|'.join((re.escape(k) for k in REDACT_KEYS)) + ')(["\\\']?\\s*[:=]\\s*["\\\']?)([^"\\\'\\s,}\\]]+)', re.IGNORECASE)`                                                            |
| `REDACTED_VALUE`     | `'[REDACTED]'`                                                                                                                                                                                                |
| `_VALUE_PATTERNS`    | `((re.compile('\\bsk-[A-Za-z0-9]{12,}\\b'), '[REDACTED]'), (re.compile('\\b\\d{3}-\\d{2}-\\d{4}\\b'), '[REDACTED-SSN]'), (re.compile('\\b(?:\\d{4}[ -]){3}\\d{4}\\b'), '[REDACTED-CC]'), (re.compile('\\b...` |
| `_PII_HOOK_LOCK`     | `threading.Lock()`                                                                                                                                                                                            |
