Cosmic AI
Business teams ask their databases plain English questions without data leaving their network
We built Cosmic AI's data copilot: people ask their company's databases and documents questions and get KPIs, charts and summaries. The model runs inside the customer's environment, learns each schema and shows the SQL behind every answer.
Data & AnalyticsAgentic data copilotBuilt from zero
The challenge
Business users wanted answers from their own databases without waiting on an analyst, and the first customer would not let its data leave its network or reach a public model provider.
What we did
We built an agentic copilot that runs on model APIs inside the customer's environment, learns each schema through a training layer and shows the SQL and assumptions behind every answer.
The outcome
It was first proven with a Fortune 500 company on its own operations data, and it was in use at two companies before it became a multi-tenant SaaS.
- First proven with
- A Fortune 500 company, on its own operations data
- In use
- At two companies before the multi-tenant release
- Data boundary
- Model APIs inside the customer's own environment
- Every answer shows
- The SQL it ran, its assumptions and the result table
The starting point
Cosmic AI is an AI software company, and the copilot is its agentic data product. Business users connect their databases and upload documents, then ask questions in plain English instead of waiting for an analyst.
What had to change
Most copilots are tied to one product, and many companies will not let their data leave their network or reach a public model provider. The first customer, a Fortune 500 company, wanted KPIs, anomaly checks, summaries and search over its research studies on exactly those terms.
What could not break
- Customer data stays inside the customer's own infrastructure
- No company data goes to a public model provider
- Access follows roles: super admin, organization admin and agent
- Every number can be traced to the SQL that produced it
- Each customer brings its own schema and database type
The calls we made
We treated this as a trust problem first: the model goes to the data, and every answer shows its working.
- 01
Send the model to the data
The first customer would not let its data reach a public model provider, so the copilot runs on Azure OpenAI inside the customer's environment, and the design also allows self-hosted open-source models.
Ruled outSending company data to a public model provider.
- 02
Train per customer, not one prompt for all
Every customer has a different schema and database type, so admins teach the copilot with table definitions, question and SQL pairs and documentation, and a Train with AI pass drafts that training from selected tables for them to review and edit.
Ruled outRelying on a general model to guess column meanings from table names.
- 03
Show the SQL with every answer
A business user acting on a number needs to see how it was produced, so each answer carries the generated SQL, a plain explanation, its assumptions and the result table.
Ruled outA chat answer with no way to check where the number came from.
- 04
Flag anomalies with statistics, then explain them
For the first customer, anomaly detection marks outliers in its KPIs with a z-score method, and the copilot then explains each flagged value in words.
- 05
One agent across data, documents and the web
Questions often span a database, a research document and the outside world, so one LangGraph agent keeps the conversation and calls tools for SQL, document search and web search with source links, choosing a chart, a table or text for each answer.
Ruled outA copilot tied to one product, one data source or fixed report templates.
How the system fits together
What we built
AI dashboard and canvas
A dashboard with KPIs, key takeaways and a daily summary over the connected data, plus a canvas where useful answers are pinned as charts and tables.
Training and knowledge base
Admins add table definitions, question and SQL pairs and documentation, edit or remove any of it, and can run Train with AI over selected tables; document upload covers unstructured knowledge.
Saved queries and email drafts
Useful queries are saved and managed in one list, answers can be exported, and the chat drafts emails from what the conversation already holds for the user to edit before sending.
Chat agent over data, documents and the web
One agent queries the databases, searches uploaded documents and the web with source links, explains its SQL and assumptions, keeps follow-up questions in context and draws bar and pie charts.
The first enterprise instance
For the Fortune 500 customer we added KPI dashboards over its operations data, z-score anomaly detection with an explanation for each flag, summaries, search over its research studies and email drafts with charts attached.
How it works
Connect
An organization signs in, connects its databases and uploads its documents.
Train
The copilot learns the schema from table definitions, sample questions and documentation, and can draft that training itself.
Ask
A user asks a question in plain English, and the agent picks the database, documents or web search it needs.
Answer and show the working
The answer arrives as a chart, a table or text, with the generated SQL, an explanation and its assumptions beside it.
Save and share
Useful queries are saved, pinned to the canvas or turned into an email draft.
A closer look
What changed
The copilot was first proven with a Fortune 500 company on its own operations data and was then in use at two companies before it became a multi-tenant SaaS. The team behind CopilotKit asked to feature the work in its customer showcase and invited a demo at its office hours.
- A Fortune 500 company
- First customer
- Two, before the multi-tenant release
- Companies using it
Under the hood
- Datics role
- Product built by Datics
- Data boundary
- The model works on the customer's own data inside its environment through Azure OpenAI, and the design also allows self-hosted open-source models.
- Databases
- Azure SQL, PostgreSQL and MySQL; on the first instance the copilot's own records and the customer's data sat in separate databases.
- Retrieval
- Azure AI Search over uploaded documents and research studies, plus Perplexity web search with source links.
- Access and hosting
- Clerk sign in with roles for super admins, organization admins and agents, on Azure with separate QA and production environments and Gunicorn behind Nginx.
AI and models
Cloud and infrastructure
Apps and APIs
Also in the stack
How it shipped
Scoping from what already existed
We reviewed the instance Cosmic AI already ran and the founder's material, then wrote a high level scope and a feature breakdown for the first enterprise instance.
First enterprise instance
Azure resources, Azure OpenAI and Azure SQL set up for the customer, then KPI dashboards, anomaly detection, summaries, research study search and email drafting, each through QA.
Agent tools and a second instance
Text to SQL, document search, web search and email became LangGraph tools behind one agent, and a second customer instance went through QA.
Training, queries and canvas
Structured training with Train with AI, saved query management and the canvas, shown end to end in a recorded product demo.
Evaluation and handover
After the product moved to a multi-tenant SaaS, a solution evaluation and a knowledge transfer to the client.
One product team for Cosmic AI
We worked as Cosmic AI's product team, from scoping and design through engineering, QA and deployment, with daily scrums through the build.
QA written around how people really ask
Test cases covered follow-up questions, synonyms, switching datasets mid conversation, failed queries and attempts at SQL injection through the chat.
Separate QA and production
Each milestone went through QA cycles in its own environment before release, with CI/CD into production.
What this unlocked
Cosmic AI went on to sell the copilot as a multi-tenant SaaS. Putting the model beside the data and showing the working is how we approach AI analytics in products that already have data and users.
Related work
Have a product with the same kind of constraints?
Tell us what already exists and what you want it to do. We will tell you what it takes.
