Privacy-Minded Router for PII Detection
Detects sensitive PII in chat inputs using risk scoring and routes them through secure local sanitization or cloud LLMs with full audit...
What it does
You keep your sensitive personal information safe by having this agent automatically detect PII in your chat inputs and route them through secure local sanitization or compliant cloud models. It ensures full audit trails so you can meet GDPR and HIPAA standards without sacrificing performance on clean data.
Step by step
- Implement regex patterns for standard PII types like email addresses and phone numbers to create an initial filter layer.
- Define a risk scoring algorithm that assigns numerical weights to detected entities based on their sensitivity level.
- Configure the routing logic to direct low-risk requests to OpenRouter and high-risk requests to local Ollama instances.
Where the LLM does the work
- Prompt engineering is required to ensure the LLM accurately identifies context-specific PII that regex might miss.
- The system needs dynamic threshold tuning for risk scores based on specific regulatory requirements like GDPR or HIPAA.
- Generate sanitized response templates that maintain user intent while removing sensitive data fields effectively.
Watch out for
Tools that fit
The agent brief
You are helping me build the following AI agent workflow. ## Goal Privacy-Minded Router for PII Detection: Detects sensitive PII in chat inputs using risk scoring and routes them through secure local sanitization or cloud LLMs with full audit... ## Specification - What it does: You keep your sensitive personal information safe by having this agent automatically detect PII in your chat inputs and route them through secure local sanitization or compliant cloud models. It ensures full audit trails so you can meet GDPR and HIPAA standards without sacrificing performance on clean data. - Trigger: Triggered by an event (Manual · on demand) - Autonomy: Fully hands-off - Expected setup effort: about an afternoon - Tools/services involved: - Code: Logic and pattern detection - AI Agent: Context-aware classification - Ollama Chat Model: Local LLM processing - Simple Memory: State management - OpenRouter Chat Model: Cloud LLM routing ## Known pitfalls, handle each one explicitly in your implementation 1. Regex patterns can produce false positives on benign text so you must implement a secondary LLM verification step to reduce noise. 2. Local Ollama models may lack the nuance of cloud models for complex PII detection so benchmark them against your specific data set first. 3. Audit logs might inadvertently store raw PII if not carefully scrubbed before persistence so add a sanitization filter to the logging pipeline. 4. Latency spikes can occur when switching between local and cloud endpoints so implement circuit breakers to prevent cascading failures. ## Reference implementation https://n8n.io/workflows/5874 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/ai-privacy-minded-router-for-pii-detection/ via usecasesforagents.com
Frequently asked questions
Can I use a different LLM than Ollama?
Yes. Ollama is only the example LLM in this recipe. The same flow works with Anthropic, Cohere, DeepSeek and Google Gemini. Swap the LLM connection and keep the rest of the setup as written.
Want this running in your business?
Who it's for
Built for developers who want the busywork around code automated, not the code itself.
Ops-IT teams triaging their own internal requests get the same pattern, different queue.