Spring AI Privacy Guardrails

Spring AI Privacy Guardrails is an open-source Java library providing runtime privacy protection, tool authorization, and content inspection for Spring AI applications.

Privacy protection replaces detected PII with request-scoped opaque tokens before supported content is sent to an LLM. Per-tool disclosure policies allow only approved PII entity types to be restored before tool execution. Detected PII in tool results is tokenized before being returned to the model.

Spring Security integration restricts tool visibility based on the current user’s permissions and checks authorization before execution. When combined with privacy protection, authorization is checked before original values are restored.

Content inspection supports configurable rules, local ONNX classifiers, and HTTP-based guard models for model inputs and optional final responses. When privacy protection and inspection are combined, detected PII in model requests is tokenized before external inspection.

The three features can be enabled independently or combined through a Spring AI ChatClient. Supported integrations cover RAG content, chat memory, and MCP tools at the model and tool boundaries. The project is licensed under Apache 2.0.

Ask Sage, GenAI Security Advisor
Scroll to Top

Spring AI Privacy Guardrails