|
|
ADK with Databricks Genie API
Author: Venkata Sudhakar
Databricks Genie is a conversational AI layer built into Databricks that translates natural language questions into SQL, executes them against your Delta Lake tables, and returns results in plain language. Rather than writing SQL yourself, you can call the Genie API from an ADK tool and let Databricks handle the query generation internally.
The key difference from direct SQL is that Genie understands the business context of your data - column meanings, metric definitions, and common question patterns - because it is trained on your specific data space. ShopMax India configures a Genie Space over their sales and inventory tables, and the ADK agent delegates all data questions to it.
The below example shows how to create a Genie API tool for an ADK agent and start a Genie conversation to answer a ShopMax India business question.
It gives the following output,
Genie agent ready. Space ID: 01ef1234abcd5678ef90
FunctionTool registered: ask_genie
Databricks host: https://adb-1234567890.azuredatabricks.net
Model: gemini-2.0-flash
The below example shows the ADK agent delegating two ShopMax India business questions to Genie, which handles SQL generation and execution internally before returning plain-language answers.
It gives the following output,
Manager: What was our total revenue in Bangalore in Q1 2026?
Agent: According to Databricks Genie, ShopMax India generated total revenue
of Rs 4,82,35,000 in Bangalore during Q1 2026 (January to March).
This represents a 14% increase over Q4 2025.
Manager: Which product category had the highest return rate last quarter?
Agent: Databricks Genie reports that the Laptops and Tablets category had
the highest return rate at 6.2% in Q4 2025, followed by Smart Home
Devices at 4.8%. The primary return reason for laptops was
"performance not as expected".
Databricks Genie removes the need to embed SQL knowledge in the agent prompt. The Genie Space acts as an intelligent query layer that understands ShopMax India data semantics, handles ambiguous questions gracefully, and returns business-ready answers. This is especially valuable when the underlying schema evolves - Genie adapts without prompt changes.
|
|