Every developer building LLM-powered features eventually encounters the same infuriating wall of glue code. You have real-time transactional data in PostgreSQL or MySQL, your event streams in Kafka, and a user who wants sentiment analysis, text summarisation, or agentic retrieval yesterday.
The traditional response? Write a fragile Celery worker in Python, pull rows out of the database, format them into JSON, juggle API rate limits, shovel vectors into a standalone vector store, and pray your database write-back transaction does not timeout halfway through.
MindsDB tackles this absurdity by inverting the relationship: instead of carting your enterprise data over to the AI, it brings the AI directly into your data layer.
┌─────────────────┐ Standard SQL Queries ┌─────────────────┐
│ Enterprise Data │ ───────────────────────────────> │ MindsDB │
│ (Postgres, │ │ (AI Middleware) │
│ Snowflake) │ <─────────────────────────────── └────────┬────────┘
└─────────────────┘ Enriched Output Tables │
▼
┌─────────────────┐
│ LLM Engines │
│ (Ollama, OpenAI,│
│ HuggingFace) │
└─────────────────┘
What is MindsDB?
MindsDB is an open-source federated AI platform that exposes machine learning models, fine-tuned neural networks, and generative LLMs as virtual tables within relational data systems.
By speaking the MySQL and PostgreSQL wire protocols natively, MindsDB allows developers to configure, train, and run inference over generative AI models using plain SQL SELECT, INSERT, and JOIN statements.
Key Architectural Concepts
Under the bonnet, MindsDB functions as a database proxy and orchestration engine built in Python and C extensions:
- Data Handlers: Standardised connectors to over 100 data sources, including PostgreSQL, Snowflake, ClickHouse, MongoDB, and streaming inputs like Apache Kafka.
- ML/AI Engines: Pluggable interfaces to model providers, from hosted APIs (OpenAI, Anthropic, Mistral) to local inference runtimes (Ollama, vLLM, Hugging Face).
- Virtual AI Tables: MindsDB treats a model as a table where inputs act as query filters (
WHERE) and predictions act as returned columns (SELECT). - Real-Time Jobs and Triggers: Automated continuous queries that monitor base tables for new records, generate predictions, and write outputs to destination systems without cron jobs.
MindsDB vs Traditional LLM Pipeline Architectures
| Capability | Custom Python Pipeline (LangChain/LlamaIndex) | Native Vector DB Approach | MindsDB Federated AI |
|---|---|---|---|
| Interface | Python / TypeScript SDKs | Proprietary API / Vector Queries | Standard SQL (SELECT, JOIN) |
| Data Sync | Complex ETL & sync jobs | Dual writes required | Direct live queries to source |
| Model Hosting | External or manual Docker hosting | External inference APIs | Unified abstraction (Local + Cloud) |
| Maintenance | High (glue code, retries, schemas) | Moderate (index tuning) | Low (declarative configuration) |
Local Setup and Installation
The quickest path to testing MindsDB locally is via Docker. Run the official image with port forwarding for the HTTP GUI (47334) and the MySQL-compatible server port (47335):
docker run -d --name mindsdb \
-p 47334:47334 \
-p 47335:47335 \
mindsdb/mindsdb
Alternatively, install it directly inside an isolated virtual environment via pip:
python3 -m venv mindsdb_env
source mindsdb_env/bin/activate
pip install mindsdb
mindsdb
Once running, navigate to http://localhost:47334/ to use the built-in SQL editor, or connect your preferred database management tool (such as DBeaver, TablePlus, or the psql/mysql CLI) straight to 127.0.0.1:47335.
Hands-On Example: Real-Time Customer Sentiment via SQL
Let us walk through a standard enterprise scenario: you have incoming customer feedback, and you want to classify sentiment and generate a proposed response using an LLM.
1. Connect Your Production Database
First, tell MindsDB where your production data lives. Here, we attach an external PostgreSQL instance:
CREATE DATABASE enterprise_postgres
WITH ENGINE = 'postgres',
PARAMETERS = {
"user": "db_user",
"password": "db_password",
"host": "postgres.internal.net",
"port": 5432,
"database": "production"
};
2. Create the AI Engine and Deploy a Model
Next, instantiate a model wrapper. You can connect to remote providers or run local open-weights models through Ollama:
CREATE ML_ENGINE openai_engine
FROM openai
USING
api_key = 'your_openai_api_key';
CREATE MODEL customer_sentiment_agent
PREDICT sentiment, reply_draft
USING
engine = 'openai_engine',
model_name = 'gpt-4o-mini',
prompt_template = 'Analyse this review: "{{comment}}".
Return the sentiment (Positive, Neutral, or Negative) in the sentiment column,
and draft a polite 20-word customer service response in reply_draft.';
3. Query Predictions with a Standard JOIN
Now, generate predictions on the fly by joining the external table with the AI model table:
SELECT
f.id,
f.comment,
m.sentiment,
m.reply_draft
FROM enterprise_postgres.customer_feedback AS f
JOIN customer_sentiment_agent AS m
WHERE f.created_at >= NOW() - INTERVAL 1 HOUR
LIMIT 10;
4. Automate Continuous Writes with a Job
To remove human intervention entirely, configure a persistent job that writes model predictions directly into a reporting table whenever new rows arrive:
CREATE JOB process_feedback_job AS (
INSERT INTO enterprise_postgres.processed_feedback
SELECT
f.id,
m.sentiment,
m.reply_draft
FROM enterprise_postgres.customer_feedback AS f
JOIN customer_sentiment_agent AS m
WHERE f.processed = FALSE
)
EVERY 5 minutes;
Why It Stands Out in the 2026 AI Landscape
Community discussions on GitHub and developer forums often circle back to the friction of maintenance. While agentic frameworks like CrewAI and AutoGen capture headlines, engineering teams running production workloads routinely spend 80% of their time building boring data pipelines to support those agents.
MindsDB skips the boilerplate. It turns your database into an AI agent without requiring you to hire a distributed systems team to maintain custom ingestion infrastructure.
If your core workflows already live inside SQL, treating LLMs as plain old database tables is one of the cleanest abstractions available today.