Secure AI Sandboxing

Safely connect AI to your enterprise data

Spice gives each AI agent its own runtime with a filtered, read-only copy of the data it needs. Production databases stay behind your firewall, and task history records each query, model call, and tool call.

Diagram of the Spice.ai runtime sandboxing AI memory, tools, embeddings, and evals behind a firewall over Amazon S3, Snowflake, and PostgreSQL

Do more with your data

Spice limits what each agent can read and records what it does, from data refresh to model call.

100x

Up to 100x faster queries

80%

Up to 80% cost savings on data lakehouse spend

2x

increase in data reliability for critical workloads

Data-centric isolation

Data-centric isolation

Each agent queries a Spice runtime that holds only the datasets its Spicepod declares. Acceleration copies a filtered subset of each source table into a local engine, so the agent does not query the production database.

View the docs

Diagram of an AI agent in a VM or pod reading Iceberg tables through a Spice.ai accelerator, with fallback reads to the database
Principle of least privilege

Principle of least privilege

Datasets are read-only by default, and API keys are read-only unless they end in :rw. A model gets only the tools in its tools parameter and sees only the datasets in its datasets list.

View the docs

Diagram of per-customer Spice.ai instances scoping queries with WHERE customer filters before reaching shared data sources
Governed runtime access

Governed runtime access

Task history records each SQL query, model call, and tool call in the spice.runtime.task_history table. The OpenTelemetry exporter sends runtime metrics and logs. Spice.ai Enterprise adds Cedar policies for row filters, column masks, and roles.

View the docs

Diagram of agents, models, tools, and embeddings running inside the Spice.ai governed runtime with monitoring, policy, and a firewall
No database credentials in the agent

No database credentials in the agent

Spice runs next to your agents as a sidecar. The agent holds a Spice API key, not database credentials, and reads pre-materialized datasets. Sensitive tables stay behind your firewall, and frequent queries read from local memory or disk.

View the docs

Before-and-after diagram of an AI agent moving from direct Iceberg reads to accelerated reads through Spice.ai in a VM or pod

Integrations across all of your data sources

Spice has prebuilt connectors for databases, warehouses, and file stores, from Databricks and Amazon S3 to MySQL and PostgreSQL. Apply the same isolation pattern to every source an agent reads.

Deployed in production

Teams run Spice in production to give AI agents governed access to enterprise data.

Peter Janovsky

“Spice opened the door to take these critical control-plane datasets and move them next to our services in the runtime path.”

Peter Janovsky

Software Architect, Twilio

Darin Douglass

100x

Faster queries

“It just spins up and works, which is really nice. The responsiveness is amazing, which is a huge gain for the customer.”

Tim Ottersburg

“Partnering with Spice AI has transformed how NRC Health delivers AI-driven insights. By unifying siloed data across systems, we accelerated AI feature development, reducing time-to-market from months to weeks - and sometimes days. With predictable costs and faster innovation, Spice isn't just solving some of our data and AI challenges - it's helping us redefine personalized healthcare.”

Tim Ottersburg

VP of Technology, NRC Health

Rachel Wong

“Spice AI grounds AI in our actual data, using SQL queries across many data sources. This brings accuracy to probabilistic AI systems, which are very prone to hallucinations.”

Rachel Wong

CTO, Basis Set

FAQs

Answers to common questions about secure AI sandboxing in Spice

An AI sandbox in Spice is a Spice runtime that serves one agent or one tenant. It holds a filtered, read-only copy of the data that the agent needs, and only the tools in its Spicepod. Spice has no API that creates short-lived sandboxes. You deploy each runtime as a sidecar or a service, and your orchestrator, such as Kubernetes, starts and stops it.

Not by default. Datasets are read-only unless their access parameter is read_write, and API keys are read-only unless they end in :rw. Spice always runs SQL from the /v1/nsql text-to-SQL endpoint in read-only mode, and it rejects writes and schema changes.

Yes. Task history is on by default and records each SQL query, model call, and tool call. Query the records in the spice.runtime.task_history table, which keeps 8 hours by default. Set runtime.task_history.retention_period to keep records longer.

Spice encrypts traffic when you turn on TLS with runtime.tls.enabled: true. TLS is off by default, so turn it on for any network connection. Set runtime.tls.client_auth_mode to required for mTLS. Spice does not encrypt accelerated data at rest, so store file-mode accelerators on an encrypted volume.

