Modes
Enable via thedlp= kwarg on Governance.bootstrap() or the AG_DLP env var.
What gets scanned
Theinput, args, and kwargs fields on the EvaluationMetadata you pass to evaluate(). Strings nested arbitrarily deep are walked. Non-string values are ignored.
If none of those fields are populated, the scan is skipped (no false positives on empty input).
Detected types
The detector returns:metadata.dlp and into the policy evaluator’s request as:
Severity tiers
The default tier mapping (override per-detector if needed):Example policy
evaluate() whose arguments contain an SSN or AWS key returns deny with denyCode: high-severity-deny.
Custom detector
Pass any object with adetect(payload: dict) -> DlpDetection | None method:
Failures fail-soft
If the detector raises, the SDK logs and treats the call asdlp_detected: false. Your agent doesn’t break because a regex compiled wrong. Fix the detector and you’re back in business.