Generators Tutorial
A step-by-step guide on how to use Text-to-SQL generators to create SQL queries from user input and specified database sources.
Executors Tutorial
Learn how to connect to databases and execute SQL queries generated by models. This tutorial covers execution, troubleshooting, and best practices.
For Analysts and general users
If you are not interested in customizing PremSQL much, and just here want to use LLM powered data analysis, then just use our CLI to start the app and either connect your database manually or connect to bunch of CSVs files inside a folder or import it from kaggle. Here is how you launch the server:server.py
python server.py
. Here is a quick demo on How your analysis experience would look like.
If you want to do the above in fully local setting using Ollama, check out our introduction page.
For Developers
Here we discuss in more details on how Agent Server is being designed. Agent Server is a wrapper around FastAPI server. As we discussed in the Agents that it supports two forms of outputs:ExitWorkerOutput
and AgentOutput
. When using AgentServer it by default uses AgentOutput
. Here is a brief architecture of AgentServer.

- You can use different generators and different models
- You can add your own DB executor
- Last but not the least, you can add a new worker or make your own agent using combination of our pre-existing worker implementations and your own logics.
Creating your own Worker or Agent
You can use existing PremSQL components (like generators, executors and workers from existing BaseLine worker) to create your own worker or your own agent. The one thing that you need to adhere with is, PremSQL currently only supports main three types of routes viz:/query
(for Text to SQL), /plot
(for plotting dataframes) and /analyse
(for analysing dataframes and question answering). Each of the worker (in the Baseline as well) is inherited from a baseclass. And each of them follows a strict output pydantic model so that we can maintain a reliable structured output generation. Once you complete your implementation of your own agent / worker you can use with AgentServer to test it out.
When using AgnentServer, you can also the internal Backend API (written on django) to see information around different sessions and do basic crud operations as shown here:
