Bridging the gap between complex databases and actionable business insights.
LUMEN | Data Intelligence Agent is an advanced Text-to-SQL Agent designed to demonstrate the power of Generative AI in Enterprise Data Analytics. It allows non-technical stakeholders to query complex SQL databases using natural language, receive accurate answers, and visualize trends instantly.
- Natural Language to SQL: Translates business questions (e.g., "What is the revenue trend for Laptop Pro X?") into optimized SQL queries.
- Autonomous Agent Architecture: Built with LangChain and OpenAI/OpenRouter, the agent understands schema, joins tables, and executes queries securely.
- Interactive Visualizations: Automatically generates Plotly charts for data-heavy responses, enabling instant trend analysis.
- Modern Tech Stack:
- Frontend: Next.js 14 (App Router), TypeScript, Tailwind-free CSS Modules (Glassmorphism Design).
- Backend: FastAPI, Uvicorn, SQLite (extensible to PostgreSQL/Snowflake).
- Tooling: FastMCP (Model Context Protocol) for standardized tool execution.
In the consulting and enterprise world, data accessibility is often a bottleneck. Decision-makers rely on data analysts to write SQL queries, creating delays.
LUMEN | Data Intelligence Agent solves this by:
- Democratizing Data Access: Empowering managers to get answers instantly without knowing SQL.
- Reducing Time-to-Insight: From question to visualized answer in seconds, not days.
- Scalable Architecture: The agentic design allows for easy integration of new data sources and tools.
The GitHub Pages deployment is a static showcase only. To use the full "Chat with your Data" functionality, you must run the backend locally, as it requires a Python environment to execute SQL queries and generate plots.
- Python 3.11+
- Node.js 18+
- An API Key (OpenAI or OpenRouter)
git clone https://github.com/leonleidner/text-to-sql-agent.git
cd text-to-sql-agentThe backend handles the LLM logic, SQL execution, and plotting.
# Install dependencies
pip install -r requirements.txt
# Start the FastAPI server
# This will run on http://localhost:8001
uvicorn backend.api:app --reload --port 8001The frontend provides the chat interface and dashboard.
cd frontend
# Install dependencies
npm install
# Start the development server
# This will run on http://localhost:3000
npm run dev- Open
http://localhost:3000in your browser. - Scroll down to the Interactive Preview.
- Click the Settings icon and enter your API Key.
- Enable "Enable Plotting".
- Ask a question like:
- "Show me the monthly revenue for Laptop Pro X over the last 2 years."
- "Which product has the highest profit margin?"
graph TD
User[User] -->|Natural Language| Frontend[Next.js Frontend]
Frontend -->|API Request| Backend[FastAPI Backend]
Backend -->|LangChain| Agent[SQL Agent]
Agent -->|Schema Info| DB[(SQLite Database)]
Agent -->|Generate Plot| PlotTool[Plotly Tool]
Agent -->|SQL Query| DB
DB -->|Raw Data| Agent
Agent -->|Final Answer + JSON| Backend
Backend -->|Response| Frontend
Leon Leidner
Built as a showcase for advanced Data Engineering & AI Agent capabilities.