|
|
ADK Agent Responding from Databricks Data
Author: Venkata Sudhakar
Databricks is widely used as a unified analytics platform for storing and querying large-scale business data in Delta Lake tables. By connecting an ADK agent to Databricks via the Databricks SQL connector, the agent can query live tables at runtime and respond with accurate, data-driven answers rather than relying on static knowledge.
ShopMax India stores their sales transactions, inventory levels, and customer data in Databricks Delta Lake. The analytics team wants a natural language interface where managers can ask questions like "What were the top 5 selling products in Mumbai last month?" and get answers drawn directly from the warehouse without writing SQL manually.
The below example shows how to create a Databricks query tool and attach it to an ADK agent for ShopMax India sales analysis.
It gives the following output,
Databricks SQL connector initialised
Host: adb-1234567890.azuredatabricks.net
Warehouse: /sql/1.0/warehouses/abc123def456
FunctionTool registered: query_databricks
Sales analytics agent ready. Connected to Databricks.
The below example shows the ADK agent running a session where a ShopMax India manager asks natural language questions and the agent queries Databricks to respond with live data.
It gives the following output,
Manager: What were the top 5 selling products in Mumbai last month by revenue?
Agent: Based on the Databricks sales table for March 2026, the top 5 products
in Mumbai by revenue were:
1. Samsung 55" QLED TV - Rs 18,45,000 (41 units)
2. iPhone 15 Pro 256GB - Rs 14,22,000 (38 units)
3. Sony WH-1000XM5 - Rs 4,18,500 (93 units)
4. MacBook Air M3 - Rs 3,96,000 (11 units)
5. LG 1.5T Inverter AC - Rs 3,12,000 (52 units)
Manager: Which warehouses have stock below reorder level right now?
Agent: The following warehouse locations currently have stock below reorder level:
- Delhi : OnePlus 12 5G (stock: 8, reorder: 25)
- Pune : Samsung Galaxy S24 (stock: 3, reorder: 20)
- Chennai : boAt Airdopes 141 (stock: 12, reorder: 30)
Recommend raising purchase orders for these items immediately.
This pattern gives ShopMax India managers a conversational analytics interface backed by live Databricks data. The agent enforces read-only access through its system instruction, uses Delta Lake as the single source of truth, and can be extended with additional tools for chart generation or automated report delivery via email or Slack.
|
|