Map

AI Engineer Track · Ai Safety Security

Multi-Tenant Isolation

Advanced~30 min

Multi-Tenant Isolation

Multi-tenant isolation is the guarantee that one customer's data, search results, and conversation history can never surface for a different customer, enforced at every layer a system touches: storage, search, memory, and whatever ends up in a given prompt. It has to be a hard technical boundary, not a convention everyone is trusted to follow correctly.

Why this matters

Cross-customer data leakage is a genuine breach, and it is the failure multi-tenant AI systems are most prone to, because retrieval and memory both cross customer boundaries the moment a permission filter is missing anywhere along the path. This is table stakes for any product serving more than one client through shared infrastructure.

Multi-tenant isolation

Multi-tenant isolation means one customer's data and behavior never leak into a different customer's experience, and in LLM systems specifically, the real leak surface is the retrieval index and the assembled context, not just the primary database. The hard rule is that every retrieval must filter by tenant, with no exception, and tenant A's documents must never be allowed to enter tenant B's context under any circumstance. The characteristic failure mode is cross-tenant retrieval, where tenant B's query returns tenant A's documents simply because a filter was forgotten somewhere in the pipeline or bypassed by a code path nobody reviewed carefully enough.

Tenant isolation is a filter applied on every single retrieval, enforced directly at the index itself. A missing filter is a genuine data breach, not a minor bug to fix whenever convenient.

Hardening multi-tenant LLM systems

Beyond filtering at the point of retrieval, a genuinely hardened multi-tenant boundary needs several additional layers. Isolating at every layer means the vector index, the database, any cache, and tracing data are all keyed by tenant consistently, not just the primary retrieval path. Scoping credentials per tenant means a given tenant's API access path can only ever reach that tenant's own data, never another's. Testing cross-tenant leakage means writing adversarial evaluations that explicitly assert tenant A can never see tenant B's content, including through subtler paths like semantic similarity matches or injection-style tricks. And guarding indirect paths means specifically reviewing anything shared across tenants by default, a shared cache, a shared embedding model, a shared prompt template, since any of these can quietly leak data across the tenant boundary if not reviewed carefully.

Tenant isolation has to be systematic across the index, the cache, credentials, and traces together, and it has to be tested with genuinely adversarial cross-tenant cases rather than simply assumed to hold.

Worked example

A shared response cache keyed only by the prompt's text, with no tenant identifier included in the cache key, can return tenant A's cached answer, containing tenant A's specific data, to tenant B's identical-looking query, a leak that a tenant-isolated retrieval filter alone would never have caught, since the leak happened entirely inside the cache rather than inside retrieval itself.

Practice

Build a two-tenant system and write negative tests proving tenant A's data, retrieval results, and memory can never reach tenant B. Confirm these negative tests pass at every layer, storage, retrieval, memory, and context, including a deliberately introduced missing-filter case that the test suite actually catches.

Interview checks

  • Why does a tenant filter applied only at the retrieval layer fail to guarantee full isolation?
  • What specifically makes a shared cache a realistic cross-tenant leak path?
  • Why does cross-tenant isolation need to be proven with a negative test rather than just a passing happy-path test?

Common failure modes

  • A tenant filter missing at just one layer, for instance applied correctly in retrieval but entirely absent from memory.
  • Filtering for tenancy in application code after a broad retrieval, by which point the data has already entered context.
  • Shared caches keyed without any tenant identifier, allowing cache poisoning or leakage across tenants.
  • Testing only the happy path, never writing the actual cross-tenant negative test that would catch a real leak.

Resources

  • OWASP GenAI (Agentic threats) — Covers multi-tenancy and data isolation risks specifically as they apply to agentic AI systems.
  • GDPR — The legal backdrop explaining why isolation matters beyond engineering concerns; cross-tenant leakage is a data breach with real regulatory consequences.

Expert signals

Enforcing tenant isolation as a hard invariant at every single layer rather than just the obvious one, writing genuine negative cross-tenant tests rather than only happy-path coverage, and treating even a single missing filter as an actual breach rather than a bug to schedule for later, is what separates a multi-tenant system that is actually safe from one that has simply never been tested against the right adversarial case.

Confidence

medium