Problem
A data analyst agent takes a plain-English question, finds the tables, writes and runs SQL, recovers from errors and charts the result. It looks magical in a demo and fails in production. Users ask vague questions, and the model answers anyway, so reruns give different or plainly wrong results. The agent also invents column names, repeats one answer dozens of times or ignores a request to stop. Each failure costs user trust and adds load on the client's database.
Example from the article: a vague question has several valid readings. The agent picks one without saying so, and a rerun picks another.
Solution in brief
Toqan Data Analyst (Prosus) went from failing to adopted through four changes. Required behaviors became deterministic checks around the LLM. Data experts own the documentation the agent reads. Hard limits and soft nudges bound the agent. Tools take over narrow work: the schema tool filters context and the SQL tool repairs routine errors.
Questions this case answers
- How to make an LLM agent that writes queries over structured data give consistent answers when user questions are ambiguous and the agent cannot tell what it does not know
- How to bound the cost and risk of an autonomous agent that runs generated queries against systems it does not own
- How to stop a text-to-SQL agent from answering vague questions with confident wrong results?
- How to cut wasted agent cycles on predictable SQL errors such as non-existent columns?
Tools and methods
- Answerability pre-check — small LLM call on the question and context only
- Column-existence check — validates a query against the schema before it runs
- Reflection step in the SQL tool — small LLM call on the query and error
- Model routing per step — model chosen by the complexity and cost of each call
Google or a one-time email code. No password.
