[presidio] extra). DLP runs before policy evaluation so detections become first-class policy fields.
See DLP concepts for the philosophy and policy patterns. This page is the API.
Enable
Three knobs — pick one:Modes
DlpDetection
DlpMatch
Custom detector
Any object with this shape:dlp=MyDetector() on bootstrap. The SDK calls .detect() once per evaluate(), passing the combined metadata dict (input + args + kwargs).
Built-in regex patterns
The default regex detector covers:
Override per-detector by subclassing and changing the
_PATTERNS map.
Failures
If a detector raises duringdetect(), the SDK logs and treats it as no-detection. Your evaluate() proceeds with dlp_detected: false. Fix the detector and you’re back. Detector exceptions never propagate up to the caller.