Modes
Enable via thedlp= kwarg on Governance.bootstrap() or the AG_DLP env var.
| Mode | Cost | Catches |
|---|---|---|
off (default) | 0 | Nothing. |
regex | ~50µs/call | Email, phone, SSN, credit card, IP, AWS keys, GitHub tokens, JWT, Slack tokens, generic high-entropy secrets. |
presidio | ~1ms/call | Everything in regex plus NER-backed PII (names, locations, organizations, medical) via Presidio. |
auto | as available | Presidio if installed (rubric[presidio]), otherwise regex. |
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):| Tier | Patterns |
|---|---|
low | Email, phone, IP. |
medium | Generic API keys, GitHub tokens, JWT, Slack tokens. |
high | SSN, credit card, AWS access keys, medical record numbers, anything Presidio classifies as PHI. |
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.