Skip to main content

NexusSQL Logo

NexusSQL

Agentic SQL Agent — Natural Language to SQL with Multi-step Reasoning

GitHub · SQLAS Eval Framework · 📄 Paper

DOI

📄 Paper

NexusSQL: Production SQL Agent for 100+ Table Databases with SQLAS Evaluation Author: thepradip DOI

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

Metadata

Release files for nexussql 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nexussql 1.0.2
File Size Uploaded Provenance Actions
nexussql-1.0.2.tar.gz 5.3 kB Without provenance Details for nexussql-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nexussql 1.0.2
File Interpreter ABI Platform Actions
nexussql-1.0.2-py3-none-any.whl Python 3 none any Details for nexussql-1.0.2-py3-none-any.whl

Total release size: 10.3 kB

Release files / nexussql-1.0.2.tar.gz

Download URL nexussql-1.0.2.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ae0d373f9c4442fe4e39485f5829c3644427e7a78167f9222b6dc620166d14b3
BLAKE2b-256 checksum
How to use checksums
2ca2267dae05b5e4313b4cef3b4a7572b7a0b3d4b5f29d6e6f689834c28346bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.4

Release files / nexussql-1.0.2-py3-none-any.whl

Download URL nexussql-1.0.2-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
985716bb7988a5197b9c6a6d155ae0d51a11edc5200a610c154747677fde88a4
BLAKE2b-256 checksum
How to use checksums
c0d95cb8b7e2bc5f57117007c242119822086bd5b4962846ef94fe4930e91c39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.4

Security for nexussql 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page