1. Anatomy of a retrieval turn
Every turn that touches a knowledge base runs the same sequence:- The question is embedded. The customer’s message is converted to a vector, together with a few rephrased variations of the same question for better recall. The vectors, not keywords, are what get matched against your stored chunks.
- Every search carries a scope. Each attached knowledge base is queried with a mandatory filter: a chunk is a candidate only if it carries your tenant identifier (the same schema-scoped tenant name written at ingest time, stored on the chunk as the
tenantIdpayload field) and the knowledge base’s own identifier (knowledgeBaseId). A chunk that matches neither your workspace nor the queried knowledge base is excluded regardless of how high its similarity score is. - Top-K and score threshold resolve in a fixed order. A per-knowledge-base override beats the agent-level retrieval setting, which beats the platform default. Values are clamped to platform bounds and malformed values are rejected, so a misconfigured agent can never widen retrieval past the platform’s limits.
- Attached knowledge bases are capped per turn. The workspace setting
max_knowledge_bases_per_agentlimits how many of an agent’s attached knowledge bases are queried in one turn. It defaults to 3, clamps to 1–10, and if the setting cannot be read the turn proceeds with the legacy default of 3.
2. The isolation layers
Scoping is layered, and each layer has a distinct job:- Per-workspace collections. Knowledge bases are indexed into a collection named for your organization. This is the primary isolation guard: a retrieval against your collection physically cannot see chunks stored under another organization’s collection.
- Payload filters on the shared collection. Some retrieval paths query the platform’s shared chunk collection, where the only scoping is the payload filter from section 1 — the tenant and knowledge-base match clauses. Correctness on those paths rests on the filter being complete on every call.
- Strict isolation as defense in depth. The workspace setting
strict_rag_isolationadds a third mandatory clause — your organization identifier — to shared-collection queries. With the toggle on, even a hypothetical filter bug that dropped the other clauses could not return another workspace’s chunks, because the organization clause is required independently of them.
3. Grounding integrity
After the model answers, a post-check re-embeds the answer and matches it against the same knowledge base’s chunks, under the same scoping discipline as retrieval: the tenant and knowledge-base clauses are mandatory, and a call that lacks a tenant scope aborts the check rather than running an unscoped search. The top three matches are averaged; when the average similarity falls below the 0.7 floor, the answer is flagged as potentially unsupported by the knowledge base. The check is only as good as its filter’s field names. The match clauses must use exactly the payload keys the indexer writes — camelCasetenantId and knowledgeBaseId. An earlier version of the check matched on a key style the indexer never wrote, so it found zero chunks and every answer scored as consistent regardless of content; the mismatch was caught in an April 2026 audit and fixed. The current contract keeps retrieval and the post-check on one shared scoping discipline so the two cannot drift apart.
The fail-open contract is deliberate: when the check cannot run — no knowledge base attached, an embedding failure, or zero matching chunks — the answer proceeds instead of being blocked. The post-check is a quality and observability layer, not a retrieval gate. The scoping in sections 1 and 2 is the part that never fails open.
4. PII redaction of retrieved context
Retrieved chunks pass two independent gates before entering the model context, and redaction is disabled only when both gates allow it:- The workspace setting
rag_pii_redaction, on by default. - The per-agent safety setting
pii_redaction, on by default.
5. Tenant-owned configuration
These controls are posture, not certification
Every setting above is tenant-owned: you tune how retrieval behaves and how strictly it is scoped for your workspace. They configure your retrieval posture; they are not a compliance certification, and switching one off neither adds nor removes any regulatory obligation. The platform-wide boundary these controls sit inside is described in Tenant isolation.Cross-references
- AI agent architecture — section 2 covers where retrieval sits in the turn.
- The knowledge-base ingestion pipeline — section 6 covers what ingestion hands to retrieval.
- Grounding citations — the per-turn audit trail of the chunks an answer cited.
- PII egress guard model — the full redaction gate model across agent egress paths.
- Tenant isolation — the per-tenant schema boundary every other model inherits.