Spice is a SQL query and AI compute engine, written in Rust, for data-driven apps and agents.
Spice provides three industry standard APIs in a lightweight, portable runtime (single ~140 MB binary):
- SQL Query APIs: Arrow Flight, Arrow Flight SQL, ODBC, JDBC, and ADBC.
- OpenAI-Compatible APIs: HTTP APIs compatible the OpenAI SDK, AI SDK with local model serving (CUDA/Metal accelerated) and gateway to hosted models.
- Iceberg Catalog REST APIs: A unified Iceberg Catalog API.
🎯 Goal: Developers can focus on building data apps and AI agents confidently, knowing they are grounded in data.
Spice is primarily used for:
- Data Federation: SQL query across any database, data warehouse, or data lake. Learn More.
- Data Materialization and Acceleration: Materialize, accelerate, and cache database queries. Read the MaterializedView interview - Building a CDN for Databases
- AI apps and agents: An AI-database powering retrieval-augmented generation (RAG) and intelligent agents. Learn More.
If you want to build with DataFusion or using DuckDB, Spice provides a simple, flexible, and production-ready engine you can just use.
📣 Read the Spice.ai OSS announcement blog post.
Spice is built-on industry leading technologies including Apache DataFusion, Apache Arrow, Arrow Flight, SQLite, and DuckDB.
🎥 Watch the CMU Databases Accelerating Data and AI with Spice.ai Open-Source
Spice simplifies building data-driven AI applications and agents by making it fast and easy to query, federate, and accelerate data from one or more sources using SQL, while grounding AI in real-time, reliable data. Co-locate datasets with apps and AI models to power AI feedback loops, enable RAG and search, and deliver fast, low-latency data-query and AI-inference with full control over cost and performance.
-
AI-Native Runtime: Spice combines data query and AI inference in a single engine, for data-grounded AI and accurate AI.
-
Application-Focused: Designed to run distributed at the application and agent level, often as a 1:1 or 1:N mapping between app and Spice instance, unlike traditional data systems built for many apps on one centralized database. It’s common to spin up multiple Spice instances—even one per tenant or customer.
-
Dual-Engine Acceleration: Supports both OLAP (Arrow/DuckDB) and OLTP (SQLite/PostgreSQL) engines at the dataset level, providing flexible performance across analytical and transactional workloads.
-
Disaggregated Storage: Separation of compute from disaggregated storage, co-locating local, materialized working sets of data with applications, dashboards, or ML pipelines while accessing source data in its original storage.
-
Edge to Cloud Native: Deploy as a standalone instance, Kubernetes sidecar, microservice, or cluster—across edge/POP, on-prem, and public clouds. Chain multiple Spice instances for tier-optimized, distributed deployments.
Feature | Spice | Trino / Presto | Dremio | ClickHouse | Materialize |
---|---|---|---|---|---|
Primary Use-Case | Data & AI apps/agents | Big data analytics | Interactive analytics | Real-time analytics | Real-time analytics |
Primary deployment model | Sidecar | Cluster | Cluster | Cluster | Cluster |
Federated Query Support | ✅ | ✅ | ✅ | ― | ― |
Acceleration/Materialization | ✅ (Arrow, SQLite, DuckDB, PostgreSQL) | Intermediate storage | Reflections (Iceberg) | Materialized views | ✅ (Real-time views) |
Catalog Support | ✅ (Iceberg, Unity Catalog) | ✅ | ✅ | ― | ― |
Query Result Caching | ✅ | ✅ | ✅ | ✅ | Limited |
Multi-Modal Acceleration | ✅ (OLAP + OLTP) | ― | ― | ― | ― |
Change Data Capture (CDC) | ✅ (Debezium) | ― | ― | ― | ✅ (Debezium) |
Feature | Spice | LangChain | LlamaIndex | AgentOps.ai | Ollama |
---|---|---|---|---|---|
Primary Use-Case | Data & AI apps | Agentic workflows | RAG apps | Agent operations | LLM apps |
Programming Language | Any language (HTTP interface) | JavaScript, Python | Python | Python | Any language (HTTP interface) |
Unified Data + AI Runtime | ✅ | ― | ― | ― | ― |
Federated Data Query | ✅ | ― | ― | ― | ― |
Accelerated Data Access | ✅ | ― | ― | ― | ― |
Tools/Functions | ✅ | ✅ | ✅ | Limited | Limited |
LLM Memory | ✅ | ✅ | ― | ✅ | ― |
Evaluations (Evals) | ✅ | Limited | ― | Limited | ― |
Search | ✅ (VSS) | ✅ | ✅ | Limited | Limited |
Caching | ✅ (Query and results caching) | Limited | ― | ― | ― |
Embeddings | ✅ (Built-in & pluggable models/DBs) | ✅ | ✅ | Limited | ― |
✅ = Fully supported ❌ = Not supported Limited = Partial or restricted support
- OpenAI-compatible API: Connect to hosted models (OpenAI, Anthropic, xAI) or deploy locally (Llama, NVIDIA NIM). AI Gateway Recipe
- Federated Data Access: Query using SQL and NSQL (text-to-SQL) across databases, data warehouses, and data lakes with advanced query push-down for fast retrieval across disparate data sources. Federated SQL Query Recipe
- Search and RAG: Search and retrieve context with accelerated embeddings for retrieval-augmented generation (RAG) workflows. Vector Search over GitHub Files
- LLM Memory and Observability: Store and retrieve history and context for AI agents while gaining deep visibility into data flows, model performance, and traces. LLM Memory Recipe | Monitoring Features Documentation
- Data Acceleration: Co-locate materialized datasets in Arrow, SQLite, and DuckDB with applications for sub-second query. DuckDB Data Accelerator Recipe
- Resiliency and Local Dataset Replication: Maintain application availability with local replicas of critical datasets. Local Dataset Replication Recipe
- Responsive Dashboards: Enable fast, real-time analytics by accelerating data for frontends and BI tools. Sales BI Dashboard Demo
- Simplified Legacy Migration: Use a single endpoint to unify legacy systems with modern infrastructure, including federated SQL querying across multiple sources. Federated SQL Query Recipe
- Unified Search with Vector Similarity: Perform efficient vector similarity search across structured and unstructured data sources. Vector Search over GitHub Files
- Semantic Knowledge Layer: Define a semantic context model to enrich data for AI. Semantic Model Feature Documentation
- Text-to-SQL: Convert natural language queries into SQL using built-in NSQL and sampling tools for accurate query. Text-to-SQL Recipe
- Model and Data Evaluations: Assess model performance and data quality with integrated evaluation tools. Language Model Evaluations Recipe
-
Is Spice a cache? No specifically; you can think of Spice data acceleration as an active cache, materialization, or data prefetcher. A cache would fetch data on a cache-miss while Spice prefetches and materializes filtered data on an interval, trigger, or as data changes using CDC. In addition to acceleration Spice supports results caching.
-
Is Spice a CDN for databases? Yes, a common use-case for Spice is as a CDN for different data sources. Using CDN concepts, Spice enables you to ship (load) a working set of your database (or data lake, or data warehouse) where it's most frequently accessed, like from a data-intensive application or for AI context.
BI.dashboard.acceleration.with.Spice.mp4
See more demos on YouTube.
Name | Description | Status | Protocol/Format |
---|---|---|---|
databricks (mode: delta_lake) |
Databricks | Stable | S3/Delta Lake |
duckdb |
DuckDB | Stable | Embedded |
file |
File | Stable | Parquet, CSV |
github |
GitHub | Stable | GitHub API |
dremio |
Dremio | Release Candidate | Arrow Flight |
graphql |
GraphQL | Release Candidate | JSON |
mysql |
MySQL | Release Candidate | |
postgres |
PostgreSQL | Release Candidate | |
s3 |
S3 | Release Candidate | Parquet, CSV |
databricks (mode: spark_connect) |
Databricks | Beta | Spark Connect |
delta_lake |
Delta Lake | Beta | Delta Lake |
flightsql |
FlightSQL | Beta | Arrow Flight SQL |
mssql |
Microsoft SQL Server | Beta | Tabular Data Stream (TDS) |
odbc |
ODBC | Beta | ODBC |
snowflake |
Snowflake | Beta | Arrow |
spark |
Spark | Beta | Spark Connect |
spice.ai |
Spice.ai | Beta | Arrow Flight |
abfs |
Azure BlobFS | Alpha | Parquet, CSV |
clickhouse |
Clickhouse | Alpha | |
debezium |
Debezium CDC | Alpha | Kafka + JSON |
dynamodb |
Amazon DynamoDB | Alpha | |
ftp , sftp |
FTP/SFTP | Alpha | Parquet, CSV |
http , https |
HTTP(s) | Alpha | Parquet, CSV |
iceberg |
Apache Iceberg | Alpha | Parquet |
localpod |
Local dataset replication | Alpha | |
sharepoint |
Microsoft SharePoint | Alpha | Unstructured UTF-8 documents |
mongodb |
MongoDB | Coming Soon | |
elasticsearch |
ElasticSearch | Roadmap |
Name | Description | Status | Engine Modes |
---|---|---|---|
arrow |
In-Memory Arrow Records | Release Candidate | memory |
duckdb |
Embedded DuckDB | Release Candidate | memory , file |
postgres |
Attached PostgreSQL | Release Candidate | N/A |
sqlite |
Embedded SQLite | Release Candidate | memory , file |
Name | Description | ML Format(s) | LLM Format(s) |
---|---|---|---|
file |
Local filesystem | ONNX | GGUF, GGML, SafeTensor |
huggingface |
Models hosted on HuggingFace | ONNX | GGUF, GGML, SafeTensor |
spice.ai |
Models hosted on the Spice.ai Cloud Platform | ONNX | OpenAI-compatible HTTP endpoint |
openai |
OpenAI (or compatible) LLM endpoint | - | OpenAI-compatible HTTP endpoint |
azure |
Azure OpenAI | - | OpenAI-compatible HTTP endpoint |
anthropic |
Models hosted on Anthropic | - | OpenAI-compatible HTTP endpoint |
xai |
Models hosted on xAI | - | OpenAI-compatible HTTP endpoint |
Catalog Connectors connect to external catalog providers and make their tables available for federated SQL query in Spice. Configuring accelerations for tables in external catalogs is not supported. The schema hierarchy of the external catalog is preserved in Spice.
Name | Description | Status | Protocol/Format |
---|---|---|---|
databricks |
Databricks | Alpha | Spark Connect, S3/Delta Lake |
unity_catalog |
Unity Catalog | Alpha | Delta Lake |
spice.ai |
Spice.ai Cloud Platform | Alpha | Arrow Flight |
iceberg |
Apache Iceberg | Alpha | Parquet |
glue |
AWS Glue | Coming Soon | JSON, Parquet, Iceberg |
quickstart.mp4
Step 1. Install the Spice CLI:
On macOS, Linux, and WSL:
curl https://install.spiceai.org | /bin/bash
Or using brew
:
brew install spiceai/spiceai/spice
On Windows:
curl -L "https://install.spiceai.org/Install.ps1" -o Install.ps1 && PowerShell -ExecutionPolicy Bypass -File ./Install.ps1
Step 2. Initialize a new Spice app with the spice init
command:
spice init spice_qs
A spicepod.yaml
file is created in the spice_qs
directory. Change to that directory:
cd spice_qs
Step 3. Start the Spice runtime:
spice run
Example output will be shown as follows:
Spice.ai runtime starting...
2024-08-05T13:02:40.247484Z INFO runtime::flight: Spice Runtime Flight listening on 127.0.0.1:50051
2024-08-05T13:02:40.247490Z INFO runtime::metrics_server: Spice Runtime Metrics listening on 127.0.0.1:9090
2024-08-05T13:02:40.247949Z INFO runtime: Initialized results cache; max size: 128.00 MiB, item ttl: 1s
2024-08-05T13:02:40.248611Z INFO runtime::http: Spice Runtime HTTP listening on 127.0.0.1:8090
2024-08-05T13:02:40.252356Z INFO runtime::opentelemetry: Spice Runtime OpenTelemetry listening on 127.0.0.1:50052
The runtime is now started and ready for queries.
Step 4. In a new terminal window, add the spiceai/quickstart
Spicepod. A Spicepod is a package of configuration defining datasets and ML models.
spice add spiceai/quickstart
The spicepod.yaml
file will be updated with the spiceai/quickstart
dependency.
version: v1
kind: Spicepod
name: spice_qs
dependencies:
- spiceai/quickstart
The spiceai/quickstart
Spicepod will add a taxi_trips
data table to the runtime which is now available to query by SQL.
2024-08-05T13:04:56.742779Z INFO runtime: Dataset taxi_trips registered (s3://spiceai-demo-datasets/taxi_trips/2024/), acceleration (arrow, 10s refresh), results cache enabled.
2024-08-05T13:04:56.744062Z INFO runtime::accelerated_table::refresh_task: Loading data for dataset taxi_trips
2024-08-05T13:05:03.556169Z INFO runtime::accelerated_table::refresh_task: Loaded 2,964,624 rows (421.71 MiB) for dataset taxi_trips in 6s 812ms.
Step 5. Start the Spice SQL REPL:
spice sql
The SQL REPL inferface will be shown:
Welcome to the Spice.ai SQL REPL! Type 'help' for help.
show tables; -- list available tables
sql>
Enter show tables;
to display the available tables for query:
sql> show tables;
+---------------+--------------+---------------+------------+
| table_catalog | table_schema | table_name | table_type |
+---------------+--------------+---------------+------------+
| spice | public | taxi_trips | BASE TABLE |
| spice | runtime | query_history | BASE TABLE |
| spice | runtime | metrics | BASE TABLE |
+---------------+--------------+---------------+------------+
Time: 0.022671708 seconds. 3 rows.
Enter a query to display the longest taxi trips:
SELECT trip_distance, total_amount FROM taxi_trips ORDER BY trip_distance DESC LIMIT 10;
Output:
+---------------+--------------+
| trip_distance | total_amount |
+---------------+--------------+
| 312722.3 | 22.15 |
| 97793.92 | 36.31 |
| 82015.45 | 21.56 |
| 72975.97 | 20.04 |
| 71752.26 | 49.57 |
| 59282.45 | 33.52 |
| 59076.43 | 23.17 |
| 58298.51 | 18.63 |
| 51619.36 | 24.2 |
| 44018.64 | 52.43 |
+---------------+--------------+
Time: 0.045150667 seconds. 10 rows.
Using the Docker image locally:
docker pull spiceai/spiceai
In a Dockerfile:
from spiceai/spiceai:latest
Using Helm:
helm repo add spiceai https://helm.spiceai.org
helm install spiceai spiceai/spiceai
The Spice.ai Cookbook is a collection of recipes and examples for using Spice. Find it at https://github.com/spiceai/cookbook.
Access ready-to-use Spicepods and datasets hosted on the Spice.ai Cloud Platform using the Spice runtime. A list of public Spicepods is available on Spicerack: https://spicerack.org/.
To use public datasets, create a free account on Spice.ai:
-
Visit spice.ai and click Try for Free.
-
After creating an account, create an app to generate an API key.
Once set up, you can access ready-to-use Spicepods including datasets. For this demonstration, use the taxi_trips
dataset from the Spice.ai Quickstart.
Step 1. Initialize a new project.
# Initialize a new Spice app
spice init spice_app
# Change to app directory
cd spice_app
Step 2. Log in and authenticate from the command line using the spice login
command. A pop up browser window will prompt you to authenticate:
spice login
Step 3. Start the runtime:
# Start the runtime
spice run
Step 4. Configure the dataset:
In a new terminal window, configure a new dataset using the spice dataset configure
command:
spice dataset configure
Enter a dataset name that will be used to reference the dataset in queries. This name does not need to match the name in the dataset source.
dataset name: (spice_app) taxi_trips
Enter the description of the dataset:
description: Taxi trips dataset
Enter the location of the dataset:
from: spice.ai/spiceai/quickstart/datasets/taxi_trips
Select y
when prompted whether to accelerate the data:
Locally accelerate (y/n)? y
You should see the following output from your runtime terminal:
2024-12-16T05:12:45.803694Z INFO runtime::init::dataset: Dataset taxi_trips registered (spice.ai/spiceai/quickstart/datasets/taxi_trips), acceleration (arrow, 10s refresh), results cache enabled.
2024-12-16T05:12:45.805494Z INFO runtime::accelerated_table::refresh_task: Loading data for dataset taxi_trips
2024-12-16T05:13:24.218345Z INFO runtime::accelerated_table::refresh_task: Loaded 2,964,624 rows (8.41 GiB) for dataset taxi_trips in 38s 412ms.
Step 5. In a new terminal window, use the Spice SQL REPL to query the dataset
spice sql
SELECT tpep_pickup_datetime, passenger_count, trip_distance from taxi_trips LIMIT 10;
The output displays the results of the query along with the query execution time:
+----------------------+-----------------+---------------+
| tpep_pickup_datetime | passenger_count | trip_distance |
+----------------------+-----------------+---------------+
| 2024-01-11T12:55:12 | 1 | 0.0 |
| 2024-01-11T12:55:12 | 1 | 0.0 |
| 2024-01-11T12:04:56 | 1 | 0.63 |
| 2024-01-11T12:18:31 | 1 | 1.38 |
| 2024-01-11T12:39:26 | 1 | 1.01 |
| 2024-01-11T12:18:58 | 1 | 5.13 |
| 2024-01-11T12:43:13 | 1 | 2.9 |
| 2024-01-11T12:05:41 | 1 | 1.36 |
| 2024-01-11T12:20:41 | 1 | 1.11 |
| 2024-01-11T12:37:25 | 1 | 2.04 |
+----------------------+-----------------+---------------+
Time: 0.00538925 seconds. 10 rows.
You can experiment with the time it takes to generate queries when using non-accelerated datasets. You can change the acceleration setting from true
to false
in the datasets.yaml file.
Comprehensive documentation is available at docs.spiceai.org.
Over 45 quickstarts and samples available in the Spice Cookbook.
Spice.ai is designed to be extensible with extension points documented at EXTENSIBILITY.md. Build custom Data Connectors, Data Accelerators, Catalog Connectors, Secret Stores, Models, or Embeddings.
🚀 See the Roadmap to v1.0-stable for upcoming features.
We greatly appreciate and value your support! You can help Spice in a number of ways:
- Build an app with Spice.ai and send us feedback and suggestions at hey@spice.ai or on Discord, X, or LinkedIn.
- File an issue if you see something not quite working correctly.
- Join our team (We’re hiring!)
- Contribute code or documentation to the project (see CONTRIBUTING.md).
- Follow our blog at blog.spiceai.org
⭐️ star this repo! Thank you for your support! 🙏