I Built an AI Data Agent Which Can Query Data and Answer Business Questions. Here’s How.
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
A step-by-step walkthrough of building a conversational AI data agent using Google Cloud BigQuery's Conversational Analytics API. The demo, called the Avocado Sales Analytics Agent, lets business users ask natural language questions and receive SQL-backed answers without writing any SQL. The guide covers choosing between building from scratch (LangGraph, CrewAI) vs. using managed cloud platforms (Snowflake Cortex, Databricks Genie, Microsoft Fabric), setting up BigQuery with a Kaggle dataset, writing effective agent instructions including metric calculation rules, date handling, and geographic data quality notes, adding verified queries to prevent incorrect aggregations, and wrapping the agent in a lightweight Flask chat app that filters out intermediate reasoning messages from the API response.
Table of contents
What Is a Data Agent?Choosing the Right ApproachBuilding a Data Agent With No CodeBuilding the Chat ApplicationFinal ThoughtsQuestions this post answers
How do I filter out intermediate reasoning messages from the BigQuery Conversational Analytics API response?
Filter responses by checking the text_type field: discard messages where text_type == 1 (THOUGHT) and keep only messages where text_type == 2 (FINAL_RESPONSE). By default the API streams back its entire reasoning process as system_message responses, including steps like 'Analyzing context' and intermediate SQL generation thoughts, so this filter is required to surface only the final answer. Developers integrating the BigQuery Conversational Analytics API track gotchas like this on daily.dev.
Why should I use weighted average price instead of AVG(AveragePrice) when aggregating avocado sales data in BigQuery?
AVG(AveragePrice) treats every row equally regardless of sales volume, producing a misleading result when rows represent different quantities. The correct formula is SUM(Total Volume * AveragePrice) / SUM(Total Volume), which weights each price by the number of avocados sold in that record. Using the simple average inflates or deflates the true per-unit price whenever row volumes differ significantly. Teams building analytics agents on warehouse data discuss aggregation pitfalls like this on daily.dev.
What managed cloud options exist for building a no-code conversational data agent over a data warehouse?
Three major platforms offer native managed data agents: Snowflake Cortex Agents (low-code pipelines hosted inside Snowflake, accessible via Snowflake Intelligence), Databricks Genie (conversational data intelligence within the Databricks ecosystem), and Microsoft Fabric Data Agents (supporting lakehouses, warehouses, KQL databases, and Power BI semantic models). Google Cloud BigQuery also provides a Conversational Analytics API with a free-trial tier. Developers deciding between warehouse platforms for AI-native analytics compare options like these on daily.dev.