Production-Grade Natural Language to SQL Engine.
The NL2SQL Platform is a modular, agentic system designed to convert natural language questions into accurate, authorized SQL queries across multiple database engines (Postgres, MySQL, MSSQL, SQLite).
It features:
Detailed documentation is available in the docs/ directory.
The platform is a monorepo. Install the CLI application:
# Core & SDK
pip install -e packages/adapter-sdk
pip install -e packages/cli # Installs 'nl2sql' command
# Database Adapters (install as needed, or let setup wizard handle it)
# pip install -e packages/adapters/postgres
Run the interactive wizard to configure your database and LLM:
nl2sql setup
This will create your configuration files and index your schema.
Querying
nl2sql run "Show me the top 5 users by sales"
Other Commands
nl2sql doctor - Diagnose environment issues.nl2sql list-adapters - Show installed database adapters.nl2sql benchmark - Run evaluation suite.The system uses a directed graph of AI Agents (Planner -> Validator -> Generator).
graph TD
UserQuery["User Query"] --> Semantic["Semantic Analysis"]
Semantic --> Decomposer["Decomposer Node"]
Decomposer -- "Splits Query" --> MapBranching["Fan Out (Map)"]
subgraph Execution_Layer ["Execution Layer (Parallel)"]
MapBranching --> SQL_Agent["SQL Agent (Planner + Validator + Executor)"]
end
SQL_Agent -- "Result Set" --> Reducer["State Aggregation"]
Reducer --> Aggregator["Aggregator Node"]
Read more in the Architecture Overview.
See Development Guide.