The NL2SQL Platform is a modular, agentic system designed to convert natural language questions into accurate, authorized SQL queries across multiple database engines.
The system is built on three pillars:
nl2sql-adapter-sdk.The system follows a directed graph execution flow, orchestrating several specialized AI Agents.
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"]
Aggregator --> FinalAnswer["Final Response"]
The entry point. It understands the user’s intent (“Compare sales in US and EU”) and identifies which datasources contain the relevant data. If necessary, it splits the query into sub-questions (e.g., “Get US sales”, “Get EU sales”).
For each relevant datasource, a dedicated SQL Agent is spawned. This is where the core logic lives. It iteratively plans a query, validates it against security policies, generates SQL, and verifies execution feasibility.
Read more about the SQL Agent.
Once all agents complete their work, the Aggregator Node synthesizes the results. It can perform cross-database operations (like calculating the difference between the two sub-queries) and formats the final answer for the user.