SQL Agent – LLM-Powered Natural Language SQL for PostgreSQL
Chat with your database using advanced AI. Modular, production-ready LangGraph & Streamlit app for natural language querying of the Chinook database.
Overview
This project demonstrates a production-grade, fully modular LLM-based SQL Agent for natural language question answering over a real relational database.
Key features:
- Ask business questions in natural language — get real SQL queries and concise, interpretable summaries.
- Powered by OpenAI or Mistral LLMs, running via LangGraph and Streamlit.
- Database: Uses the Chinook demo database in PostgreSQL, with full schema introspection and human-readable notes on table relationships.
- Provides business insights, analysis summaries, and automatically interprets the SQL output for non-technical users.
Demo



Left: Ask questions in natural language.
Middle: View the generated SQL and summary.
Right: Business users get direct insights.
Middle: View the generated SQL and summary.
Right: Business users get direct insights.
Example Use Cases
- Who was the top sales agent by total invoice sales in 2023?
- Which playlist contains the highest number of tracks, and how many does it have?
- List all customers from Brazil, including their full names and total amount spent.
Technical Stack
- LangGraph: stateful multi-node workflow orchestration
- PostgreSQL: for both demo data (Chinook) and LLM memory/persistence
- Streamlit: live, interactive frontend
- SQLAlchemy: schema and data introspection
- Pydantic: strict models for schema/inputs
- Modern LLMs: Mistral, OpenAI, or plug your own
- Docker: local development, with easy launch of database and pgAdmin
Repo
🔗 github.com/jaroxciv/sql-agent
- Full install and Docker setup instructions in the README.
Why it matters
This project bridges the gap between technical and business users by making relational data accessible with no code required. The modular codebase is ideal for extension, deployment, and research.
Feel free to contact me for questions or collaboration!