A multi-agent SQL-of-Thought engine for NLQ-to-SQL, correction loops, and evaluation.
Project description
SQLThought
SQLThought is a modular, extensible multi-agent reasoning engine designed for intelligent interaction with structured data, databases, and analytical workflows. It currently ships with a complete natural-language-to-SQL reasoning pipeline, but its architecture is intentionally designed for future expansion into broader structured reasoning domains.
SQLThought is not just a tool—it is a foundation for agentic reasoning over data.
Features
Multi-Agent Reasoning
-
Built using LangGraph to support:
-
Stepwise planning
-
State-aware execution
-
Conditional branching
-
Correction and retry loops
-
Transparent, debuggable pipelines
Groq-Powered LLM Execution
- Ultra-fast model inference using the Groq API.
Modular Architecture
SQLThought is designed around interchangeable modules. Each stage of the reasoning pipeline lives in its own file and can be extended:
nlq/
├── conversion.py
├── build_graph.py
├── nodes.py
├── state.py
└── prompts/
Command-Line Interface
Powerful terminal commands:
-
sqlthought query
-
sqlthought configure
-
sqlthought version
Local Secure Configuration
API keys and model selection stored at:
~/.sqlthought/config.json
Installation
pip install sqlthought
First-Time Setup
Run the configuration wizard:
sqlthought configure
You will be prompted for:
-
Groq API key
-
Model name (example: openai/gpt-oss-20b)
Configuration is remembered for all future commands.
NLQ → SQL Conversion
The package currently includes a fully implemented NLQ→SQL reasoning engine featuring:
-
Schema parsing
-
Sub-problem decomposition
-
Query plan generation
-
SQL generation
-
SQL execution
-
Automatic error correction loop
-
Structured JSON output
CLI Example
sqlthought query "List employees earning above 70000" my.db
Example Output
=== SQLThought Result ===
SQL: SELECT name, salary FROM employees WHERE salary > 70000;
Success: True
Result:
[("Alice", 90000), ("Bob", 75000)]
Python Usage
from sqlthought import to_sql
result = to_sql("List high salary employees", db_path="company.db")
print(result["sql"])
print(result["result"])
Project Structure
sqlthought/
├── nlq/
│ ├── conversion.py # Public API
│ ├── build_graph.py # LangGraph pipeline
│ ├── nodes.py # Agent nodes
│ ├── state.py # Pipeline state model
│ └── prompts/ # Prompt templates
├── utils/
│ ├── db_utils.py
│ ├── logger.py
│ └── visualizer.py
└── cli.py # Command-line interface
Contributing
Issues and pull requests are welcome. More documentation and developer guidelines will be added soon.
License
MIT License © 2025 Tiyasa Mukherjee
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 sqlthought-0.0.1.tar.gz.
File metadata
- Download URL: sqlthought-0.0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fbc8f773d8728fd25c66208ddc43fccee25e12f015c949d37a96ff610e89b4f
|
|
| MD5 |
4c21bfe747f0b83bc43eac4494e8ecec
|
|
| BLAKE2b-256 |
10c190f88991a561282cf3fb7ea3743cb6a0776852a5db0c86f22c67e7072333
|
File details
Details for the file sqlthought-0.0.1-py3-none-any.whl.
File metadata
- Download URL: sqlthought-0.0.1-py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2375eb6c4423b57bc7c9b8e3ff6a323eefa10c17f9b0f04dd75eec5ac913c6f6
|
|
| MD5 |
d63a59b8d2182bd2fb750070d5cbe303
|
|
| BLAKE2b-256 |
68322dd0d789aee5886d56a1de2dcca7098df6f9b6238e271cb90c8598382d42
|