Guide2 min read

Tenant Isolation in a Multi-Agent SaaS

Tenant isolation in a multi-agent SaaS: every resource attaches to one tenant user — verify forUser scoping and cross-tenant tests before production.

Read the docs →

Guide
TL;DR
  • Tenant isolation in a multi-agent SaaS is structural: every card, inbox, vault entry, and connection belongs to exactly one tenant user.
  • Enforce it with naive.forUser(customerId) on every agent call a scoped client cannot reach another user's resources.
  • Isolation is not a prompt instruction ('only act for the current user') prompts can be injected; platform boundaries cannot.
  • Verify before launch: create two tenant users, run the same action on both, confirm zero cross-reads.
  • Account Kits add a second layer even within one tenant, policy bounds what the agent may do.
  • OAuth connections and MCP sessions inherit the tenant user scope mint sessions per user, never share tokens.

You shipped multi-tenant auth in your SaaS. Your agent has a clever system prompt: "only act for the current user." That is not tenant isolation — it is a hope. Tenant isolation in a multi-agent SaaS means the platform rejects cross-tenant access even when the model misbehaves.

Multi-tenant AI agents explains the model. This post is the pre-production checklist for builders wiring Naïve today.

The isolation invariant

Every resource — cards, inboxes, vault entries, connections, sessions — attaches to exactly one tenant user. A scoped client can only reach that user's IDs.

Operator
  └── Account Kit (policy)
        └── tenant user A  →  resources {A}
        └── tenant user B  →  resources {B}

No shared bucket. No "current tenant" variable the model supplies.

Checklist: wiring

StepPass criteria
Create user on signupusers.create() per customer; store tenant_user_id in your DB
Scope every agent callnaive.forUser(storedId) — never the raw workspace client for customer actions
Mint sessions per userOne MCP session per customer run — see what is an MCP session
Per-user OAuthConnections on the tenant user — see OAuth for AI agents
Assign kits by tierStarter/Pro/Enterprise kits — not bespoke per-user JSON in app code

Checklist: testing

Run this before production:

  1. Create Alice and Bob as tenant users
  2. Alice's agent stores vault.put("key", "secret-a")
  3. Bob's scoped client calls vault.reveal("key")must fail (not-found or forbidden)
  4. Repeat for cards list, email send, connections list
  5. Add to CI — isolation regressions are silent until a customer reports a leak

Failure modes (avoid these)

Anti-patternWhy it breaks
Tenant ID in the promptInjection swaps the ID
Shared MCP sessionAll customers ride one credential
Workspace key in the agent runtimeOne leak exposes every tenant
Global in-memory cache keyed wrongCross-tenant data in one process

Isolation + policy

Isolation without Account Kits means Customer A's agent might still issue cards if your kit allows it — correctly, but dangerously. Tighten kits per tier after isolation tests pass.

Where to go next

Frequently Asked Questions
What is tenant isolation for AI agents?+
It means Customer A's agent cannot read, spend, or send as Customer B — ever. On Naïve, isolation is a property of the data model: every resource attaches to one tenant user, and naive.forUser(id) scopes API, SDK, MCP, and CLI calls to that user. A bug in your prompt cannot cross the boundary because the platform rejects out-of-scope resource IDs.
How is this different from multi-tenant AI agents?+
Multi-tenant AI agents is the concept — one agent per customer, the Operator → Account Kit → tenant user model. This post is the implementation checklist: how to wire forUser, what to test, and the failure modes that bypass isolation if you cut corners.
What is the most common isolation mistake?+
Using one workspace key and passing a tenant ID as a tool argument the model controls. A prompt injection can swap the ID. The fix is server-side scoping: resolve the tenant user from your authenticated session, call forUser(thatId), and never let the model choose the isolation boundary.
Do MCP sessions preserve tenant isolation?+
Yes — each session is minted for one tenant user. A session for User A cannot list or mutate User B's resources. Mint sessions in your backend after you know which customer the run belongs to; do not reuse one session across customers.
How do I test tenant isolation before shipping?+
Create tenant users Alice and Bob. Run the same governed action for each (send email, issue card, vault put). Attempt to read Alice's resource IDs from Bob's scoped client — expect not-found or forbidden. Automate this as an integration test in CI.
Does tenant isolation replace permission policy?+
No. Isolation answers whose resources; Account Kits answer what the agent may do with them. You need both — isolated but over-permissioned is still dangerous; well-permissioned but shared is still a cross-tenant leak.
NT
Naïve Team

Building the agent-native backend.

Keep reading