Spice sandboxes the data an AI agent can reach, not the code the agent runs. Each agent, or each tenant, gets its own Spice runtime. That runtime holds a filtered, read-only copy of the data the agent needs, so the agent does not connect to the production database. Spice builds the sandbox in four steps:

  1. Declare: the agent's spicepod.yaml lists the datasets, models, and tools that the agent can use. A dataset that the Spicepod does not declare is not in the runtime catalog.
  2. Filter: the refresh_sql setting on each accelerated dataset selects the rows and columns that Spice copies from the source. Spice sends the filter to the source, so other rows stay in the source database.
  3. Scope: a model gets only the tools in its tools parameter, such as sql, search, and table_schema. Its tools query only the datasets in its datasets list. A model with no tools parameter gets no Spice tools.
  4. Trace: task history records each SQL query, model call, and tool call in the spice.runtime.task_history table.

The following Spicepod gives one tenant's agent a read-only copy of that tenant's orders:

version: v1
kind: Spicepod
name: tenant-acme-agent

datasets:
  - from: postgres:public.orders
    name: orders
    params:
      pg_host: ${secrets:PG_HOST}
      pg_db: app
      pg_user: ${secrets:PG_USER}
      pg_pass: ${secrets:PG_PASS}
      pg_sslmode: verify-full
    acceleration:
      enabled: true
      engine: cayenne
      mode: file
      refresh_check_interval: 10m
      refresh_sql: |
        SELECT order_id, status, total, created_at
        FROM orders
        WHERE tenant_id = 'acme'

models:
  - name: agent
    from: openai:gpt-4o-mini
    datasets:
      - orders
    params:
      openai_api_key: ${secrets:OPENAI_API_KEY}
      tools: list_datasets, table_schema, sql

To require an API key, set runtime.auth.api_key.enabled: true and list the key under runtime.auth.api_key.keys. The authentication docs show the full configuration. The agent then calls Spice with that key instead of database credentials:

curl http://localhost:8090/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -H "X-API-Key: $SPICE_AGENT_API_KEY" \
  -d '{"model": "agent", "messages": [{"role": "user", "content": "How many orders are still open?"}]}'

With the default settings, the agent's queries read the local copy from memory or disk, with no network round trip to the source. Serving LLM inference in Spice from the same runtime keeps each model next to the data it can use. The multi-tenant agents guide compares this pattern with the other isolation options. For a step-by-step walkthrough, read how to sandbox data access for AI agents.

Each control is a Spicepod setting. The defaults below apply when the setting is not present:

ControlSpicepod settingDefaultWhat it limits
Dataset catalogdatasetsEmptyThe tables that exist in the runtime
Row and column scopeacceleration.refresh_sqlAll rows and columnsThe data that Spice copies from the source
Row deletionacceleration.retention_sqlOffRemoves the rows that match a DELETE statement
Time windowacceleration.retention_period, with time_columnOffRemoves the rows older than the window
Write accessdataset accessreadInserts, updates, deletes, and schema changes
API keysruntime.auth.api_key.keysNo authenticationWho can call the runtime. Keys are read-only unless they end in :rw
Model toolsmodel params.toolsNo toolsThe tools that a model can call
Model datasetsmodel datasetsAll datasets in the runtimeThe datasets that a model's tools can query
Text-to-SQL/v1/nsql endpointAlways read-onlyGenerated SQL that writes data or changes the schema
Transport securityruntime.tls.enabled and runtime.tls.client_auth_modeOffPlain-text traffic, and clients without a certificate (mTLS)
Audit trailruntime.task_historyOn, 8 hours in memoryNothing. It records each query, model call, and tool call

The refresh_sql filter is a boundary only while queries stay on the local copy. Three settings send queries to the source table instead:

  • ready_state: on_registration or on_schema_resolved, before the first load completes.
  • on_zero_results: use_source, when the local copy returns no rows.
  • refresh_mode: caching, on a cache miss.

Keep the defaults (on_load and return_empty) for a sandbox. For a hard boundary, also connect Spice with a database user or view that can read only the tenant's rows. The two retention rows run only when acceleration.retention_check_enabled is true and retention_check_interval is set. The data refresh docs have the full rules.

A code sandbox, such as a container, a microVM, or a WebAssembly runtime, limits what an agent's code can do on a host. A Spice sandbox limits the data an agent can read and the tools it can call. Most production agents need both. Run the agent's code in a code sandbox, and send its data access through a Spice runtime. The Spice Docker image runs as a non-root user, which also limits the runtime itself.

The open-source runtime scopes access with dataset lists, read-only keys, and model allowlists. It has no row-level or role-based policy engine. Spice.ai Enterprise adds:

For agents that reach external systems, the MCP server gateway puts MCP tools under the same model tools list. To run the sandbox as a managed service, compare Spice Cloud and Enterprise plans.

See Spice in action

Walk through your use case with an engineer and see how Spice handles federation, acceleration, and AI integration for production workloads.

Talk to an engineer (opens in a new tab)