Back to Briefing

Multi-Tenancy in AI Applications

Multi-Tenancy in AI Applications

In This Issue

  • Why authentication alone does not provide tenant isolation

  • Where cross-tenant leakage can enter an AI workflow

  • How to carry tenant identity through every component

  • When logical isolation is sufficient and when physical separation is justified

  • How to test whether the boundary survives real failures

The model should never decide the tenant boundary

A conventional application retrieves records, applies business logic, and returns a result.

An AI application may retrieve documents, assemble prompts, load conversation history, call tools, use cached responses, write memory, and pass intermediate results between agents. Each step creates another place where one customer’s information can enter another customer’s context.

The central rule is simple:

Tenant access must be enforced before data reaches the model.

Do not ask the model to respect tenant boundaries. Do not depend on a system prompt that says, “Only use information belonging to the current customer.” Do not retrieve broadly and expect the model to ignore unauthorized results.

The model is not the policy enforcement point.

Tenant isolation belongs in identity, authorization, data access, retrieval, memory, tool execution, and the surrounding application logic. The model should receive only the information that the current request is already authorized to use.

Authentication is only the beginning

Authentication answers: Who is making this request?

Tenant isolation answers: Which customer boundary applies to every resource touched by this request?

A user may be correctly authenticated and still access the wrong tenant if the application accepts a tenant identifier from the request, applies an incomplete database filter, searches a shared vector index without the right restriction, or reuses cached context created for someone else.

Tenant context should be derived from a trusted identity relationship maintained by the application. It should not come from free-form prompt text, a browser-supplied field, model output, or an agent’s interpretation of the user’s request.

A useful request identity contains at least:

  • The authenticated user

  • The tenant to which the session belongs

  • The role or permissions held within that tenant

  • The resource or operation being requested

Tenant identity then needs to travel with the request through the entire workflow.

If a background job, agent, retrieval service, or tool receives only a user ID without the tenant boundary, the isolation contract has already weakened.

Map every place context can cross the boundary

The database is only one isolation surface.

For an AI application, examine the full context path.

1. Source data

Tenant-owned records should carry an immutable tenant identifier. Access controls must apply to reads, writes, updates, exports, and background processing.

Application-level filtering is useful but fragile when it is the only control. Where the database supports it, row-level security or tenant-scoped roles can provide an additional enforcement layer.

The important question is not whether the query normally contains tenant_id. It is what happens when a developer forgets the filter, a new endpoint bypasses the repository layer, or an agent constructs a different query.

2. Vector stores and retrieval

Every embedded document chunk needs the tenant identity and any finer access classification required by the source.

A retrieval call must be scoped before similarity search returns results. Filtering after retrieval is weaker because unauthorized content has already crossed into the result set and may enter reranking, tracing, logs, or prompt construction.

Depending on the store and risk level, isolation may use:

  • Separate indexes or namespaces per tenant

  • A shared index with mandatory tenant metadata filters

  • Separate databases or accounts for higher-risk tenants

The application should prevent an unscoped retrieval call from being valid. Tenant scope should be required by the retrieval interface rather than left as an optional filter.

3. Prompt assembly

Prompt construction is where authorized data becomes model context.

The prompt builder should accept a verified tenant context and only assemble material returned by tenant-scoped services. It should not accept arbitrary records from upstream components without checking their provenance.

Treat every prompt component as carrying ownership:

  • System instructions

  • User messages

  • Retrieved documents

  • Conversation summaries

  • Tool responses

  • Saved preferences

  • Agent handoff state

Shared system instructions may be global. Customer-specific instructions, examples, terminology, policies, and uploaded files are tenant data.

A prompt template can be shared. The populated prompt cannot be assumed to be.

4. Conversation state and memory

Session history needs both a user scope and a tenant scope.

This matters when one person can belong to several organizations, when support staff can impersonate or assist customers, or when an account changes organizations. A memory keyed only to the user can carry one tenant’s information into a later session under another tenant.

Long-term memory needs the same controls as source data:

  • Explicit tenant ownership

  • Defined write authority

  • Tenant-scoped retrieval

  • Update and deletion rules

  • Auditable provenance

A model-generated summary remains tenant data. Compressing it does not remove its ownership.

5. Tools and agents

An agent may use the correct prompt context and still call a tool with excessive permissions.

Tools should receive short-lived, tenant-scoped authorization from the application. They should not inherit a broad service credential that can access every customer’s records.

The same rule applies to agent handoffs. Each handoff should carry a verified execution context, not merely natural-language instructions such as “continue working for Customer A.”

The receiving agent must not infer authority from the message. It should receive authority through the execution layer.

6. Caches and temporary storage

Caching can bypass otherwise sound controls.

Prompt caches, semantic caches, response caches, temporary files, queues, object storage, and model gateway caches all need tenant-aware keys and access rules.

A semantic cache is particularly sensitive. Two prompts can be similar while belonging to different tenants. A cache keyed only by semantic similarity can return a response containing another customer’s information.

