AI-Powered Analytics Assistant
A conversational analytics tool that converts natural language into BigQuery SQL, enabling business users to self-serve repeated data pulls in real time, without raising tickets.
The Problem
The data engineering team was fielding repetitive data requests from business users and analysts - “what’s the count for X today?”, “give me last week’s numbers for Y”. These were not complex queries. They were L0 requests: simple lookups, recurring metrics, time-bound snapshots. But they were arriving constantly and consuming engineering bandwidth.
Two distinct groups needed help:
- 2–10 analysts doing L0 work - routine queries they could answer themselves given the right interface
- 5–10 business users who needed real-time data on demand but couldn’t write SQL
The volume was variable: 10–100 queries per day depending on the time of month, with spikes at reporting cycles and month-end closes.
What Was Built
An AI chatbot that converts natural language questions into BigQuery SQL, executes them, and returns results - all without engineering involvement. Powered by Google Agent Development Kit (ADK), Vertex AI (Gemini), and a RAG layer over warehouse metadata.
A business user types: “What’s today’s count for orders pending dispatch?” - and gets a result, not a ticket acknowledgment.
Architecture
flowchart TD
A["Business User / Analyst\n(natural language question)"] --> B["Google ADK Agent\n(orchestrator)"]
B --> C["Vertex AI - Gemini\n(LLM)"]
B --> D["RAG Layer\n(schema metadata, column docs, query examples)"]
C --> E["SQL Generation + Validation"]
D --> E
E --> F[("BigQuery")]
F --> G["Results returned in real time"]
Tech Stack
| Layer | Technology |
|---|---|
| Agent Framework | Google Agent Development Kit (ADK) |
| LLM | Vertex AI (Gemini) |
| Knowledge Base | RAG over BigQuery schema metadata, column descriptions, curated examples |
| Query Engine | BigQuery |
| Language | Python |
Key Metrics
| Metric | Value |
|---|---|
| Daily query volume | 10–100 (varies by time of month) |
| Analysts using for L0 work | 2–10 |
| Business users self-serving real-time data | 5–10 |
| Reduction in repeated data-fetch requests | Significant - recurring asks moved fully to self-serve |
Design Decisions
RAG for SQL accuracy
- Problem: LLMs hallucinate table and column names without grounding, especially in a domain-specific warehouse with non-obvious naming conventions.
- Approach: Built a RAG layer indexing BigQuery schema metadata, column descriptions, and curated example queries. The agent retrieves relevant context before generating SQL.
- Outcome: Reduced hallucinated column names and invalid joins to near zero for the covered query surface.
Handling repeated, real-time requests
- Problem: Business users were asking the same questions daily or weekly - “give me today’s numbers”. Each became a ticket. The need was for on-demand, repeatable access.
- Approach: The agent handles repeated natural language patterns consistently by grounding SQL generation in stable metadata. Users can re-ask the same question at any time and get current results.
- Outcome: Recurring data pulls moved entirely to self-serve. Engineering is no longer in the loop for L0 data requests.
SQL validation before execution
- Problem: Valid-looking SQL can scan unexpectedly large datasets or return semantically wrong results.
- Approach: Added a dry-run validation step - BigQuery estimates bytes scanned before execution. Anomalies are flagged before results are returned.
- Outcome: Protected against runaway queries and gave users confidence in what they were running.
Variable load by time of month
- Problem: Query volume is not uniform - spikes at month-end reporting cycles, quiet mid-month.
- Approach: The tool handles variable load without pre-warming or capacity planning, as it runs on-demand against BigQuery’s serverless execution model.
- Outcome: 10–100 queries/day handled without infrastructure management overhead.
What I Learned
- The highest-value AI analytics tools aren’t the ones that answer hard questions - they’re the ones that take simple, repeated questions completely off the team’s plate.
- Self-serve works when the interface matches the user’s mental model. Business users think in business terms, not table names. The RAG layer bridges that gap.
- Validation matters more than generation quality. A tool that fails safely gets adopted. One that returns silent wrong answers gets abandoned.
Built at Wayfair India · 2025