SQL Agent
Ask any SQL database questions in plain language. Every query is checked by a parser before it runs, read-only.
The problem
Business teams wait on analysts for every number in the database. Most text-to-SQL demos paste a fixed schema into a prompt and run whatever the model returns, which no one should put in front of production data.
How it works
The agent introspects any schema through SQLAlchemy, picks the relevant tables for large databases, and writes dialect-correct SQL with Claude. Every query passes a sqlglot AST guard (one read-only statement, known tables only, no dangerous functions, enforced row limit) then runs in a read-only transaction with a timeout. Errors are fed back so the model repairs its own query, and each step streams live to a Next.js interface.
Pipeline
- 01Plan
- 02Pick tables
- 03Write SQL
- 04AST guard
- 05Read-only run
- 06Answer + chart
Where it's used
- Self-service analytics for sales, finance and operations teams
- Internal dashboards where people ask follow-up questions in plain language
- Giving non-technical staff safe access to production databases
Highlights
- Works with PostgreSQL, MySQL and SQLite with no schema hard-coding
- Defence in depth: AST guard, read-only execution, least-privilege role, PII masking
- Asks a clarifying question instead of guessing on ambiguous requests
- Execution-accuracy benchmark against hand-written gold SQL; mypy --strict and 40+ tests
Stack
Want something like this for your company?
I build production versions of these systems on your data and your infrastructure.
Related service: Talk to your data
Contact me