db-agent
agent
Pass
Health Pass
- License — License: Apache-2.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 18 GitHub stars
Code Pass
- Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
SQL AI Agent - Talk to your DB in Natural Language
README.md
DB Agent
Latest News 🔥
- [4 March 2025] — Presented at the AAAI-25 Workshop on Open-Source AI for Mainstream Use in Philadelphia. Workshop paper available here.
A minimal, teachable natural-language-to-SQL system. Ask questions in plain English — DB Agent generates the SQL, validates it for safety, executes it, and shows you every step.
Two versions
This repo contains two independent, fully working versions of DB Agent — same concept, different deployment targets.
| Streamlit App | Full-Stack App | |
|---|---|---|
| Stack | Python + Streamlit | Next.js + FastAPI |
| Best for | Rapid prototyping, data teams | Production deployments, enterprise demos |
| Deploy on | Snowflake, Databricks, Docker | AWS (Lambda + API Gateway), Neo Cloud |
See each folder's README for setup and deployment instructions.
Features
- Text-to-SQL — natural language to SELECT queries via any LLM
- Safety layer — blocks all write/admin SQL before it reaches the database
- Explainability — schema context, generated SQL, and validation all visible
- Any OpenAI-compatible LLM — OpenAI, GitHub Models, Groq, Ollama, LM Studio
- Any SQL database — SQLite by default; PostgreSQL and MySQL via one env var
Learning modules
New to AI agents? Work through the modules in order — each one builds on the last:
| Module | Concept | What you build |
|---|---|---|
| 01 — LLM Basics | What is an LLM API call? | Notebook: raw API call, messages, temperature |
| 02 — Structured Output | How to get reliable JSON from an LLM | Notebook: JSON mode + Pydantic validation |
| 03 — Tool Use | LLM calls functions instead of generating text | Agent that decides when to query the DB |
| 04 — Agentic Loop | Retry, reflect, recover from errors | Agent with max-steps guard and error recovery |
| 05 — MCP Server | Expose tools via a standard protocol | MCP server connectable to Claude Desktop |
The streamlit_app/ is the finished product these modules build toward.
See CONCEPTS.md for a plain-English glossary of every term.
Repository structure
db-agent/
├── modules/ ← ★ learning modules (start here if you're new)
│ ├── 01_llm_basics/
│ ├── 02_structured_output/
│ ├── 03_tool_use/
│ ├── 04_agentic_loop/
│ └── 05_mcp_server/
├── streamlit_app/ ← Streamlit version (Snowflake / Databricks / Docker)
├── fullstack_app/ ← Full-stack version (AWS / Neo Cloud)
├── scripts/ ← shared utilities
├── tests/ ← shared test suite
└── CONCEPTS.md ← plain-English glossary
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found