Building Higher Quality Genie Agents (fka Genie spaces): How to Ensure Accuracy and Trust

Hanlin Sun, Shah Amini18 Jun 2026

Problem

A team gives business users a text-to-SQL agent over the company warehouse. Answers are only as good as the context behind them: tables without descriptions, two ways to calculate the same metric and vague instructions all make the agent less accurate. Users then stop trusting it, and authors cannot test every possible prompt by hand.

Example from the article: in the demo, a sales manager asks which accounts had open opportunities in the last four months. The first query returns nothing, and the agent has to rewrite it until it gets 105 unique opportunities.

Solution in brief

Give each agent one narrow purpose and a small, well-described data set with metrics defined once. Fill the gaps with explicit rules, SQL expressions and example SQL, not long text instructions. Measure accuracy with a benchmark of questions with ground-truth SQL, and after launch review user messages and feedback to find the next gap.

Questions this case answers
  • How to make a text-to-SQL analytics agent give consistent answers by filling its context gaps with explicit rules and example queries instead of long text instructions
  • How to evaluate a text-to-SQL agent with a benchmark of questions with ground-truth SQL that works like unit tests, and how to write instructions that make it ask for missing details instead of guessing
  • How to make a text-to-SQL analytics agent give accurate and consistent answers to business users
  • How to evaluate a text-to-SQL agent with a benchmark set that works like unit tests

Tools and methods

  • Genie Agents (formerly Genie Spaces) — low-code text-to-SQL agents on Databricks; soon also over files and external apps via MCP.
  • Unity Catalog metric views — one central definition of each business metric for all agents.
  • Benchmarks — questions with ground-truth SQL, run by UI or API, optional LLM-as-a-judge criterion.
  • Genie Code — assistant that builds the agent, writes descriptions, joins and filters, and analyzes benchmark results and usage.
Continue reading — it's free

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