The safe default is to partition cache lookup by tenant before applying exact or semantic matching.

7. Logs, traces, and evaluations

Observability systems often collect the richest copy of the workflow: prompts, retrieved chunks, tool arguments, model outputs, and errors.

Tenant boundaries must extend into these systems.

Decide which fields may be logged, who can search them, how long they remain, and whether support or engineering staff can see raw content. Evaluation datasets created from production traces must preserve tenant ownership and consent rules.

Redaction helps, but it does not replace access control. A trace containing sensitive customer information remains customer data even if it exists for debugging.

Choose the isolation model deliberately

Multi-tenancy does not require every customer to have separate infrastructure.

Three common models are useful:

Model

Structure

Best fit

Pooled

Shared services and storage with enforced tenant attributes

Large numbers of tenants with similar risk requirements

Partitioned

Shared platform with separate indexes, schemas, namespaces, keys, or queues

Stronger boundaries without fully duplicated infrastructure

Siloed

Dedicated infrastructure or service instances per tenant

Regulatory demands, customer-controlled keys, unusual risk, or contractual isolation

The choice can vary by component. An application may use a shared model endpoint, partitioned retrieval indexes, tenant-specific encryption keys, and a dedicated data store for selected customers.

The question is not “shared or dedicated?” for the entire system.

Ask where a boundary failure would expose sensitive data, how confidently the logical control can be enforced, and what level of separation the customer or regulation requires.

Make unsafe access difficult to express

Good isolation should not depend on every developer remembering every rule.

Build tenant scope into the interfaces:

retrieve(tenant_context, query)
load_memory(tenant_context, conversation_id)
call_tool(tenant_context, action, resource)
write_trace(tenant_context, event)

Reject missing tenant context. Reject conflicts between the authenticated tenant and the requested resource. Avoid generic administrative credentials inside normal request paths.

A tenant-scoped service should return no result by default when the policy is missing or cannot be evaluated. Ambiguity should fail closed.

This is stronger than adding tenant filters throughout the code after features have already been built.

Test the boundary as an adversary would

A normal happy-path test cannot establish tenant isolation.

Create at least two tenants with intentionally similar documents, prompts, identifiers, and conversation topics. Then test whether one tenant can cause the system to retrieve, infer, recall, cache, or expose information belonging to the other.

Include tests for:

  • Modified tenant identifiers in API requests

  • Missing retrieval filters

  • Similar queries against a semantic cache

  • Reused conversation and memory identifiers

  • Cross-tenant document references

  • Prompt injection inside retrieved documents

  • Agent tool calls using another tenant’s resource ID

  • Support and administrative workflows

  • Logs, traces, exports, and evaluation datasets

  • Background jobs operating outside the user session

Test both direct disclosure and indirect evidence. A system may reveal that another tenant has a document, customer, policy, or project without returning its full contents.

Run these tests whenever a component changes how tenant context is propagated or enforced.

The Move

Write a tenant-isolation contract for one AI workflow.

Define

Decision

Trusted tenant source

Where does the verified tenant identity originate?

Propagation rule

How does tenant context reach retrieval, memory, tools, caches, and logging?

Enforcement points

Which components reject access outside the tenant boundary?

Storage model

Which resources are pooled, partitioned, or siloed?

Fail-closed behaviour

What happens when tenant context is missing or conflicting?

Administrative access

Who may cross tenant boundaries, under what approval and audit trail?

Isolation test

What test proves that Tenant A cannot influence or observe Tenant B’s context?

Then deliberately remove one tenant filter in a controlled test environment.

If the next enforcement layer does not stop the request, the boundary depends on a convention rather than a control.

Worth Reading

The OWASP RAG Security Cheat Sheet treats chunk isolation as mandatory in multi-tenant retrieval systems and recommends enforcing access controls at retrieval time rather than after context has been assembled. RAG Security Cheat Sheet 

Takeaways

  • Derive tenant identity from trusted authentication state.

  • Carry tenant context through every component.

  • Enforce access before retrieval and prompt assembly.

  • Partition memory, caches, tools, traces, and evaluation data.

  • Never rely on the model or system prompt to maintain isolation.

  • Make unscoped access invalid by design.

  • Test cross-tenant leakage as a complete workflow failure.

If this helped you, leave a comment or your reaction. I’d like to hear where you landed.

INVENEW exists to help tech builders, operators, founders, and leaders turn AI from experiments into working systems.

SECURITY DEMO → GRC strategies for securing cloud AI: Join experts from Amazon Web Services (AWS) and SANS Institute for a hands-on security demo exploring how to apply governance, risk, and compliance (GRC) strategies across modern AI environments. See approaches for managing identity and agent access, protecting sensitive data, strengthening detection and response, and addressing risk across the AI lifecycle.

Note: Third-party company and product names belong to their respective owners and are used for identification and illustrative reference only.