--- title: Text-to-SQL AI Agent emoji: 🕵️‍♂️ colorFrom: blue colorTo: indigo sdk: docker app_port: 7860 --- # 🕵️‍♂️ Agentic Text-to-SQL System This is an advanced AI Agent that translates natural language questions into SQL queries, executes them against a local SQLite database, and features an **autonomous reflection loop** to self-correct errors. ### 🚀 Key Features - **Agentic Workflow:** Uses Gemini 1.5 Flash to plan, generate, and execute SQL. - **Self-Healing:** If a query fails, the agent analyzes the error and rewrites the SQL automatically. - **Dynamic Schema Awareness:** Automatically pulls table structures to provide context to the LLM. ### 🛠️ Tech Stack - **LLM:** Google Gemini 1.5 Flash - **Frontend:** Streamlit - **Database:** SQLite - **Deployment:** Docker on Hugging Face Spaces