Skip to main content

AriaSQL Logo

AriaSQL

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

GitHub · SQLAS Eval Framework


AriaSQL 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/AriaSQL.git && cd AriaSQL
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

Release files for ariasql 1.0.1

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

Source distribution (sdist)

Source distribution for ariasql 1.0.1
File Size Uploaded
ariasql-1.0.1.tar.gz 202.0 kB Details

Built distribution (wheel)

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

Total release size: 412.8 kB

Release files / ariasql-1.0.1.tar.gz

Download URL ariasql-1.0.1.tar.gz
Size 202.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d0b2d320212aae6cf74a3a827c168773cf90e00bdef107c25bffaa9bacf2e6c1
BLAKE2b-256 checksum
How to use checksums
1765cf97abd30a83029d6624a30b2f16a5b8fa6ee5b01f8b2bbc31dae3bbf827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.4

Release files / ariasql-1.0.1-py3-none-any.whl

Download URL ariasql-1.0.1-py3-none-any.whl
Size 210.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d5931999aab0cce5b6f3d1f00103df6f28bc9b1ee6c08334feb37957648a350
BLAKE2b-256 checksum
How to use checksums
dc9b92a5cc70092e126b80a4d05b425aa292c44f4fda5a3294e74ce5099f1274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

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