Why Data-Intelligent Agents Win: A Side-by-Side Benchmark

Austin Choi, Dan Pechi18 Jun 2026

Problem

Teams that point a general-purpose coding agent (Claude Code) at a warehouse through a bare SQL tool get answers that are plausible but wrong, or right only after many detours. Each tool call re-sends the whole conversation, so schema discovery and retries inflate tokens, latency and the bill. Users also phrase requests in words absent from the schema, so keyword search finds nothing.

Example from the article: a fintech app (Yape) has no service called "rent". For "What services do users use to pay rent?" the raw-SQL agent greps "rent" and "rental", gets 0 rows and answers that it found no rent service.

Solution in brief

Do the definition work once in the data layer, then point the agent at it. KPIs and cohorts live in governed metric views, parameterized queries in UC functions, and user wording is matched by vector search. The agent makes one deterministic call instead of writing SQL, which gives fewer tokens and room for a cheaper model.

Questions this case answers
  • How to make an LLM agent answer business questions over a warehouse with one deterministic call instead of writing SQL that explores the schema
  • How to cut token cost and latency of a multi-step data agent when user wording does not match schema names
  • How to make an LLM agent answer business questions over a warehouse correctly instead of guessing SQL
  • How to cut token cost and latency of a text-to-SQL agent

Tools and methods

  • Metric views (Unity Catalog) — KPI and cohort definitions the agent calls.
  • Vector Search over intent phrases — matches user wording via support-log phrases.
  • UC functions with LLM-readable docstrings — parameterized queries the agent invokes.
  • Genie spaces — text-to-SQL with an ontology; Claude Code can call one.
  • Unity AI Gateway — cost observability, rate limits, routing to smaller models.
Continue reading — it's free

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