AgenticLong read

Multi-Tenant Data Isolation for Agentic SaaS Platforms

Gateway checks aren't enough; isolation must live in the execution graph.

· 9 min read · Updated
Cover illustration for “Multi-Tenant Data Isolation for Agentic SaaS Platforms”
Agentic · October 22, 2026 · 9 min read · 2,011 words

Multi-tenant data isolation for agentic SaaS platforms requires enforcement at the API gateway and inside the execution graph. Storage boundaries, tenant identity, and data policies must be in place before the first tenant goes live. For API-first and agent-first teams building on Supabase, the analytics architecture is a separate, governed data layer that exposes tenant-scoped datasets through APIs and MCP tools without requiring a prebuilt dashboard UI.

Why multi-tenant isolation fails deeper than the API for agentic SaaS

The standard application pattern validates tenant_id at the HTTP gateway and enforces it in API middleware. That protects requests passing through those checks. An agent, however, can generate code, call internal tools, and traverse sub-agent retrieval chains after the original request has passed the gateway. File reads and memory queries can therefore reach data through paths the perimeter never inspected. Authentication at entry does not authorize every subsequent operation.

Blaxel describes the underlying inversion as a change in who controls the code that runs. Traditional SaaS executes code chosen by the platform, while an agent can generate its workload from a customer prompt. That code is untrusted until independently constrained. OWASP directs teams to “treat the model as any other user” and validate everything it produces. The consequence is architectural rather than conversational, because asking an agent to respect tenant boundaries cannot substitute for making unauthorized access impossible at the data layer.

How the execution graph creates three distinct leakage surfaces

The compute sandbox is the first leakage surface. A runaway process in a shared container pool can exhaust CPU and memory for co-located tenants. Containers also share the host kernel, so a kernel exploit can threaten neighboring workloads across tenant process boundaries. Kubernetes documentation describes containers as offering “a weaker isolation boundary” than hardware-based virtual machines. Resource contention and security compromise are distinct failures at the same boundary.

The file and vector store forms the second surface, including the stores that support retrieval and agent memory. Agents both consume and modify this data. When files share one S3 bucket or embeddings share one vector index, application filtering may be the only separation between tenants. Semantic search adds a particular risk because retrieval is approximate. Missing or incorrectly applied metadata filters can return a relevant match that belongs to the wrong customer.

The identity propagation chain is the third surface. An agent acting as the data-access principal can become a confused deputy if it loses the requesting user’s tenant context. A user from tenant A can then induce it to retrieve tenant B’s data under the agent’s broader authority. These surfaces fail independently of one another. They map to three early architectural decisions that teams rarely revisit, namely the execution boundary, the storage model, and the source of authority for data access.

The three isolation models and what each one actually protects

Silo isolation gives each tenant its own infrastructure, including vector databases and file storage buckets. It provides the strongest separation of tenant data and confines failures to the affected infrastructure. The trade-off is operational as well as financial. Maintaining and updating separate resources becomes difficult as tenant count grows, making silo designs most appropriate when regulatory exposure justifies the cost.

Pool isolation shares infrastructure and separates access through metadata filters and namespace controls. It works well for platforms that serve many small-to-medium tenants at lower cost. Its weakness is dependence on correct filtering. Hybrid namespace isolation also shares infrastructure but places data within explicit logical boundaries, such as vector namespaces and filesystem workspaces. These labels overlap in practice, and AWS treats namespace isolation as an option within the pool model, so it is not always a separate category.

Compute protection remains a separate architectural choice. Amazon Bedrock AgentCore runs each user session in a dedicated microVM with isolated CPU, memory, and filesystem resources. Blaxel describes microVMs as providing dedicated guest kernels enforced by hardware virtualization, with less than five MiB of memory overhead per VM. That weakens the historical cost objection to VM-based isolation, although per-tenant cost remains a consideration. Kubernetes v1.32’s Agent Sandbox feature makes this approach available as a platform primitive, so teams can use it without building custom infrastructure. For agent-generated workloads, namespace-separated data and microVM compute address different parts of the same exposure.

Propagating tenant identity through every layer of the agent stack

AWS’s AgentCore implementation demonstrates an identity chain that begins before the agent executes. Amazon Cognito issues JWTs with custom claims, such as a department claim, that a pre-token generation hook adds. AgentCore Runtime validates the JWT through an inbound authorizer. The token establishes identity. Lambda-based MCP tools exposed through AgentCore Gateway then receive the JWT, decode tenant and role claims, and set PostgreSQL session variables that Aurora PostgreSQL RLS uses to enforce tenant scope.

The distinction between validation and extraction is important. Runtime validation does not remove the tools’ responsibility to apply the claims to data access. Each backend layer must preserve the same authenticated context rather than replace it with an agent-supplied tenant identifier. A message saying “I am from company A” is not proof of membership. Treating it as proof turns prompt injection into a path for impersonation.

Attribute-Based Access Control follows this rule with policies based on attributes that come from validated claims. Database and storage policies restrict access to resources matching that context. Every endpoint should therefore use OAuth or JWT middleware, with each agent context sandboxed against escalation. Tool permissions need their own enforcement point. Admin-role users may access data-modifying MCP tools, while regular users must be denied that access by the tool layer using the same validated claims.

What MCP changes about data isolation — and what it does not solve

MCP standardizes how agents discover tools and request data. It does not supply the underlying authorization boundary. In a stateless MCP server, each call must contain enough information for the server to validate identity, enforce policy, and log the operation without relying on retained session context. Statelessness changes request handling while preserving accountability requirements. A thin proxy that forwards calls without these checks simply moves the isolation gap behind a standard interface.

