How kashish1530/data-analytics-agent works
This is a Streamlit text-to-SQL analytics app: a user asks a business question, the app may clarify ambiguity, the engine builds SQL using database schema context and a Groq model, and the agent validates and executes the query against SQLite before the UI displays results. The agent also provides schema-inspection, distinct-value, and calculation tools, plus a bounded repair loop used by its question-answering flow. The README documents these capabilities; the sampled app path calls generation and query execution directly. Unshown evaluation and data-generation scripts are omitted.
Main entry points: agent.py Database agent · app.py Streamlit canvas · engine.py SQL generation and cache · Chinook_Sqlite.sqlite Chinook SQLite
Components 15
User interaction
- Streamlit canvas
app.py - Ambiguity check
engine.py - Results and charts
app.py
Agent tools
- Database agent
agent.py - Repair loop
agent.py - Schema inspector
agent.py - Distinct-value lookup
agent.py - Calculator
agent.py
SQL engine
- AST safety check
engine.py - Read-only executor
engine.py - Schema context
engine.py - SQL generation and cache
engine.py
Data and model
- Chinook SQLite
Chinook_Sqlite.sqlite - Groq API
Other components
- Analyst
Connections 16
- Analyst → Streamlit canvas: asks question
app.py - Streamlit canvas → Ambiguity check: checks ambiguity
app.py - Streamlit canvas → SQL generation and cache: requests SQL
app.py - Streamlit canvas → Database agent: runs query
app.py - Database agent → AST safety check: validates SQL
agent.py - Database agent → Read-only executor: executes SQL
agent.py - Read-only executor → Chinook SQLite: reads rows
engine.py - SQL generation and cache → Schema context: gets schema
engine.py - Schema context → Chinook SQLite: reads metadata
engine.py - SQL generation and cache → Groq API: requests completion
engine.py - Repair loop → SQL generation and cache: regenerates SQL
agent.py - Repair loop → Database agent: runs query tool
agent.py - Database agent → Schema inspector: provides tool
agent.py - Database agent → Distinct-value lookup: provides tool
agent.py - Database agent → Calculator: provides tool
agent.py - Streamlit canvas → Results and charts: renders output
app.py