Genie Agents (Natural-Language Q&A)

Databricks · Databricks SQL & BI

Theory

A Genie Agent (called a Genie space until mid-2026, and listed as AI/BI Genie in older material) lets business users ask questions about data in plain English and get answers as SQL results and charts. An analyst sets it up for one subject area: they add the Unity Catalog tables or metric views, write instructions (business terms, such as "FY starts in April" or "active customer means an order in the last 90 days"), and add example SQL queries for tricky questions. Genie then turns each question into SQL, runs it on a SQL warehouse with the user's permissions, and shows the query so answers can be checked. Benchmarks and user feedback help the author improve accuracy.

Example: Priya, a regional manager, asks the Sales agent "top 3 cities by sales last month for Enterprise customers" and gets a table and bar chart without writing SQL.

Why we use it

Dashboards answer only the questions someone planned for. Genie Agents let non-technical users ask follow-up questions themselves, on governed data, while the data team controls the tables, definitions and example queries behind the answers.

When to use it

Use a Genie Agent for a focused domain with clean, well-described tables and clear business terms. Do not point it at hundreds of raw tables. For fixed KPIs everyone views daily, a dashboard is better; Genie complements dashboards for follow-up questions.

How it works

  1. Genie Agents → New
  2. Pick tables such as main.sales.orders and customers, click Create
  3. Add instructions, business terms and example SQL
  4. Test with real questions
  5. Are answers correct? Yes: Share the agent with business users. No: Add instructions or example SQL and retest.
  6. Review feedback and benchmarks regularly

Syntax

UI: Genie Agents → New → choose data sources → Create
  Configure → Data (tables) | Settings (title, default warehouse, sample questions)
  Instructions: text instructions, example SQL queries, SQL expressions → Share
Needs: pro or serverless SQL warehouse, SELECT on the data

Example

-- Example SQL added to the agent's instructions for "repeat customers"
SELECT c.city, COUNT(DISTINCT o.customer_id) AS repeat_customers
FROM main.sales.orders o
JOIN main.sales.customers c ON o.customer_id = c.customer_id
WHERE o.customer_id IN (
  SELECT customer_id FROM main.sales.orders
  GROUP BY customer_id HAVING COUNT(*) > 1)
GROUP BY c.city;

-- Text instruction examples:
--   'Sales' means SUM(orders.amount) in INR.
--   Financial year starts on 1 April.
--   Segment values are Retail, SME, Enterprise.

Key points

Databricks topics

Databricks Fundamentals

Compute

Notebooks & Development

Apache Spark on Databricks

Delta Lake

Unity Catalog & Governance

Data Ingestion

Declarative Pipelines (Lakeflow)

Lakeflow Jobs

Databricks SQL & BI

Architecture, Performance & Cost

Machine Learning & AI

Certification & Interview

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Master Databricks

The lakehouse platform from the ground up: Apache Spark, Delta Lake, Unity Catalog, Lakeflow pipelines and jobs, Databricks SQL and MLflow. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice SQL / Spark SQL Sharpen the SQL you use in Databricks SQL and Spark SQL: 150 query problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Databricks  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

{{ sec.h }}

{{ sec.body }}

{{ sec.body }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
Want to run this yourself? Databricks needs a real workspace — there's no in-browser engine for it. Click Copy above, then paste it into a notebook or the SQL editor in Databricks Free Edition (free, no credit card) and run it on serverless compute.
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic