Skip to main content

AriaSQL — Agentic SQL Agent. Natural language to SQL with ReAct reasoning, semantic cache, and a bundled React UI.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ariasql-1.0.1.tar.gz (202.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ariasql-1.0.1-py3-none-any.whl (210.8 kB view details)

Uploaded Python 3

File details

Details for the file ariasql-1.0.1.tar.gz.

File metadata

  • Download URL: ariasql-1.0.1.tar.gz
  • Upload date:
  • Size: 202.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for ariasql-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d0b2d320212aae6cf74a3a827c168773cf90e00bdef107c25bffaa9bacf2e6c1
MD5 a11462d530fc067cfaf28a401bd0f7bd
BLAKE2b-256 1765cf97abd30a83029d6624a30b2f16a5b8fa6ee5b01f8b2bbc31dae3bbf827

See more details on using hashes here.

File details

Details for the file ariasql-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: ariasql-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 210.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for ariasql-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d5931999aab0cce5b6f3d1f00103df6f28bc9b1ee6c08334feb37957648a350
MD5 95b710c00c5af6cd9f9c907a6a3a349c
BLAKE2b-256 dc9b92a5cc70092e126b80a4d05b425aa292c44f4fda5a3294e74ce5099f1274

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page