Engineer user interface equipped SQL AI Agent with MySQL Workbench integration to generate complex queries. This agent will empower Business/Data Analysts to answer important business questions and facilitate decision making.
- Overview
- Tools & Technologies
- Engineering SQL AI Agent
- Business Questions & Key Findings
- Author & Contact
This project aims to design and develop user interface equipped SQL AI Agents with an integration of MySQL Workbench to generate complex SQL statements. This user-friendly and time efficient program will help Business/Data Analysts to answer ad-hoc requests and facilitate decision making.
- Design the entire workflow and Use CrewAI to develop SQL Agent
- Integrate the agent with MySQL workbench
- Develop a low design user interface (UI) using Tkinter
| Tool/Platform | Purpose |
|---|---|
| Google AI Studio | API Key |
| CrewAI | Develop AI Agents |
| Tkinkter | User Interface |
| ChatGPT & Copilot | Code Assistance |
| Power BI | Visualization |
| Gamma AI | Presentation |
from crewai import LLM
llm = LLM(
model= "gemini/gemini-2.0-flash",
temperature= 0.1,
api_key= GEMINI_API_KEY
)
llm.call("What is the full name of APJ Abdul Kalam")
agent = Agent(
llm= llm,
role="MySQL Query Generator",
goal= "Generate MySQL queries based on user input.",
backstory= "You are an SQL expert who writes efficient MySQL queries based on user requirements."
)
task = Task(
description= f"""Generate an MySQL query based on the following user input:
'''{user_input}'''
""",
agent= agent,
expected_output= "A valid MySQL query that completes the task described in the user input"
)
crew = Crew(
agents= [agent],
tasks= [task]
)
result = str(crew.kickoff().raw).replace("```sql", "").replace("```", "").strip()
result
- Used Prompt 1 to generate code and connect MySQL Workbench
- Used Prompt 2 to integrate agent and develop a Tkinter GUI.
- Business question: Leadership wants to know the total number of newly launched products accross segments and their contribution in revenue.
- Input prompt:
Generate a query to compute the increae in unique product counts in each segments in F.Y. 2021 and
how much revenue the new products contributed in whole of each segment.
Output:
segment | unique_products_2020 | unique_products_2021 | new_unique_products | total_revenue_2021 | revenue_by_new_products | pct_of_total_revenue | rest_revenue
- Used Prompt 3 to design presentation slide
- Modified and Changed the final formatting with company standard
Gaurav Patil (Data Analyst)
- π LinkedIn




