The Problem
Brazil's LGPD (Lei Geral de Proteção de Dados) is the Brazilian equivalent of GDPR. Every company operating in Brazil must comply — but auditing systems for LGPD violations is expensive, time-consuming, and usually requires hiring specialized consultants.
What if you could run automated compliance audits locally, with no data leaving your servers, using open source AI?
That's what LGPD Sentinel AI does.
What is LGPD Sentinel AI?
LGPD Sentinel AI is an open source tool that automatically analyzes your codebase and infrastructure for LGPD compliance issues using a local LLM (llama3.1:8b via Ollama). Everything runs on your machine — no cloud API calls, no data exposure.
Stack:
- FastAPI (REST API backend)
- LangChain (LLM orchestration)
- Ollama + llama3.1:8b (local AI inference)
- Streamlit (web dashboard)
- SQLite (audit history)
- ReportLab (PDF report generation)
Key Features
- Automated code scanning — analyzes Python, JS, and config files for LGPD violations
- AI-powered analysis — uses LLM to understand context, not just keyword matching
- Compliance scoring — generates a 0-100 score per audit with risk classification
- PDF reports — professional reports ready to share with legal/DPO teams
- Audit history — all past audits stored locally in SQLite
- 100% local — llama3.1:8b runs via Ollama, zero external API calls
Getting Started
Prerequisites: Python 3.11+, Ollama installed with llama3.1:8b pulled.
# Clone the repo
git clone https://github.com/ldsjunior/lgpd-sentinel-ai
cd lgpd-sentinel-ai
# Start everything with Docker Compose
docker compose up --build
# Or use the start script
chmod +x start.sh && ./start.sh
The API runs on http://localhost:8000 and the Streamlit dashboard on http://localhost:8501.
How It Works
- Submit a path or code snippet to the /audit endpoint
- LangChain builds a prompt with LGPD compliance rules as context
- llama3.1:8b analyzes the code locally
- The response is parsed into structured findings with severity levels
- A compliance score is calculated and stored in SQLite
- Export results as a PDF report
API Endpoints
- POST /audit — Run a new compliance audit
- GET /audits — List all past audits
- GET /audits/{id} — Get audit details
- GET /audits/{id}/report — Download PDF report
- GET /health — Service health check
Why Local AI?
Privacy-by-design is a core LGPD principle. It would be ironic to send your source code to an external AI API just to check for privacy violations. With Ollama, the entire inference happens on your hardware. Your code never leaves your network.
Current Status
- 8 passing tests (pytest)
- Docker Compose setup ready
- Streamlit dashboard functional
- PDF export working
The project is actively developed. Contributions welcome!
Top comments (0)