Multi-Tenancy for AI Agents without the Pipelines

Spice AI

Data Federation

Engineering

Wyatt Wenzel

Wyatt Wenzel

DevRel & Ops Leader at Spice AIApril 15, 2026
Zero-ETL multi-tenant AI agents

TL;DR: Multi-tenant AI agents need access to customer data across disparate enterprise data sources, and building an ETL pipeline for every tenant doesn't scale. Spice.ai is a data and AI platform built on first principles for this category of use case, offering the optionality to deploy one sandboxed runtime per agent or tenant, all the way up to distributed multi-node query execution for larger workloads. This post walks through four patterns for deploying Spice as the data substrate for multi-tenant agents - each with different isolation guarantees, from logical filtering to fully sandboxed runtimes suited for regulated enterprise environments:

  1. Query-time tenant isolation
  2. Config-level tenant isolation
  3. Runtime-level tenant isolation
  4. Hybrid isolation

For more significant and variable SaaS workloads, we generally recommend the hybrid configuration, where large accounts get dedicated Spice instances, and the long tail shares a partitioned deployment.


The AI Agent Challenge in Multi-Tenant SaaS

Multi-tenant SaaS infrastructure has always been operationally complex. The pipeline-per-integration model works at small scale, but hits a wall when you have hundreds or thousands of customers, each with their own data lakes, databases, and warehouses. ETL pipelines encode assumptions about schema, refresh schedules, and ownership that collapse when customer environments change. This naturally leads to significant overhead dedicated to managing ETL orchestration.

AI agents that need to query across all of these sources with strict tenant isolation add another layer entirely, and push teams toward alternatives to ETL pipelines for AI agents such as federation and CDC.

Spice is designed for exactly this problem - a data platform for AI context that queries disparate enterprise data sources with tenant isolation and without ETL pipelines. It's the same foundation SaaS companies use with Spice for embedded analytics and per-tenant AI features on live operational data.

What Spice Enables

Spice is a portable data, search, and AI-inference engine built in Rust on Apache DataFusion. It connects to 30+ data sources (S3, Snowflake, Databricks, PostgreSQL, Kafka, and more) and accelerates queries locally for sub-second response times, serving SQL query, search, AI inference, and catalog APIs over HTTP, Arrow Flight, FlightSQL, ODBC, JDBC, and ADBC.

What makes Spice well-suited for multi-tenant agent deployments is its footprint and optionality. Unlike centralized clusters that require every tenant to share compute, memory, and query infrastructure, the Spice runtime is lightweight enough to deploy one instance per agent or per tenant, giving each agent its own sandboxed data and AI stack with its own sources, acceleration layers, and secrets. For workloads that demand it, Spice also supports distributed, multi-node query execution at scale. Isolation is a deployment property rather than something you enforce in application code - and the foundation for the kind of enterprise data policy controls that regulated industries increasingly require.

Multi-tenant agent deployment example
Figure 1: Ops, sales, and engineering agents each query their own Spice instance, which scopes results to that role.

The unit of configuration is a spicepod.yaml, a declarative manifest for datasets, models, and secrets.

We call this out because tenant topology, source definitions, and acceleration behavior are all configured at this layer, making it the right abstraction for understanding the deployment patterns below.

Animation: an agent for tenant abc reads its events under three deployments. With a query filter on a shared table, the WHERE clause is the boundary, so the same read without it also returns tenant xyz's rows. With a dataset per tenant, the request names tenant_abc_events and gets only abc's rows, while xyz's dataset sits in the same shared runtime. With a runtime per tenant, the app's tenant map sends the request to tenant abc's own runtime, which holds no other tenant's data.SHARED RUNTIMEQUERY FILTERPATTERN 1AGENTTENANT ABCSELECT * FROM eventseventsabcxyzabcxyzMISSED FILTERSHARED RUNTIMEDATASET PER TENANTPATTERN 2AGENTTENANT ABCSELECT * FROMtenant_abc_eventstenant_abc_eventsabcabctenant_xyz_eventsxyzxyzBOUNDARYTENANT-ABC RUNTIMETENANT-XYZ RUNTIMERUNTIME PER TENANTPATTERN 3AGENTTENANT ABCSELECT * FROM eventsAPPTENANT MAPeventsabcabceventsxyzxyzBOUNDARYMULTI-TENANT AGENTS · TENANT BOUNDARYILLUSTRATIVE · 2 TENANTS · 4 ROWS

