hirann/gdpr-auditor
0
๐ GDPR Compliance Auditor โ OpenEnv Environment
GDPR Auditor is an OpenEnv-compatible RL environment where AI agents act as autonomous compliance officers, auditing privacy policies for GDPR/CCPA violations, detecting dark patterns, and identifying policy contradictions.
The Problem It Solves
Every company needs compliance auditing to avoid massive fines:
- GDPR fines up to โฌ20 million or 4% of global revenue
- CCPA fines up to $7,500 per violation
- Average human compliance auditor cost: $100,000+/year
The Agent's Job
- Review privacy policy documents (single or multi-document)
- Map data practices to stated purposes
- Identify contradictions, missing clauses, and dark patterns
- Report compliance violations with severity levels
Tasks & Grading
Reward Function
R = base_score + severity_bonus + multi_doc_bonus + exploration_bonus- Base Score:
issues_found / total_issues - Severity Bonus: +0.25 for critical findings, +0.15 for high
- Multi-Document Bonus: +0.2 for elite task (cross-doc findings)
- Exploration Bonus: +0.02 per step (max 0.1)
All rewards are clamped to [0.0, 1.0].
API Endpoints
Example Usage
# Reset environment
curl "http://localhost:7860/reset?task=easy"
# Submit a compliance finding
curl -X POST "http://localhost:7860/step" \
-H "Content-Type: application/json" \
-d '{"message": "Missing Right to be Forgotten clause"}'
# Get current state
curl "http://localhost:7860/state"Action / Observation Spaces
Observation (returned by reset/step)
{
"task_id": "easy_clause_existence",
"task_name": "Clause Existence Check",
"difficulty": "easy",
"step": 0,
"documents": [{"id": "...", "title": "...", "content": "...", "doc_type": "policy"}],
"data_practices": [{"id": "...", "category": "...", "purpose": "...", "data_type": "...", "shared_with_third_parties": false}],
"compliance_requirements": ["Right to be Forgotten", "Data Portability", "Contact Information"],
"flagged_issues": [],
"echoed_message": "Review the privacy policy..."
}Action (sent to /step)
{"message": "Missing Right to be Forgotten clause"}Reward (returned from /step)
{
"value": 0.52,
"reason": "Found 1/2 issues",
"issues_found": 1,
"total_issues": 2
}Setup & Local Development
Prerequisites
- Python 3.10+
uvorpip
Install & Run
# Install dependencies
pip install -e .
# Start the server
python main.py
# โ Server at http://localhost:7860Run Inference
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
export HF_TOKEN="your-token-here"
export SERVER_URL="http://localhost:7860"
python inference.pyDocker
docker build -t gdpr-auditor .
docker run -p 7860:7860 gdpr-auditorProject Structure
โโโ models.py # Pydantic typed models (Observation, Action, Reward)
โโโ env/
โ โโโ __init__.py
โ โโโ core.py # GDPRAuditorEnvironment with 4 tasks + graders
โโโ main.py # FastAPI server with all endpoints
โโโ inference.py # Baseline inference script (OpenAI client)
โโโ openenv.yaml # OpenEnv manifest with task definitions
โโโ pyproject.toml # Dependencies
โโโ Dockerfile # Container configuration
โโโ README.md # This fileEnvironment Variables
Copy .env.example to .env and add your Hugging Face token:
cp .env.example .env
# Then edit .env with your HF_TOKENLicense
MIT
