Skip to content

Add GovernanceAdvisor for PII scanning and session token budget tracking - #6761

Open
Shreyas-Kumbhar wants to merge 1 commit into
spring-projects:mainfrom
Shreyas-Kumbhar:feature/governance-advisor
Open

Add GovernanceAdvisor for PII scanning and session token budget tracking#6761
Shreyas-Kumbhar wants to merge 1 commit into
spring-projects:mainfrom
Shreyas-Kumbhar:feature/governance-advisor

Conversation

@Shreyas-Kumbhar

Copy link
Copy Markdown

Adds a governance advisor that intercepts ChatClientRequest before it reaches
the model and enforces configurable policies.

What's included

  • GovernanceAdvisor — implements CallAdvisor + StreamAdvisor
  • GovernanceMode — OBSERVE (log only), MONITOR (log + audit), ENFORCE (block)
  • GovernanceDecision — immutable audit record per request
  • PiiScanner — regex detection of SSN, credit card, email, API keys/Bearer tokens
  • SessionCostTracker — per-session token budget with configurable limit
  • Spring Boot auto-configuration under spring.ai.advisor.governance.*, disabled by default
  • 48 tests, 0 failures

Scope

This is a Phase 1 implementation focused on the Spring AI integration layer.
PII detection uses regex heuristics (same approach as SafeGuardAdvisor).
Budget tracking is token-count based. Dollar-cost mapping and ML-based
PII detection are left for follow-up.

Closes #6683

Signed-off-by: Shreyas Kumbhar <kumbharshreyas07@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Governance Advisor for tool-call authorization, PII scanning, and cost budget enforcement

2 participants