Enterprise-Grade AI Compliance Agent for GDPR & Social Engineering Threats
Trustlayer Labsl is a stateful, multi-channel compliance monitoring system powered by the Portia AI SDK. It acts as an intelligent layer of protection across your organisation's internal communications — detecting policy violations, preventing sensitive data leaks, and flagging suspicious behavioural patterns such as social engineering attempts.
It not only monitors Slack, meeting transcripts, and (optionally) email, but also utilises powerful LLMs to provide explainable, contextual, and actionable risk analysis. The system simulates the workflow of an enterprise-grade compliance officer: observe, assess, escalate if needed — all with full transparency and human oversight.
- Applies company policy rules (GDPR + Social Engineering) via structured RAG
- Scans Slack conversations and meeting transcripts in real time
- Detects:
- Personal data exposure (GDPR Article 4)
- Unauthorised data sharing (GDPR Article 28)
- Poor data protection practices (GDPR Article 32)
- Social engineering risk phrases and tactics
- Uses Gemini 1.5 Pro (Google Generative AI)
- Returns structured reasoning in JSON format:
- Matched policy clause
- Confidence score
- Risk level (low/medium/high)
- Recommended action (ignore, redact, escalate)
- Natural-language explanation of what was risky and why
- Tracks number of violations per user
- Automatically escalates after repeated offences
- Implements per-user ignore timers ("Ignore for 24 hours")
- High-risk violations generate real-time email to compliance manager
- Email includes:
- Violation context
- Explanation
- Call-to-action link for escalation confirmation
- Flask-based portal for managers to confirm or dismiss escalations
- Manager actions recorded in logs
- Supports full audit trail for traceability and accountability
| Channel | Status | Notes |
|---|---|---|
| Slack | ✅ | Fully integrated via Portia SDK |
| Meeting Audio | ✅ | Transcribed via AssemblyAI, processed |
| Gmail (Optional) | 🔜 | API placeholder ready, coming soon |
| Portia Feature | Used | Description |
|---|---|---|
| Planning | ✅ | Agent declares intentions before acting |
| Clarification | ✅ | Manager confirmation for sensitive actions |
| Human-in-the-loop | ✅ | Portal + email approvals |
| Stateful memory | ✅ | Tracks user history and cooldown state |
| Multi-modal input | ✅ | Slack + transcript support |
| Explanation layer | ✅ | Reason shown to end-user and manager |
- Fetch new Slack messages or transcripts
- For each message:
- Check against internal policy via Gemini + RAG
- Log result, explanation, and confidence
- If severe or repeated: escalate
- Send email to compliance officer
- Portal UI: review, confirm or reject
- Save final incident state
| Layer | Technology Used |
|---|---|
| Agent Framework | Portia SDK |
| LLM Policy Reasoning | Gemini Pro (Google) |
| Audio Transcription | AssemblyAI |
| Communication Input | Slack, transcripts |
| Email Escalation | SMTP (Gmail + App Password) |
| Review UI | Flask |
| Persistent Logs | JSON |
Trustlayer-Labs/
├── run_agent.py # Main runner (Slack + transcripts)
├── review_portal.py # Flask portal for escalation
├── tools/ # Modular logic (LLM, email, memory)
├── scripts/ # Generators + helpers
├── data/ # Simulated inputs (Slack, Gmail, transcripts)
├── logs/ # Incident log, memory snapshots
├── reports/ # Markdown summaries
├── .env # API keys + email secrets
├── policy_rag.json # Internal policy rules
├── user_memory.json # Stateful tracking file
- Install dependencies:
pip install -r requirements.txt- Add credentials to
.env:
PORTIA_API_KEY=...
GEMINI_API_KEY=...
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password- Run the pipeline:
python scripts/run_agent.py- Launch the manager portal:
python review_portal.py- Full Gmail support (with IMAP or Gmail API)
- RAG tuning from user feedback (adaptive policies)
- Live dashboard with graphs and user behaviour insights

