NexusSQL — Agentic SQL Agent. Natural language to SQL with ReAct reasoning, semantic cache, and a bundled React UI.
Project description
NexusSQL
Agentic SQL Agent — Natural Language to SQL with Multi-step Reasoning
GitHub · SQLAS Eval Framework · 📄 Paper
📄 Paper
NexusSQL: Production SQL Agent for 100+ Table Databases with SQLAS Evaluation
Author: thepradip
Published May 14, 2026 · View Paper · View PDF
NexusSQL transforms natural language into SQL using a ReAct agentic loop — the agent inspects your schema, reasons step-by-step, and runs multiple queries before answering. Works with any SQL database, any LLM, and scales to 100+ tables with zero configuration.
Author: Pradip Tivhale
Quick Start
git clone https://github.com/thepradip/NexusSQL.git && cd NexusSQL
cd backend && pip install -r requirements.txt && cp .env.example .env
python ingest.py && uvicorn main:app --reload
# frontend: cd frontend && npm install && npm run dev
Agentic Reasoning
- ReAct loop — Reason → call tool → observe result → repeat until confident
- 4 tools:
list_tables,describe_table,execute_sql,final_answer - Auto-routing: complex queries use ReAct; simple queries use fast pipeline
Intelligent Schema Retrieval (100+ tables)
BM25 + dense embedding hybrid search with RRF. FK-graph-aware. Token budget control.
Semantic Query Cache
L1 exact → L2 semantic → L4 result TTL. Learning loop from user feedback.
Any LLM, Any Database
Azure OpenAI · OpenAI · Anthropic · Ollama · any compatible endpoint. SQLite · PostgreSQL · MySQL · any SQLAlchemy async URL.
Production Safety
AST-based read-only (sqlglot) · query timeout · fetchmany OOM protection · persistent conversations.
API Reference
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
DB status, table count, MLflow experiment |
| GET | /schema |
Full auto-discovered schema context |
| POST | /query |
NL → SQL → Execute → Narrate |
| POST | /feedback |
Thumbs up/down — teaches the few-shot cache |
| POST | /feedback/detailed |
Multi-dimension rating |
| POST | /export/csv |
Download results as CSV |
| GET | /cache/stats |
Hit rates, tokens saved, cost savings |
| DELETE | /cache/results |
Flush result cache after data updates |
| POST | /evaluate |
Run SQLAS evaluation suite |
| DELETE | /conversations/{id} |
Clear conversation history |
Evaluation — SQLAS v2.0
python backend/eval_runner.py --quick # 5 test cases
python backend/eval_runner.py # 28 test cases
python backend/eval_runner.py --provider anthropic:claude-opus-4-7 # test a specific LLM
python backend/eval_runner.py --compare azure,anthropic:claude-opus-4-7,ollama:sqlcoder --quick
45 metrics across 9 dimensions — correctness, agentic quality, cache ROI, safety, faithfulness:
| Dimension | Weight |
|---|---|
| Execution Accuracy | 25% |
| Semantic Correctness | 10% |
| Agentic Quality (planning, grounding, steps) | 10% |
| Context Quality (RAGAS-mapped) | 8% |
| Cost Efficiency (VES, scan, SQL quality) | 10% |
| Task Success (faithfulness, relevance) | 8% |
| Result + Visualization | 7% |
| Guardrails (read-only, injection, PII) | 15% |
| Execution Quality | 7% |
Tech Stack
| Layer | Technology |
|---|---|
| Agent | Custom ReAct loop — tool calling, MLflow tracing |
| Schema retrieval | BM25 + dense embeddings + Reciprocal Rank Fusion |
| Semantic cache | SQLite-backed L1/L2/L4, verified few-shot learning |
| Evaluation | SQLAS v2.0 — 45 metrics, 9 categories |
| LLM | Azure OpenAI · OpenAI · Anthropic · Ollama · any compatible |
| Backend | FastAPI + SQLAlchemy async |
| Frontend | React 18 + Vite + Tailwind CSS |
| Observability | MLflow — traces, spans, feedback |
| Database | SQLite · PostgreSQL · MySQL (any SQLAlchemy async URL) |
License
MIT — Pradip Tivhale
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nexussql-1.0.2.tar.gz.
File metadata
- Download URL: nexussql-1.0.2.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae0d373f9c4442fe4e39485f5829c3644427e7a78167f9222b6dc620166d14b3
|
|
| MD5 |
34da7336929b9507fdc2d4f64a01b946
|
|
| BLAKE2b-256 |
2ca2267dae05b5e4313b4cef3b4a7572b7a0b3d4b5f29d6e6f689834c28346bf
|
File details
Details for the file nexussql-1.0.2-py3-none-any.whl.
File metadata
- Download URL: nexussql-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
985716bb7988a5197b9c6a6d155ae0d51a11edc5200a610c154747677fde88a4
|
|
| MD5 |
db4bf6574de7dd58b2d4fa58f69a5286
|
|
| BLAKE2b-256 |
c0d95cb8b7e2bc5f57117007c242119822086bd5b4962846ef94fe4930e91c39
|