Semantic bypass is a concrete risk for Supabase builders. If the tool manifest exposes raw query tools as well as approved metric endpoints, an agent can use the raw path and bypass the governance embedded in those endpoints. The safe pattern exposes only pre-modeled, semantically grounded datasets. Cost amplification needs a separate control. Many small calls from agents can quickly use up shared query budgets, so the MCP layer needs per-tenant rate limits.

A governed data layer gives these tools a constrained surface to query. With pre-calculated, policy-enforced datasets, agents have no need to hold production database credentials, read raw schemas, or write their own SQL. This also supports headless analytics access through tools and APIs, independently of a dashboard. MCP provides the interface, while the data layer beneath it controls which tenant can read which data.

Row-level security in Supabase — what it enforces and where it breaks

Supabase uses RLS as the database authorization layer. Client code reaches the auto-generated API with the user’s JWT rather than relying on an Express controller to decide access. Policies therefore protect data even when requests originate outside the intended application flow. The public anon key is shipped to browsers. An incorrect policy can consequently expose data through the public API, making policy correctness especially consequential when agents issue queries at machine speed.

The first bug class is inadequate write validation. USING governs access to existing rows, while WITH CHECK constrains the values a write may produce. Write policies need to stop an allowed update from changing protected ownership or tenant values. Agents increase the exposure by constructing operations developers did not anticipate. The second bug class is credential exposure, because service_role bypasses RLS completely. Giving that key to an agent lets it read and write across tenants even when the policies are otherwise correct.

The third class involves policies that reference unprotected related tables. A query can bring a related row into scope through a different path, so referenced tables also need RLS policies that the requesting role can pass. Agents may follow those paths with queries that developers did not expect. Performance can compound these failures operationally when unindexed policy predicates drive scans and repeated auth.uid() checks raise CPU use under concurrency. Indexing policy columns, enabling pg_stat_statements, and monitoring connection count, query latency, and error rate help expose timeouts and cascading connection drops before agent traffic magnifies them.

Why the analytics access pattern breaks RLS and what to do instead

Production policies built around auth.uid() control what each user can access in the application. Analytics often needs a different scope. A BI service account or agent calculating tenant-wide metrics must aggregate rows beyond an individual user’s permitted view while still remaining inside the tenant boundary. That is a mismatch between authorization models. Asking one production schema to express both patterns entangles application permissions with analytics access.

Two common responses create new liabilities. A role that bypasses RLS gives the analytics consumer broader authority than the application’s policies allow. Alternatively, analytics-shaped policies introduce roles and aggregation requirements into a production authorization model not designed for them. Neither approach creates a separate safety boundary. The recommended resolution is Postgres logical replication from Supabase into a dedicated analytics tier, leaving strict per-user RLS in production and applying tenant-scoped controls to read-heavy, aggregate-heavy workloads elsewhere.

For teams asking which analytics backend fits full API control without an opinionated frontend, the relevant criteria follow from that separation. The backend should expose governed datasets through APIs and MCP tools, enforce tenant scope, and support pre-modeled metrics without granting production database access. Agents and BI consumers query that layer instead. Usage analytics can then be consumed through an agent tool without requiring a prebuilt dashboard UI. The decisive comparison is not between interfaces, but between direct production queries and a dedicated data layer designed to authorize aggregate access.

The implementation sequence that enforces isolation before the first tenant goes live

The work starts with architecture, moves through policy and configuration, and ends with putting it all into operation. Each stage depends on the one before it. Tool design cannot compensate for missing identity, and monitoring cannot repair a schema that never encoded tenant boundaries.

First, choose the isolation model before writing the schema. Silo isolation fits when regulatory exposure calls for separate infrastructure and makes it worth the cost, while hybrid namespace isolation is the default recommended here for most agentic SaaS products. App-layer filtering alone should not be assumed sufficient for agents that generate arbitrary queries.

Second, establish identity propagation before building tools. Validate JWT claims through the backend and pass tenant and role claims to the database and MCP tools. The tenant must come from authenticated identity, never from conversation.

Third, check RLS before an agent sends its first query. Confirm write constraints through WITH CHECK, keep the service role key out of client-side and agent-side code, and protect every table referenced by a policy with its own applicable RLS policy.

Fourth, index every column used in an RLS predicate, including user_id, tenant_id, and account_id where applicable. Enable pg_stat_statements and establish connection count, query latency, and error rate dashboards at the same time. Query volume should not be the first policy stress test.

Fifth, scope every MCP tool before exposing it. File reads need workspace roots, vector searches must use namespace filtering, and the public tool manifest must leave out raw query tools. Per-tenant rate limits are the last part of this configuration stage.

Sixth, separate analytics before the first dashboard or agent report. Stream production events through logical replication into a governed analytics layer, and pre-model the metrics agents will consume. Agents and BI consumers should query only that layer.

Seventh, deploy the compute boundary appropriate to the workload. Containers suit platform-controlled code, microVMs suit agent-generated or customer-supplied code, and a hybrid accommodates both.

Isolation must be enforced wherever the execution graph can reach data or run code, because a confused agent or attacker needs only one missing boundary.

Sources

  1. Data isolation & security in multi-tenant AI agent for SaaS
  2. Building multi-tenant agents with Amazon Bedrock AgentCore
  3. The 2026-07-28 MCP Specification Release Candidate
Filed underAgentic

More in Agentic