GDP-Agent: AI-Enhanced PII Detection Architecture
Describes an architecture that combines Microsoft Presidio with Azure AI Foundry to detect PII in emails, filter false positives, and generate professional follow-up communications.
What this file does
Describes an architecture that combines Microsoft Presidio with Azure AI Foundry to detect PII in emails, filter false positives, and generate professional follow-up communications.
When to use it
- Building an email monitoring system that needs to reduce false positive PII alerts
- Extending Presidio with AI-based contextual detection and risk assessment
- Creating a pipeline that transforms raw PII findings into business-friendly reports
- Integrating Azure AI Foundry with Microsoft Graph API for privacy compliance
Assumes this stack
GDP-Agent: AI-Enhanced PII Detection Architecture
Executive Summary
GDP-Agent is an intelligent email monitoring system that combines Microsoft Presidio for pattern-based PII detection with Azure AI Foundry for contextual analysis and false positive filtering. The system transforms raw technical findings into actionable business intelligence and professional communication.
Core AI-Enhanced Business Flow
graph TD
A[π§ Email Sent] --> B[Email Monitoring]
B --> C[Basic Email Processing]
C --> D[π Presidio PII Scan]
D --> E{Raw PII Detected?}
E -->|No| F[β
No Action Needed]
E -->|Yes| G[π§ AI Analysis & Filtering]
G --> H[π― False Positive Review]
H --> I{Real PII Confirmed?}
I -->|No| J[β
Filtered Out - No Alert]
I -->|Yes| K[π Risk Assessment]
K --> L[π€ AI Communication Generation]
L --> M[π§ Professional Follow-up Email]
M --> N[π Business Action Items]
style A fill:#e1f5fe
style G fill:#f3e5f5
style H fill:#fff3e0
style L fill:#e8f5e8
style M fill:#fce4ec
AI-Powered PII Detection Pipeline
1. Dual-Layer AI Detection β Enhancement
sequenceDiagram
participant Email as π§ Email Content
participant PresidioCore as π Presidio Core Patterns
participant PresidioAI as π€ Presidio AI Extension
participant AIAnalysis as π§ Azure AI Analysis
participant Filter as π― False Positive Filter
participant Business as π Business Logic
Email->>PresidioCore: Standard pattern detection
Email->>PresidioAI: AI-enhanced entity detection
PresidioCore->>AIAnalysis: Pattern results (8 entities)
PresidioAI->>AIAnalysis: AI context results (5 entities)
AIAnalysis->>Filter: Combined results (10 unique entities)
Filter->>AIAnalysis: "7 are false positives"
AIAnalysis->>Business: Confirmed: 3 real PII entities
Business->>AIAnalysis: Generate business-friendly report
AIAnalysis-->>Email: Professional notification sent
2. Extended Presidio with AI Enhancement
graph TB
subgraph "Extended Presidio Engine"
A[π§ Email Content] --> B[Core Presidio Analyzers]
A --> C[π€ AI Enhanced Recognizer]
B --> D[Pattern-Based Detection]
D --> E[SSN: 123-45-6789<br/>Phone: 555-0123<br/>Email: contact@company.com]
C --> F[AI Context Detection]
F --> G[Unusual Name Formats<br/>Business Context Entities<br/>Contextual PII]
E --> H[Combined Results]
G --> H
end
subgraph "AI Analysis Layer"
H --> I[π§ Azure AI Foundry Analysis]
I --> J[Business Context Filter]
I --> K[False Positive Detection]
I --> L[Risk Assessment]
end
subgraph "Business Intelligence"
L --> M[π Final PII Assessment]
M --> N[Professional Communication]
M --> O[Compliance Guidance]
end
style B fill:#ffebee
style C fill:#e8f5e8
style I fill:#f3e5f5
style M fill:#fff3e0
Extended Presidio Architecture
AI-Enhanced Recognizer Integration
GDP-Agent extends the standard Presidio framework by injecting a custom AI Enhanced Recognizer directly into Presidio's analyzer engine. This creates a hybrid detection system that combines pattern-based precision with AI contextual understanding.
graph TB
subgraph "Standard Presidio Framework"
A[AnalyzerEngine] --> B[Built-in Recognizers]
B --> C[Regex Patterns]
B --> D[ML Models]
B --> E[Spacy NLP]
end
subgraph "GDP-Agent Extension"
F[AIEnhancedRecognizer] --> G[Azure AI Foundry]
G --> H[Prompty Template]
H --> I[Context Analysis]
I --> J[Unusual Format Detection]
end
A --> F
F --> A
subgraph "Detection Results"
K[Core Presidio Results] --> L[Combined Entity List]
M[AI Enhanced Results] --> L
end
C --> K
D --> K
E --> K
J --> M
style A fill:#ffebee
style F fill:#e8f5e8
style G fill:#f3e5f5
style L fill:#fff3e0
Key Features of AI Extension
- Seamless Integration: Plugs directly into Presidio's
AnalyzerEngineas a custom recognizer - Contextual Detection: Identifies PII that pattern-based methods miss
- Confidence Calibration: AI results use lower confidence scores to let built-in recognizers take precedence
- Format Flexibility: Detects names, addresses, and identifiers in unusual formats
- Business Context: Understands when entities are business-relevant vs. personal
Detection Enhancement Examples
| Scenario | Core Presidio | AI Enhancement | Combined Result |
|---|---|---|---|
| "John Smith from ABC Corp" | Detects "John Smith" as PERSON | Detects "ABC Corp" as ORGANIZATION | Both entities with appropriate context |
| "Call me at five-five-five-zero-one-two-three" | Misses (unusual format) | Detects as PHONE_NUMBER | Phone number identified |
| "CEO Jane Doe" | Detects "Jane Doe" as PERSON | Adds business context (title) | Enhanced person entity with role |
| "john.smith.ceo@company.co.uk" | Detects email pattern | Identifies professional context | Email with business relevance |
AI Template System Architecture
The system uses three specialized Prompty templates:
1. Presidio Analysis Template (presidio_analysis.prompty)
Purpose: Transform raw Presidio detections into business-intelligent insights
Key Functions:
- Filter false positives (company names detected as persons)
- Apply business context to PII findings
- Determine actual risk levels based on data sensitivity
- Generate actionable recommendations
graph LR
A[Raw Presidio Data] --> B[presidio_analysis.prompty]
B --> C[Filtered Results]
B --> D[Risk Assessment]
B --> E[Business Context]
style B fill:#f3e5f5
2. Follow-up Report Template (follow_up_report.prompty)
Purpose: Generate professional business communications
Key Functions:
- Translate technical findings to business language
- Create anonymized examples for user education
- Provide practical impact assessments
- Generate actionable next steps
graph LR
A[Technical Findings] --> B[follow_up_report.prompty]
B --> C[Business Summary]
B --> D[Impact Assessment]
B --> E[Action Items]
style B fill:#e8f5e8
3. Entity Detection Template (pii_entity_detection.prompty)
Purpose: Enhance pattern-based detection with AI context understanding
Key Functions:
- Identify PII in unusual formats
- Understand contextual relevance
- Detect entities missed by pattern matching
- Provide confidence scoring
Technology Integration Points
graph TD
subgraph "External Services"
A[Microsoft Graph API]
B[Azure AI Foundry]
C[Microsoft 365]
end
subgraph "AI Components"
D[Presidio Engine]
E[Prompty Templates]
F[GDPAgentManager]
end
subgraph "Business Logic"
G[Enhanced Email Processor]
H[Notification Service]
I[Report Generator]
end
C --> A
A --> G
G --> D
D --> F
F --> B
E --> F
F --> I
I --> H
H --> A
style B fill:#e3f2fd
style D fill:#f3e5f5
style F fill:#fff3e0
Business Value Proposition
Before AI Enhancement (Standard Presidio)
- Limited pattern detection β Misses contextual PII
- High false positive rate β Company names flagged as people
- Format restrictions β Misses "five-five-five" phone numbers
- Technical jargon β Users confused about actions
- Generic recommendations β Poor adoption
After Dual-Layer AI Enhancement
- Extended detection coverage β AI finds contextual and unusual format PII
- Intelligent false positive filtering β 70% reduction in noise
- Context-aware analysis β Business vs. personal data distinction
- Professional communication β User-friendly explanations
- Actionable guidance β Specific privacy improvement steps
Detection Improvement Examples
- Coverage: Standard Presidio finds 8 entities β AI extension adds 5 more β Combined system identifies 10 unique entities
- Accuracy: Raw 10 detections β AI filters 6 false positives β 4 confirmed real PII
- Context: "John Smith, ABC Corp CEO" β System understands John Smith is a person, ABC Corp is a company, CEO is a business title
Key AI Capabilities
Enhanced Detection Layer
- Extended Pattern Recognition: AI recognizer finds PII in unusual formats that regex patterns miss
- Contextual Entity Detection: Identifies business entities, professional titles, and industry-specific terms
- Format Flexibility: Detects phone numbers written as "five-five-five-one-two-three-four"
- Confidence Calibration: AI results complement rather than compete with core Presidio patterns
Analysis & Filtering Layer
- Contextual Understanding: Distinguishes between "John Smith" as a customer vs. email signature
- Business Relevance: Identifies when phone numbers are company contacts vs. personal data
- False Positive Intelligence: Filters out company names incorrectly detected as person names
- Risk Calibration: Adjusts severity based on data type and business context
Communication Layer
- Professional Communication: Converts technical findings into user-friendly explanations
- Educational Approach: Provides learning-focused guidance rather than punitive warnings
- Compliance Intelligence: Delivers relevant regulatory guidance based on detected PII types
- Actionable Recommendations: Offers specific steps users can take to improve privacy practices
Compliance & Privacy Features
- Data Anonymization: All PII examples in communications are masked
- Audit Trail: Complete logging of AI decisions and filtering logic
- Risk Categorization: GDPR/CCPA-aligned risk level assessment
- Professional Notifications: Business-appropriate communication tone
- False Positive Learning: AI continuously improves context understanding
This architecture enables proactive privacy protection while minimizing user disruption through intelligent filtering and professional communication.
What's inside
6 Mermaid diagrams, 3 Prompty template descriptions, 1 table of detection examples, 12 key AI capabilities listed
Change this for your project
- Replace
Azure AI Foundryreferences with your own AI service endpoint and model deployment - Replace
presidio_analysis.prompty,follow_up_report.prompty,pii_entity_detection.promptywith your actual template file paths - Replace
GDPAgentManagerwith your own orchestrator class name
Where it goes
Save as AGENTS.md in your repository root. Read by Codex, Cursor and other agents that follow the AGENTS.md convention.
Worth borrowing
- Injecting a custom AI recognizer into Presidio's AnalyzerEngine to combine pattern-based and contextual detection
- Using three separate Prompty templates to separate analysis, report generation, and entity detection concerns
- Calibrating AI confidence scores lower than built-in recognizers so pattern-based results take precedence
Related Documents
Browser-only development
Guides AI assistants on an Electron + React + TypeScript desktop app for browsing and organizing AI-generated images locally.
Claude Agents β Reference & Recommendations
Catalogues 40+ Claude agents and marketing skills for building a cat adoption charity landing page, with a ready-to-paste prompt and backend API reference.
Golden DKG Prototype -- Master Plan
Defines an 8-phase implementation plan for a Rust prototype of the Golden non-interactive DKG protocol using BLS12-381 and tokio.
Swarms Examples Index
Lists 60+ example scripts for building single and multi-agent systems with the Swarms framework, organized by category and use case.