AI SQL Agent for Large Databases
About Project
AI SQL Agent is an enterprise-grade natural language to SQL solution that enables non-technical users to interact with complex databases using plain English. The system converts business questions into optimized T-SQL queries, executes them securely against SQL Server, and presents both the resulting data and a human-readable summary. To overcome the challenges of large database schemas, the solution uses intelligent two-stage vector-based schema pruning to identify the most relevant tables and columns before generating SQL. This significantly reduces LLM context requirements while improving query accuracy, performance, and cost efficiency. Built with LangGraph, FastAPI, FAISS, and LLM technologies, the platform incorporates read-only guardrails to prevent unauthorized database modifications. An automated self-correction mechanism analyzes SQL execution errors and retries failed queries, improving reliability without manual intervention. The solution demonstrates our expertise in AI application development, intelligent automation, enterprise data solutions, natural language processing, and custom software development.




Core Features
- Natural Language Queries
- SQL Generation
- Schema Pruning
- Table Selection
- Column Selection
- Vector Search
- Semantic Search
- SQL Guardrails
- Read-Only Access
- Query Execution
- Error Correction
- Automatic Retries
- Result Summarization
- Database Analytics
- FAISS Indexing
- Schema Embeddings
- REST API
- Enterprise Scalability
- Context Optimization
- Cost Optimization
-
Technology Stack:
AI & Orchestration:
Technology Purpose LangGraph StateGraph orchestration of the agent workflow - nodes, edges, self-correction loop LangChain / LangChain Community LLM chains, prompt templates, output parsing, FAISS vector store wrapper Groq (qwen/qwen3-32b) High-speed inference for SQL generation, manifest generation, and summarization HuggingFace sentence-transformers (all-mpnet-base-v2) Local CPU embedding model for table and column vectors Azure OpenAI / Ollama Optional alternative embedding and LLM providers LangSmith Optional tracing and observability of agent runs
Vector Search & Data Processing:
Technology Purpose FAISS Approximate nearest-neighbour L2 similarity search over table and column vectors NumPy Storage and manipulation of pre-computed float32 embedding arrays (.npy) scikit-learn Similarity computation and hybrid re-ranking support pandas Tabular result handling and transformation
API & Runtime:
Technology Purpose FastAPI REST API exposing /query, /health, and /refresh-schema Uvicorn ASGI server running the application Pydantic Request and response schema validation Python 3.12+ / uv Implementation language and dependency, environment, and script management PyYAML / python-dotenv Configuration files and environment credential management - Client: South Africa based client
- Region: Africa
- Duration: 6 months
- Team Size: 1
AI Job Monitoring & Automation Platform
AI Job Monitoring & Automation Platform Home / Portfolio /...
Activity Monitor System
Activity Monitor System Home / Portfolio / Activity Monitor System...
Shopping App Dashboard
Shopping App Dashboard Home / Portfolio / Shopping App Dashboard...