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.0.tar.gz (201.9 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.0-py3-none-any.whl (210.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ariasql-1.0.0.tar.gz
  • Upload date:
  • Size: 201.9 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.0.tar.gz
Algorithm Hash digest
SHA256 099943fdf0e8476e94e40fab1c641e842389c636fbe38cfbb967384cd4893adf
MD5 a6f079eadbbee8086993a6d2d796acbb
BLAKE2b-256 7bec619c1c9e9891b11f5b9dea351f2c1cc416e4cf69294cc68a6cc2783e86dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ariasql-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 210.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb7df2faba1f84927deb893f99edeed0f7eccade7a0197b0d8f04757499a8afd
MD5 901f1fc7702266d1b21dc195062f74d2
BLAKE2b-256 67d8a31c7adb2205e3919421332e8c1de0d472d428ec6decd97d5fb43a4b3727

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