How We Built Agent Mode for Genie

Alan Lee, Ryan Ziegler16 Jun 2026

Problem

Teams building an LLM agent that answers open questions on company data, such as "why did revenue fall last month?", hit the same failures. The question has no single query: the agent must confirm the change exists, define it, and check many segments and relationships. A planner that splits the work between subagents wastes tokens on dead ends, loses context between agents, and ends up with inconsistent definitions. Long sessions drift, and SQL errors reach the user.

Example from the article: asked "Is Nick Bruce one of our best customers?", the early Databricks Genie agent planned three steps: check the customer exists, compare him with other customers, assess his loyalty tier. The customer does not exist, so the second and third subagents each rediscovered the empty result.

Solution in brief

Databricks replaced the planner and subagents with one agent in a single loop. It calls small tools (execute SQL, output response), so every result stays in one shared context. Four additions keep it reliable: stated definitions, an adaptive task checklist, actionable error messages, and guidance shown only when needed.

Questions this case answers
  • How to build an LLM data agent that investigates why a metric changed by using one shared context instead of a planner with subagents
  • How to keep metric definitions consistent and recover from query errors in a long multi-query LLM analysis session
  • How to build an LLM data agent that investigates why a metric changed
  • How to keep an LLM analytics agent consistent when it runs many SQL queries in one session

Tools and methods

  • Single agent with atomic tools — execute_sql, create_visualization, output_response
  • Stated definitions — the agent writes out the definitions it applies before analysis
  • Adaptive task checklist — initial hypotheses drafted on a clean context; tasks are completed, cancelled or added
  • Actionable errors and progressive disclosure — guidance appears only after a failure
  • SQL — the only data-access tool
Continue reading — it's free

Google or a one-time email code. No password.