# Spice

> A SQL, search and inference engine you run beside your database so agents query fresh local data

- Category: Cloud AI Platforms / Data-Platform AI
- Language: Rust
- Licence: Apache-2.0
- Repository: https://github.com/spiceai/spiceai
- Website: https://docs.spiceai.org
- Canonical page: https://ai-tldr.dev/tools/spice/

## In short

Spice is an open-source engine, written in Rust, that you deploy as a sidecar next to an application or agent and point at the databases, object stores and warehouses you already run. It sits in the Data-Platform AI category of the Cloud AI Platforms tools and is open-source, written in Rust and licensed Apache-2.0.

## Overview

Spice is an open-source engine, written in Rust, that you deploy as a sidecar next to an application or agent and point at the databases, object stores and warehouses you already run. It answers SQL, full-text and vector queries locally, materialises the slices of data it is asked for most often, and exposes an OpenAI-compatible endpoint so a model can be given that data without a separate retrieval service. The project describes the goal as building data-grounded AI apps and agents without first standing up an ETL pipeline.

The engine is assembled from established open-source pieces rather than a new storage format: Apache DataFusion for query planning, Apache Arrow for in-memory data, and DuckDB, SQLite, PostgreSQL or the project's own Vortex-based Cayenne format as acceleration targets. Over thirty connectors cover PostgreSQL, MySQL, MongoDB, Snowflake, Databricks, S3, Iceberg, Kafka, GitHub and more, with change-data-capture replication from PostgreSQL write-ahead logs, MySQL binlogs and MongoDB change streams, so a replica stays close to the source without Debezium or Kafka in between.

Because it is one binary, the same engine covers three quite different jobs: a local cache in front of a production database that keeps analytical load off it, a hybrid search layer combining BM25 (Tantivy), vector indexes and reciprocal rank fusion, and a gateway that serves models and embeddings from OpenAI, Anthropic, Azure, Bedrock, xAI or Hugging Face behind one API. Spice can also run as an MCP server, which is how agent frameworks reach its tables and search indexes.

## What it does

- Federated SQL across 30+ connectors — PostgreSQL, MySQL, MongoDB, Snowflake, Databricks, S3, Iceberg, Kafka, GitHub — planned by Apache DataFusion
- Acceleration engines (Cayenne on Vortex, Arrow, DuckDB, SQLite, PostgreSQL) that materialise hot data locally instead of re-querying the source
- Native change-data-capture from PostgreSQL WAL, MySQL binlog and MongoDB change streams, with no Debezium or Kafka deployment
- Hybrid search: BM25 via Tantivy, vector search via DuckDB HNSW, Elasticsearch kNN or Amazon S3 Vectors, plus rerank and RRF as SQL table functions
- OpenAI-compatible API gateway for hosted and local models, plus an MCP server so agents can call the same tables and indexes
- Deploys as a single binary, a Docker image, a Helm chart, or a scheduler/executor cluster for distributed query

## Getting started

Spice ships as a single `spice` binary. A project is a directory with a `spicepod.yaml` describing datasets, accelerations, models and search indexes; `spice run` starts the runtime and serves SQL, HTTP and the OpenAI-compatible endpoints.

1. Install the CLI

   macOS, Linux and WSL install from the project's script; Homebrew and a PowerShell installer are also published.

```bash
curl https://install.spiceai.org | /bin/bash

# or
brew install spiceai/spiceai/spice
```

2. Initialise a project

   `spice init` writes a Spicepod you can edit; the quickstart pod adds a sample dataset so there is something to query.

```bash
spice init spice_qs
cd spice_qs
spice add spiceai/quickstart
```

3. Start the runtime

   Leave this running — it loads the Spicepod, connects the sources and builds any accelerations you declared.

```bash
spice run
```

4. Query from the SQL REPL

   In a second terminal, open the REPL and query the accelerated dataset directly.

```bash
spice sql

sql> SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;
```

5. Run it as a container or a cluster

   The same runtime ships as a Docker image and a Helm chart; for distributed query, start scheduler and executor roles separately.

```bash
docker pull spiceai/spiceai

helm repo add spiceai https://helm.spiceai.org
helm install spiceai spiceai/spiceai
```

## When to use it

- Put an analytics replica beside a production PostgreSQL or MySQL database so dashboards and agents stop hammering the primary
- Give an agent one SQL and search surface over warehouses, object stores and SaaS APIs without copying everything into a vector database first
- Build hybrid retrieval — BM25 plus vectors plus reranking — as SQL, against data that stays where it lives
- Serve models and embeddings through one OpenAI-compatible endpoint that already has the application's data next to it
