Quick revision
The short answer
The platform team ships a Spring Boot starter with standard advisors for PII redaction, safety checks, memory with approved repositories, retrieval with tenant filters and audit logging, in a fixed, documented order with named slots where teams add their own advisors. Around it come policies for memory retention, encryption and deletion, consistent metrics and traces, and a versioned release process with contract tests so teams can upgrade Spring AI safely.
What to remember
In this answer, we designed a platform starter that gives every assistant the same advisors for redaction, safety, approved memory, tenant-filtered retrieval and audit logging, in a fixed order with named slots for team advisors. We set memory rules for retention, encryption, deletion and regulated flows, added consistent tags for metrics and traces, and made upgrades safe with a versioned starter and contract tests that teams run in their own builds.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The platform team ships a Spring Boot starter with standard advisors for PII redaction, safety checks, memory with approved repositories, retrieval with tenant filters and audit logging, in a fixed, documented order with named slots where teams add their own advisors. Around it come policies for memory retention, encryption and deletion, consistent metrics and traces, and a versioned release process with contract tests so teams can upgrade Spring AI safely.
Why this question is asked
When several teams build assistants on their own, each one solves the same problems a little differently: one redacts emails, another forgets to; one keeps chat history forever, another in memory only; logs and metrics cannot be compared. Every difference is a potential privacy incident and makes support harder. Interviewers ask senior engineers this question to see whether they can design a shared platform that removes repeated work without blocking teams. In this answer, we will look at the starter and its advisors, the fixed order and extension slots, the memory policy, observability, and how to version and test it.
1Why a Shared Starter
A Spring Boot starter is a dependency that brings auto-configuration with it: add it to the build, and beans are created with sensible defaults. If the platform team ships an assistant starter, a team gets redaction, safety, memory, retrieval and audit logging by adding one dependency and a few properties. The value is consistency: the security review is done once for the starter, not twelve times for twelve assistants.
The starter does not replace Spring AI. It configures Spring AI's ChatClient and advisors the way the company has agreed, so teams still write ordinary ChatClient code.
2The Standard Advisors
The starter registers a small set of advisors that every assistant needs. A PII redaction advisor removes personal data from user text before anything stores or sends it. A safety advisor blocks clearly disallowed input or output, using Spring AI's SafeGuardAdvisor for simple word lists or a call to a moderation model for real content checks. A memory advisor uses only repositories the platform has approved, such as the company's PostgreSQL through the JDBC repository. A retrieval advisor always applies a tenant filter to vector searches, so a team cannot accidentally search another customer's documents. An audit advisor records who asked what and which model answered, in redacted form.
- Audit loggingoutermost: sees every request and final response
- PII redactionbefore anything stores or sends text
- Safety check
SafeGuardAdvisoror moderation call - Team slot: before retrievaldomain rules, query rewriting
- Memoryapproved repositories only
- Retrieval with tenant filterfilter added by the platform
- Team slot: before modellast-minute prompt additions
- Model call
8 layers, from the top down. Step through them one at a time.
3A Fixed Order With Named Slots
Advisors run in getOrder() sequence, and the wrong order causes real bugs: memory before redaction stores raw personal data, retrieval before the tenant filter returns other customers' documents. So the platform fixes the order centrally and publishes it as constants, with gaps between them where teams may place their own advisors.
Notice that teams never pick raw numbers. They pick a slot, and the documentation says what is already true in that slot: in TEAM_EARLY the text is already redacted and checked, but no history or documents have been added yet. A startup check in the starter can log a warning or fail if an advisor uses an order outside the published slots.
4Memory Policy
Chat memory is personal data, so the platform sets the rules. Each assistant declares a retention period, for example 30 days, and a scheduled job deletes older conversations. Storage is encrypted at rest, and the starter offers a delete-by-user operation that removes every conversation of a user when a privacy request arrives, which only works if every repository is keyed and indexed by user. For regulated flows, such as anything touching health or payment data, memory is off by default and a team must request it with a reason.
The reason for defaults that lean towards less memory is that a team can always ask for more; data that was never stored can never leak.
5Consistent Observability
Spring AI already instruments ChatClient, models, advisors and vector stores with Micrometer observations. The starter adds the business tags every team must have: service, feature, tenant, model and prompt version. It also records advisor decisions as metrics, for example how often the safety advisor blocked a request or how many chunks retrieval returned. With the same names everywhere, one dashboard and one set of alerts covers every assistant, and a trace shows each advisor as a step inside the user's request.
6Versioning and Contract Tests
Spring AI moves quickly, and an upgrade can change advisor interfaces or default behaviour. The platform team owns the upgrade: it releases a new starter version aligned with a Spring AI version through the Spring AI BOM, with release notes that say what changed for teams. Contract tests ship with the starter as a test library. They check the promises teams depend on, for example that an email in the input never reaches the stored memory or the captured model request, that every vector search carries a tenant filter, and that metrics have the required tags. Teams run them in their own build, so an upgrade that breaks a promise fails in CI, not in production.
- Upgrade Spring AI in the starter
- Run platform contract tests
- Release to two pilot teams
- Pilot teams' tests and evaluations pass?YesPublish to all teams with notesNoFix and re-release
4 steps in order. Play them, or step through them one at a time.
7Follow-up questions
How do you allow a team to opt out of an advisor safely?
Make opt-out explicit, narrow and recorded. The starter exposes a property per advisor, for example platform.ai.redaction.enabled=false, but turning a protective advisor off also requires a reason property and is reported at startup and in a central register. For the most sensitive ones, such as tenant filtering, the starter refuses to start without an approval key from the security review. Teams can also replace an advisor with their own implementation if it passes the same contract tests, which is usually safer than simply removing it.
Why not put all of this in an AI gateway instead?
A gateway is good for keys, rate limits and cost tags, but it cannot see application context such as which tenant's documents may be retrieved or which conversation a message belongs to. Most of these policies need that context, so they belong in the application, in the starter.
How do you stop the starter from becoming a bottleneck?
Keep it small, accept contributions from teams through an inner-source process, and provide extension slots so most domain needs do not require a platform change.
8Conclusion
In this answer, we designed a platform starter that gives every assistant the same advisors for redaction, safety, approved memory, tenant-filtered retrieval and audit logging, in a fixed order with named slots for team advisors. We set memory rules for retention, encryption, deletion and regulated flows, added consistent tags for metrics and traces, and made upgrades safe with a versioned starter and contract tests that teams run in their own builds.
Open with
I would have the platform team ship a Spring Boot starter on top of Spring AI that every assistant uses. It registers standard advisors: PII redaction, a safety check with SafeGuardAdvisor or a moderation model call, memory that only uses approved repositories, retrieval that always adds a tenant filter, and audit logging.
Then, if they want more
The order is fixed centrally as published constants with gaps, so redaction always runs before memory and retrieval, and teams put their domain advisors into named slots with documented guarantees. For memory, the policy sets retention per assistant, encryption at rest, delete-by-user for privacy requests, and no memory by default for regulated flows.
For observability, the starter adds common tags like service, feature, tenant, model and prompt version to Spring AI's Micrometer observations, plus metrics for advisor decisions, so one dashboard covers all teams.
The starter is versioned with Spring AI through the BOM, rolled out through pilot teams, and ships contract tests that teams run in CI, for example that an email never reaches stored memory and every search has a tenant filter. Opting out of an advisor is possible but explicit, justified and reported.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring AI reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Several product teams build assistants with Spring AI and each implements memory...": https://scrivio-interview-library.netlify.app/spring-boot/spring-ai/2c0eb1d18c/