Cosmic AI
Companies onboard themselves and connect several databases to one AI copilot, kept apart
Cosmic AI's data copilot ran as a separate instance for each customer. We turned it into a multi-tenant SaaS where every organization onboards itself, connects several databases and invites its own team, without rebuilding the agent.
B2B SoftwareMulti-tenant AI analytics SaaSBuilt from zero
The challenge
Each customer ran on its own instance of the copilot, so selling it as a product needed self-serve onboarding, tenant isolation and role-based access.
What we did
We kept the proven agent and built organizations, onboarding with automatic training, super admin access control in middleware and several database connections per organization around it.
The outcome
Organization management, role-based access and multi-database support were delivered through QA, evaluated and handed over to Cosmic AI.
- Before
- A separate instance for each customer
- After
- Self-serve organizations on one platform
- Roles
- Super admin, organization admin, agent
- Data
- Several databases per organization, a canvas each
The starting point
The copilot lets business users ask plain English questions of their company's databases and documents. It had been proven with a Fortune 500 company and was in use at two companies, each on its own instance.
What had to change
Every new customer meant another separate instance. To sell it as a product, starting with e-commerce companies, it needed self-serve onboarding, tenant isolation and access control.
What could not break
- Each organization sees only its own data
- Access follows three roles: super admin, organization admin and agent
- The proven text to SQL agent and its training layer stay as they are
- An organization can connect more than one database
The calls we made
We kept the agent and changed what sits around it: organizations, roles and data connections.
- 01
Keep the agent, add the tenancy around it
The text to SQL agent and its training layer were already proven with real customers, so the multi-tenant work wrapped organizations, onboarding and access control around them.
- 02
Self-serve onboarding with automatic training
A company signs up, connects its databases, uploads documents and starts automatic training in one onboarding flow, so a new customer no longer needs its own instance.
Ruled outSetting up a separate instance for every new customer.
- 03
Access control in the middleware
Super admin, organization admin and agent roles are enforced in middleware, so each request is checked against the organization and role before it reaches data.
- 04
Several databases per organization
Companies keep data in more than one database, so onboarding and training accept several connections, each database gets its own canvas and chat works across all of them.
Ruled outOne database per organization, as the single-customer instances worked.
- 05
Route every query to the right database
With several connections per organization, the backend identifies which database each request is for, and generated SQL was tested per engine, with fixes for PostgreSQL and SQL Server syntax.
How the system fits together
What we built
Organization onboarding
Sign up with SSO, connect one or more databases, upload documents and start automatic training in one onboarding flow.
Team and user management
Organization admins invite people by link and give them the admin or agent role, next to the organization profile, summary and themes.
A canvas per database
Each connected database gets its own canvas of AI built charts and its own Train with AI pass, and chat works across all of an organization's databases.
Super admin console
A console where the platform's super admins look up every organization and its users, with search and pagination, backed by access control in the middleware.
How it works
Sign up
A company creates its organization and signs in with SSO.
Connect
Its admin connects one or more databases and uploads documents during onboarding.
Train
The copilot trains on each database automatically, and the admin can add question and SQL pairs and documentation.
Add the team
The admin invites team members by link as admins or agents, each working only inside their organization.
Ask across databases
Members ask questions across the organization's databases, and each database keeps its own canvas of charts.
A closer look
What changed
The copilot moved from one instance per customer to a platform where companies onboard themselves. Organization management, role-based access and multi-database support were delivered, evaluated and handed over to Cosmic AI.
Under the hood
- Datics role
- Product built by Datics
- Tenancy and access
- Organizations are kept apart, with super admin, organization admin and agent roles checked in middleware.
- Sign in
- Clerk with SSO for every organization.
- Databases
- PostgreSQL, MySQL and Azure SQL connections, several per organization, each identified on every request and given its own canvas.
- Security plan
- The SaaS plan set out data isolation per tenant, encryption at rest and in transit, and role-based access.
AI and models
Data and retrieval
Apps and APIs
Also in the stack
How it shipped
One instance per customer
The copilot ran as a separate instance for each customer: first a Fortune 500 company, then a second instance through QA.
SaaS proposal
A proposal set out the roles, self-serve onboarding with automatic training, and multitenancy with data isolation, encryption at rest and in transit and role-based access.
Multi-tenant milestone
Organization management, super admin access control in middleware, several database connections during onboarding and training, a canvas per database and chat across databases.
Evaluation and handover
QA cycles on each part, a solution evaluation of the SaaS version, then a knowledge transfer to the client.
A milestone with QA cycles
Organization management, access control and multi-database support shipped as one milestone, with each reported issue fixed and passed by QA before release.
Evaluated console by console
Solution evaluations covered the admin console and the agent console separately, then the SaaS version as a whole, before we closed with a knowledge transfer.
What this unlocked
With tenancy in place, the plan was to sell the copilot to many companies, starting with e-commerce.
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.
