Hashlogics
Blog

Multi-Tenant AI Needs Isolation You Can Prove

Telling the model to only use one customer's data is an instruction, not a guarantee. Isolation has to live where the data lives.

The short version

5 things that decide this

  1. 01In a multi-tenant AI product, one customer's assistant answering from another customer's records is not a bug to patch. It means isolation was never built into the architecture.
  2. 02A system prompt that says 'only use this customer's data' is an instruction to the model, not a control the system enforces. Models follow instructions unevenly under load and under attack.
  3. 03Isolation belongs in the data layer: every retrieval query scoped to a tenant id before the model ever sees a result, not after.
  4. 04Go4Gr8's coaching platform and TankAware's site-management platform both run this way — tenant scoping and role tiers built into the query path, not the prompt.
  5. 05The test for whether isolation is real: try to retrieve another tenant's data through the assistant and confirm the query returns nothing, not that the model declines to repeat it.
The setup

The prompt is not the access control

A common shortcut in early multi-tenant AI builds: put every tenant's data in one shared index. Tell the model in the system prompt to only answer from the current customer's records. It works in the demo. Every test question comes from the tenant the demo is showing.

It stops working the moment retrieval pulls in a passage from a different tenant. Now the model has to refuse it, every time, under phrasing nobody tested. A prompt is a request, not a rule. A database query with no tenant filter returns whatever matches, and the model reads whatever the query returns.

In a single-tenant product, a data leak is a bug. In a multi-tenant product, it is a breach of contract with every customer whose data got exposed. That difference changes where the fix has to sit.

The mechanism

Scope the query before the model sees a result

The fix is not a smarter prompt. Tag every record with its tenant id at the point it enters the system. Filter on that id before retrieval runs, not after. The model never receives a candidate result from outside the tenant, so there is nothing for it to leak.

This is the same discipline as row-level security in a normal application. Your app already scopes a SQL query to the logged-in account. A retrieval pipeline needs the same scoping, applied at the query, not left to the model to police in the output.

Permission tiers add a second axis on top of tenant scoping. A tenant is not one flat account. Inside Go4Gr8's coaching platform, an organization admin, a team lead and an individual user each need a different slice of the same tenant's data. The AI agents they talk to have to respect that split too. Building the organization and role model was the real engineering work behind the platform's onboarding. The chat interface sits on top of it.

TankAware runs a sharper version of the same pattern. Each client company operates in its own environment under a dedicated subdomain, with five access tiers from Super Admin down to Contractor. A contractor at one petroleum site cannot pull inspection data from a site they are not assigned to. That boundary sits in the role and tenant model underneath the platform. It does not depend on the AI declining to mention it.

  • 01Tag every record with its tenant id at ingestion, not at query time.
  • 02Filter retrieval before the model sees results, so there is nothing to leak.
  • 03Add role tiers on top of tenant scoping where users inside one account need different access.
The proof

Prove it by trying to break it

A prompt-level fix looks the same as a data-layer fix in a normal test. Ask the assistant about another tenant's data, and it says it cannot help. The difference only shows up when you check what actually happened underneath the refusal.

With a real data-layer boundary, the query never returned another tenant's rows. Nothing reached the model to refuse. With a prompt-only boundary, the query returned the data and the model chose not to repeat it that time. The second version has no floor. Under a different phrasing, a longer context, or a model update, the same request can succeed.

Test for the difference directly. Log what the retrieval step actually returned, and compare it to what the model said back. If a cross-tenant record shows up in the retrieved set even once, alongside a polite refusal, the isolation lives in the wrong layer. The next request is not guaranteed to refuse.

Questions, answered

Questions this raises

01How do you isolate tenant data in a multi-tenant LLM application?

Tag every record with its tenant id when it enters the system, and filter retrieval by that id before the model sees any result. The model should never receive a candidate answer from outside the requesting tenant. A system prompt telling the model to ignore other tenants' data is not a substitute for this, because it depends on the model following the instruction every time under every phrasing.

02Is a system prompt enough to keep customer data separate in a SaaS AI product?

No. A system prompt is an instruction the model can follow inconsistently, especially under adversarial phrasing or after a model update changes its behavior. Real isolation happens in the retrieval query, scoped by tenant id. Then there is no cross-tenant data left for the model to see or repeat.

03What is per-customer data separation in an AI SaaS product?

It means each customer's data is tagged and filtered at the database or vector-index level. One account's queries can never retrieve another account's records. Role tiers add a further split inside one tenant, so different users at the same customer see only what their role allows.

Written by Abdul Basit, CEO, HashlogicsVerified
Start

Let’s build the one that runs after.

We build AI agents and automation, then stay on under an agreed service level. A senior engineer reads every brief, and your call gets scheduled within 24 hours.

What happens next

  1. 01

    You send a brief or book a call

    Two minutes, whichever you prefer.

  2. 02

    A senior engineer replies within 24 hours

    Not a sales rep.

  3. 03

    Honest scoping, in writing

    And if we’re not the right fit, we say so.

Abdul Basit, CEO of Hashlogics

“I started Hashlogics because too many teams ship a demo, get paid, and disappear. We build to a standard we’d run ourselves — and we stay to keep it running.”

Abdul Basit · CEO · a direct line

Not ready to talk? Take the checklist.

12 questions to ask any AI agency before you sign. They separate a demo shop from a team that ships to production.

Get the checklist

Free · no newsletter