Figure 2: A missed query filter returns tenant xyz's rows to abc's agent; a per-tenant dataset returns only abc's rows from a shared runtime; a per-tenant runtime holds only abc's data.

Pattern 1: Query-Time Tenant Isolation

This is the simplest operating model; one runtime serves many tenants. Datasets include tenant-partitioned tables, and the application always includes tenant filters in queries.

version: v1
kind: Spicepod
name: saas-shared

datasets:
  - from: postgres:public.events
    name: events
    params:
      pg_host: db.shared.internal
      pg_port: '5432'
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}
    acceleration:
      enabled: true
      engine: arrow
      refresh_check_interval: 1s

What this Spicepod is doing:

  • version, kind, and name define a standard Spicepod manifest and runtime identity.
  • datasets declares which source objects are queryable through Spice.
  • from: postgres:public.events maps to one shared table that contains many tenants.
  • params keeps connection settings explicit, while secrets stay externalized.
  • acceleration.refresh_check_interval: 1s keeps local acceleration refreshes frequent.

Tradeoff summary:

  • Pros: easiest to operate and cheapest to start.
  • Cons: tenant isolation is logical. Correctness depends on consistent tenant filtering in every query path.

Variant: View-Based Tenant Isolation

A lightweight extension of Pattern 1 moves tenant filtering from application code into the Spicepod itself using views. Each tenant gets a named view that wraps the shared dataset with a pre-applied filter. Agents query the view directly rather than constructing filters at runtime.

datasets:
  - name: events
    from: postgres:public.events
    params: ...

views:
  - name: view_tenant_abc
    sql: "select * from events where tenant='tenant_abc'"
  - name: view_tenant_xyz
    sql: "select * from events where tenant='tenant_xyz'"

This makes tenant boundaries explicit in configuration without the overhead of separate dataset entries or multiple runtimes. The tradeoff is the same as Pattern 1 (isolation is still logical), but the filter is enforced at the Spice layer rather than relying on every query path in the application to get it right.

Animation: one shared Spice runtime holds one events dataset with rows for tenants abc and xyz. The agent for tenant abc queries view_tenant_abc. The view's WHERE clause returns only abc's rows. The agent for tenant xyz queries view_tenant_xyz and gets only xyz's rows. The isolation is logical: both tenants' rows stay in the same runtime.SHARED RUNTIMEeventsabcxyzabcxyzAGENTTENANT ABCview_tenant_abcWHERE tenant = 'tenant_abc'abcabcAGENTTENANT XYZview_tenant_xyzWHERE tenant = 'tenant_xyz'xyzxyzVIEW PER TENANT · ONE RUNTIMEILLUSTRATIVE · 2 TENANTS · 4 ROWS

Figure 3: Each tenant's agent queries its own view. The view's filter returns only that tenant's rows from the shared events dataset.

Pattern 2: Config-Level Tenant Isolation

This pattern keeps one runtime but makes tenant boundaries explicit in configuration by declaring separate dataset entries per tenant. In practice, these entries are generated from onboarding metadata.

version: v1
kind: Spicepod
name: saas-many-datasets

datasets:
  - from: postgres:tenant_abc.events
    name: tenant_abc_events
    params:
      pg_host: db.pool.internal
      pg_port: '5432'
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}

  - from: postgres:tenant_xyz.events
    name: tenant_xyz_events
    params:
      pg_host: db.pool.internal
      pg_port: '5432'
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}

  # In production this list can be generated from tenant onboarding metadata.

What this Spicepod is doing:

  • Each dataset name maps to a tenant-specific schema/table boundary.
  • Isolation intent is encoded directly in configuration, not only at query time.
  • The runtime still remains shared, so scheduling and memory are shared concerns.

