Spring AI Privacy Guardrails¶
English | 한국어
Keep detected PII out of the model. Reveal only what each trusted tool needs. Protect every tool result before returning it to the model or application.
Detection answers what text is sensitive. Spring AI Privacy Guardrails tokenizes detected PII before sending it to a model. Each detected value is replaced with an opaque token, a string that does not directly reveal the original value. It also limits which original values each tool may receive.
The optional Spring Security integration controls which tools are shown to the model and checks authorization before tool execution. It can be used independently of PII protection.
Featured In
- Spring Blog — Featured in This Week in Spring
- Spring AI Community — Listed in Awesome Spring AI's Extensions and Forks
See It in Action¶
The Privacy Boundary Inspector lets you compare the values received by the model and tools in Local Tool, RAG, and MCP scenarios. Security compares tool access for users with different roles.

See the Sample / Demo Guide for the complete Inspector workflow.
Reference¶
| Guide | Covers |
|---|---|
| Getting Started | Starter selection, basic setup, and model, tool, MCP, and output protection. |
| Sample / Demo Guide | Inspector scenarios, expected results, endpoints, and language selection. |
| Configuration | Starters, analyzers, output policy, tool disclosure, and processing limits. |
| Spring Security Tool Authorization | Optional principal-aware tool discovery and execution checks, Tool Search, and asynchronous context. |
| Architecture | Module boundaries, request sessions, evidence resolution, and execution lifecycle. |
| Threat model | Protected assets, trust boundaries, controls, limitations, and separately managed areas. |
| Evaluation | Boundary tests, the deterministic analyzer baseline, and repository benchmarks. |
Run the sample¶
The default sample uses a local ChatModel and requires no external model API key.
Open http://127.0.0.1:8080 to check how PII is protected in Local Tool, RAG,
and MCP scenarios, and compare role-based tool access in Security.
See the Sample / Demo Guide for the Inspector workflow and the full sample application guide for Presidio and OpenNLP profiles and integration examples.