Skip to content

Spring AI Privacy Guardrails

English | 한국어

Send tokens to the model. Give each tool only the originals its policy allows.


Watch the English demo on YouTube

Demo videos (YouTube): English · 한국어

Select the Protection You Need

What you need Start here
PII tokenization and per-tool original disclosure Privacy setup
Tool visibility and execution based on the user's permissions Tool authorization setup
Request and response checks using rules, ONNX or an HTTP model Content inspection setup

Use these features independently or together.

See It in Action

A customer asks for a delivery update with a customer ID and an email address. The model calls the lookup tool with tokens. Only the customer ID is restored for the tool, and PII in its result is protected again before it returns to the model.

A customer request passes through model-input protection, selective customer-ID disclosure and result protection before a delivery answer

This example uses a custom detection rule for customer IDs and a per-tool disclosure policy for the lookup tool.


Execution trace

Two model calls surround one customer lookup, and the final response passes output inspection. The application records model/tool calls and guardrail decisions together.

Recorded trace with two model calls, one customer lookup and a passing output inspection

Reference

Guide Covers
Getting Started Common setup and first steps for privacy protection, tool authorization and content inspection.
Configuration Dependencies, client creation, feature selection and policy reuse.
Sample Guide Inspector scenarios, expected results, endpoints, and language selection.
Privacy Protection Analyzers, tokenization, tool disclosure, output protection and processing limits.
Spring Security Tool Authorization Optional principal-aware tool discovery and execution checks, Tool Search, and asynchronous context.
Content Inspection Input and optional output inspection with rules, local ONNX text classification models or HTTP guard models.
Runtime Observation Recorded normal and blocked requests and Observer usage.
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.
Troubleshooting PII detection, rule selection, tool disclosure, authorization, streaming and inspection setup issues.

Sample

The sample application uses fixed examples to illustrate Local Tool, RAG, MCP, Security and Inspection. See the Sample Guide for scenarios and run instructions.

Privacy Boundary Inspector with Local Tool, RAG, MCP, Security and Inspection