Tradeoff summary:

  • Pros: tenant boundaries are explicit in config and easier to audit.
  • Cons: the manifest can become very large, and operational limits (reload time, config management, memory planning) become the bottleneck at very high tenant counts.

Pattern 3: Runtime-Level Tenant Isolation

For strict isolation, run a separate Spicepod per tenant (or per enterprise tenant tier). The application reads the tenant from auth/session claims and sends each request to that tenant's runtime.

spicepod-tenant-abc.yaml:

version: v1
kind: Spicepod
name: tenant-abc

datasets:
  - from: postgres:public.events
    name: events
    params:
      pg_host: tenant-abc-db.internal
      pg_port: '5432'
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}
    acceleration:
      enabled: true
      engine: duckdb
      mode: file
      refresh_check_interval: 1s
      params:
        duckdb_file: /var/lib/spice/tenant-abc.db

The application keeps the tenant-to-runtime mapping, for example as an endpoint column in its tenant table, and queries the runtime that the mapping names. This is the sharded deployment architecture: one application to N Spice instances.

What this deployment is doing:

  • Each tenant runtime has an independent manifest, compute envelope, and cache.
  • Tenant routing is structural. Requests do not cross tenant runtime boundaries.
  • You can apply stronger SLOs and controls to selected tenants.

Tradeoff summary:

  • Pros: clearest isolation model and per-tenant operational control.
  • Cons: higher operational overhead as tenant count grows.
Animation: an app holds a tenant map. The agent for tenant abc sends its query, the app looks up abc in the map, and the query goes to the tenant-abc runtime, which holds only abc's rows. The same happens for tenants xyz and def, each with its own runtime. The app picks the runtime for each query.APPTENANT MAPTENANT-ABC RUNTIMEeventsabcabcTENANT-XYZ RUNTIMEeventsxyzxyzTENANT-DEF RUNTIMEeventsdefdefAGENTTENANT ABCabc: tenant-abcAGENTTENANT XYZxyz: tenant-xyzAGENTTENANT DEFdef: tenant-defRUNTIME PER TENANT · TENANT MAP IN THE APPILLUSTRATIVE · 3 TENANTS · 1 APP, 3 RUNTIMES

Figure 4: The app looks up each tenant in its own tenant map and queries the runtime that the map names. Each runtime holds one tenant's data.

Pattern 4: Hybrid Isolation

Most SaaS businesses follow a power-law distribution. A small cohort of high-value accounts justifies dedicated infrastructure, while the long tail is better served by shared infrastructure.

Large tenants run on dedicated Spicepods. Smaller tenants run in a shared, partitioned deployment. The application maps each tenant to its runtime, so agents and clients keep one query interface.

Each dedicated tenant runs a Spicepod like spicepod-tenant-abc.yaml from Pattern 3. The long tail shares one Spicepod, partitioned with a view per tenant:

spicepod-shared.yaml:

version: v1
kind: Spicepod
name: shared

datasets:
  - from: postgres:public.events
    name: events
    params:
      pg_host: db.shared.internal
      pg_port: '5432'
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}
    acceleration:
      enabled: true
      engine: arrow
      refresh_check_interval: 1s

views:
  - name: view_tenant_def
    sql: "select * from events where tenant='tenant_def'"
  - name: view_tenant_ghi
    sql: "select * from events where tenant='tenant_ghi'"

What this deployment is doing:

  • Keeps the query interface stable while allowing tenant placement by policy.
  • Isolates high-load or regulated tenants on dedicated runtimes.
  • Uses shared capacity for the long tail to control cost and ops overhead.

Tradeoff summary:

  • Pros: best long-term balance of isolation, cost, and operational scalability.
  • Cons: requires a tenant-to-runtime map in the application and clear promotion criteria for moving tenants between tiers.
