ProjectBuild an AI-Powered Digital Bank with RAG: the explanation · Module 12: Guardrails and personal data masking · part 14 of 20
Part 14 · Module 12: Guardrails and personal data masking
Module 12: Guardrails and personal data masking
23 min read·
About 35 minutes · Needs: Module 9 (retrieval) and Module 10 (the agent graph) · Code: backend/app/agent/guardrails.py, backend/app/core/pii.py, backend/app/agent/stream_guard.py
Where this fits
Guardrails (blue: this module) wrap the agent and its models, and the same masker runs inside logs and traces.
Guardrails sit on both sides of the agent. Every customer message passes through them before the router sees it, and every answer passes through them before the customer sees it. The same personal data masker also runs inside logging and tracing, so this module touches the API, the agent, the model calls and observability.
The rest of this project is yours to keep
This project is bought on its own, once, and stays readable afterwards, including the parts added to it later.