Self-Hosted AI Data Analyst With Text-to-SQL Agents
AI data analyst agents from NeuralChainAI turn plain-English questions into SQL on your own database, run it under a read-only role and return the result with the query beside it. Models, semantic layer and query logs run self-hosted in your cloud account or on your servers, so your data and your team's questions stay in your environment.
Questions Your Team Can Ask the AI Data Analyst
Bring AI for data analysis to the questions your team already asks. Talk to your data the way you would brief an analyst.
Revenue, margin and cash
Net revenue by region last quarter against last year and customers more than 60 days past due.
Pipeline and bookings
The reps who closed the most new business this month and the pipeline that came from partners.
Orders and fulfilment
The SKUs that sold fastest in October and the warehouse that shipped the most orders late.
Accounts and usage
Accounts that lowered usage three months running and those opening the most tickets.
Campaigns and attribution
Cost per qualified lead by channel since January and the campaigns that brought customers who renewed.
Follow-up questions
Chat with your database in a thread. Ask why a number moved and the agent keeps the context.
Databases and Spreadsheets the SQL Agent Connects To
The SQL agent connects to the databases your reporting already uses, each through its own read-only account.
PostgreSQL
Application databases and reporting schemas, through a read replica where you have one.
MySQL
E-commerce, CRM and line-of-business application databases.
SQL Server
ERP and finance databases, plus your existing reporting views.
Snowflake
Warehouse tables and views, on a small warehouse set aside for the agent.
BigQuery
Analytics, marketing and finance datasets, with a bytes-billed limit on every query.
Spreadsheets and Excel
An AI agent for Excel and CSV files, through DuckDB, an MIT-licensed database that can SELECT from .xlsx files.
A Semantic Layer for Natural Language to SQL, With Every Query Shown for Review
Natural language to SQL works when the model knows your business terms, so we define them in a semantic layer the agent reads first.
What goes into the semantic layer
- Metrics: net revenue, active customer and churn, as finance defines them.
- Joins and grain: which keys join which tables and what one row means.
- Vocabulary: synonyms, product names, region codes and your fiscal calendar.
- Allowed tables: the views and columns the agent may query.
The agent can also read definitions you already keep. dbt's MetricFlow (Apache 2.0) compiles metrics into SQL, and Cube Core is an open-source semantic layer with a SQL API. Snowflake semantic views hold metrics as schema objects. Otherwise we write the definitions in YAML with your analysts.
Every answer arrives with its SQL
Each answer shows the question, the SQL, the row count and the result. For "What was net revenue by region last quarter, excluding refunds?" the text-to-SQL agent returns:
-- Question: What was net revenue by region last quarter, excluding refunds?
-- Metric: net_revenue, from the semantic layer
-- Last quarter: fiscal Q3 2026, from your fiscal calendar
WITH refunds AS (
SELECT order_id, SUM(amount) AS refunded
FROM analytics.refunds
GROUP BY order_id
)
SELECT r.region_name,
SUM(o.amount - COALESCE(f.refunded, 0)) AS net_revenue
FROM analytics.orders o
JOIN analytics.regions r ON r.region_id = o.region_id
LEFT JOIN refunds f ON f.order_id = o.order_id
WHERE o.order_date >= DATE '2026-07-01'
AND o.order_date < DATE '2026-10-01'
GROUP BY r.region_name
ORDER BY net_revenue DESC;An analyst approves or edits the query, and approved pairs become worked examples. Survey tabs and open-ended responses run through our survey data analysis with private AI.
Read-Only Database Roles for the SQL Agent
The agent's own database account holds read access only, using grants from each vendor's documentation.
| Database | Read-only access, per the vendor's docs | Limits we add |
|---|---|---|
| PostgreSQL | The pg_read_all_data role reads all tables, views and sequences. Row-level security still applies. | default_transaction_read_only and a statement_timeout on the agent's role |
| MySQL | An account with SELECT granted on one database, for example GRANT SELECT ON sales.* | The account connects to a read replica and holds SELECT only |
| SQL Server | db_datareader reads all data from user tables and views. db_denydatawriter blocks adds, changes and deletes. | Both roles, on the reporting database only |
| Snowflake | A custom read_only role with USAGE on database, schema and warehouse, plus SELECT on current and future tables | A separate small warehouse for the agent's queries |
| BigQuery | BigQuery Data Viewer on the tables and views a query reads, plus BigQuery Job User on the project to run queries | Maximum bytes billed per query, so an oversized query stops before any charge |
The agent's query tool also accepts SELECT statements only, adds a row limit and logs each query with the person who asked. Our AI agent development team builds it into every text-to-SQL agent.
Self-Hosted Text-to-SQL Models Behind Your Own LLM Gateway
The model that writes the SQL runs on vLLM or Ollama on your servers or in your cloud account. Options include open-weight Qwen, Llama and Mistral models and Snowflake's Arctic-Text2SQL-R1-7B (Apache 2.0), whose model card reports 68.5% execution accuracy on BIRD-test. Three things stay in your network:
One gateway for every model call.
A self-hosted LLM gateway such as LiteLLM gives each team a virtual key with its own models, budget and rate limits. It logs every call, and vLLM's structured outputs can hold the model to a SQL grammar.
How We Check the AI Data Analyst's Answers
In the Spider 2.0 paper (ICLR 2025), an o1-preview agent solved 21.3% of 632 enterprise text-to-SQL tasks, against 91.2% on Spider 1.0. Business context moves the score, so we measure accuracy on your own questions.
A test set from your reports
Analysts collect real questions from existing reports, each paired with the answer they already trust.
Execution accuracy
We score the result of each query against the trusted answer, the execution accuracy measure the BIRD benchmark uses.
A test run on every change
A new model, prompt or definition goes live once its score holds or improves in promptfoo, an MIT-licensed eval tool.
Clarifying questions
When a question could mean two metrics or two date ranges, the agent asks which one before it runs any SQL.
Analyst review queue
Answers that touch a new table or metric go to a named analyst first, and their edits become new examples.
BI Copilots and a Self-Hosted AI Agent for Data Analysis, Side by Side
Conversational analytics now ships inside Copilot in Power BI, Conversational Analytics in Looker and Snowflake Cortex Analyst. Vendor facts come from each vendor's docs, checked November 2026.
| BI and warehouse copilots | Self-hosted AI data analyst | |
|---|---|---|
| Data it answers over | Data inside that platform, such as a Looker model or a Snowflake semantic view | PostgreSQL, MySQL, SQL Server, Snowflake, BigQuery and spreadsheets, in one agent |
| Where the model runs | Vendor-hosted: Azure OpenAI for Copilot in Power BI, Gemini for Looker and Snowflake-hosted Mistral and Meta models for Cortex Analyst by default | Self-hosted on vLLM or Ollama, called through your own LLM gateway |
| What it needs | Copilot in Power BI needs paid Fabric capacity (F2 or higher) or Power BI Premium (P1 or higher) | GPU capacity and a read-only account per source |
| Business definitions | The platform's own semantic model | A semantic layer you own, in MetricFlow, Cube or YAML |
| Billing | Platform billing, such as Snowflake credits per Cortex Analyst message plus warehouse compute | Your hosting, plus normal query compute |
A BI copilot suits data that already sits in one BI product. A self-hosted AI agent for data analysis suits questions across several databases, with query logs kept in your environment. The agent runs as part of a self-hosted AI deployment.
What Shapes the Engagement
We scope each build in a strategy session. These factors set its size.
Sources and schemas
How many databases, spreadsheets and tables sit behind your team's questions.
Metric definitions
Whether your metrics already live in dbt, Cube, LookML or a semantic view.
Model and hardware
Which open-weight model fits, on GPUs you own or in your cloud account.
Access and review rules
Which teams can query which data and which answers an analyst checks first.
Accuracy target
The score on your test set that each team needs before it gets access.
Talk to an Engineer About Your AI Data Analyst
Bring the questions your team asks most and the databases behind them. We'll walk through sources, read-only setup, model options and how we would measure accuracy.
Book a Strategy Session →Frequently Asked Questions on AI Data Analysts
An AI data analyst is an AI agent that answers business questions from your data. It looks up metrics in a semantic layer, writes SQL, runs it under a read-only role and returns the result with the query attached. Analysts review new metrics and any number headed for a board pack.
It depends on the schema and on how clearly business terms are defined. On the BIRD benchmark, data engineers and database students score 92.96% execution accuracy and the top AI system listed in November 2026 scores 83.40%. We measure accuracy on your own questions, and every answer shows its SQL.
The agent's account holds read-only grants, such as PostgreSQL's pg_read_all_data, SQL Server's db_datareader or BigQuery Data Viewer, so the database refuses writes. Its query tool also accepts SELECT statements only.
Running costs come from model hosting, query compute and analyst review time. Google lists BigQuery on-demand queries at $6.25 per TiB after the first free TiB each month, so we cap bytes billed per query. Snowflake bills Cortex Analyst in credits per message, plus warehouse compute (vendor pages, checked November 2026). A strategy session sizes your build.
Related Self-Hosted AI Solutions and Services
Self-Hosted LLM Gateway for Model Routing
Learn more →vLLM Deployment and Inference Serving
Learn more →Ollama for Business on Your Own Servers
Learn more →Self-Hosted AI Deployment for Business
Learn more →Survey Data Analysis With Private AI
Learn more →Agentic AI and AI Agent Development
Learn more →Ready to Ask Your Own Data a Question?
A 30-minute strategy session on your sources, your team's questions and where the agent should run, with an outline of the self-hosted AI data analyst that fits.