Animation: an app holds a tenant map. Tenant abc maps to its own dedicated runtime. Tenants xyz and def map to one shared runtime that holds both tenants' rows. Then the app promotes xyz: its map entry changes from shared to tenant-xyz, a dedicated tenant-xyz runtime starts with xyz's rows, and the agent's next query goes there. The agent's query does not change.APPTENANT MAPTENANT-ABC RUNTIMEeventsabcabcTENANT-XYZ RUNTIMEeventsxyzxyzSHARED RUNTIMEeventsdefdefAGENTTENANT ABCabc: tenant-abcAGENTTENANT XYZxyz: tenant-xyzAGENTTENANT DEFdef: sharedHYBRID PLACEMENT · TENANT MAP IN THE APPILLUSTRATIVE · 3 TENANTS · 1 APP, 3 RUNTIMES

Figure 5: Tenant abc has a dedicated runtime, and xyz and def share one. To promote xyz, the app changes one map entry and starts a runtime for it. The agent's query stays the same.

Getting Started

The right deployment shape depends on your workload: the scale of your tenant base, your isolation requirements, and how frequently each tenant's data is queried. Spice connects to 30+ sources through declarative configuration, so adding a new data source is a YAML entry rather than a pipeline build.

Explore the Spice docs to go deeper on the patterns covered here, or join the Spice Slack community to discuss your architecture with the team.

To design a multi-tenant deployment with the team, get a demo or review Spice Cloud pricing.

Share
twitter logolinkedin logomailto logo

Zero-ETL Multi-Tenant AI Agents FAQ

Zero-ETL means querying tenant data in place through federation and only accelerating the datasets that need low-latency repeated reads. Instead of pipeline code per tenant, teams configure source access and refresh behavior in Spicepods.

Use shared runtimes for long-tail tenants with moderate traffic. Use dedicated Spicepods for high-load, high-sensitivity, or regulated tenants. Most production systems use a hybrid placement model and promote tenants based on observed thresholds.

Use CDC acceleration for hot operational datasets that are queried frequently and require predictable low latency. Use federation for colder datasets where source-of-truth freshness matters more than sub-second response times.

Yes. Spice federates across disparate enterprise data sources and exposes a unified SQL interface. Your app or agent can keep one query layer while the runtime routes each table scan to accelerated or federated paths as configured.

AI agents connect to Spice through the same interfaces applications use: SQL over HTTP, Arrow Flight, ODBC, JDBC, and ADBC. Spice also acts as an MCP server gateway. Agents that use the Model Context Protocol reach tenant data as governed tools rather than raw database connections. Because each runtime exposes only the datasets declared in its Spicepod, the connection path inherits whatever isolation pattern the deployment uses.

No, Spice queries tenant sources in place and the source system remains the system of record. Acceleration materializes a local, query-optimized copy of hot datasets for low-latency reads, configured per dataset rather than per pipeline. For how a materialized working set differs from a conventional cache, see caching versus data acceleration.

Onboarding a tenant is a configuration change. Teams add dataset entries to a shared Spicepod, generate a per-tenant manifest from onboarding metadata, or provision a dedicated runtime for the account. Connection details, secrets, and acceleration behavior are declared in YAML, so no extraction or transformation code is written per tenant. Offboarding is the reverse: remove the entries or retire the runtime.

Yes, each Spicepod declares its own sources, so one tenant can run on PostgreSQL while another runs on Snowflake or S3. Spice connects to more than 30 sources through declarative configuration, and agents query all of them through the same SQL interface. This matters in practice because customer environments rarely standardize on one stack.

Accelerated datasets stay current through scheduled refreshes, controlled by refresh_check_interval. They can also use real-time change data capture, which streams source changes into the acceleration layer without full-table refreshes. Freshness is configured per dataset, so a hot operational table can refresh every second and colder reference data less often.

No, Spice serves vector and full-text search from the same runtime that serves SQL. Each tenant's search indexes live inside the same isolation boundary as their datasets. Running a separate per-tenant vector database would reintroduce the per-tenant infrastructure sprawl that this architecture removes.

The most common mistake is relying on application code to apply the tenant filter on every query path. A single missed filter can return one tenant's rows to another tenant's agent. Enforcing boundaries in configuration, through views, per-tenant datasets, or dedicated runtimes, makes isolation a property of the deployment instead of query discipline.