Redact Outbound • AI Agent SDK

redact_outbound: Scrub secrets from text on its way to a chat user (safe-by-default).

redact_outbound

Function

</div>

This function is defined in the secrets module.

Scrub secrets from text on its way to a chat user (safe-by-default).

Combines the registered-value registry (:func:redact_secrets, holding every resolved gateway credential) with a credential-shape regex so an

unregistered token surfaced in a tool result is still masked. Personal data is intentionally out of scope here — an opt-in PII policy layers on top via the wrapper/plugin hook — so ordinary text is never over-redacted.

Zero dependency, never raises: a scrubber error returns the registered-value result rather than blocking delivery.

Signature

python
def redact_outbound(text: str) -> str

Parameters

ParamField str

No description available.

Returns

ResponseField str

The result of the operation.

Uses

  • redact_secrets
  • sub

Source

View on GitHub

praisonaiagents/secrets.py at line 346