Blogs

How Our AI Agent Made Sense of 5 Petabytes of Enterprise Data

A simple question – “How many new customers did we get last month?” – took analysts days. Here’s how we fixed that.

  • Rishab Gupta

    Rishab Gupta

    Co Founder - Trao

3 min Read

We worked with an organization that had accumulated 5 petabytes of data.

It was the natural result of years of growth: new products, pipelines, reorganizations, migrations, and well-intentioned fixes layered on top of older ones.

Nothing was obviously broken. Queries ran. Dashboards loaded. Metrics existed.

But a simple question – “How many new customers did we get last month?” – took analysts days.

At that scale, every analysis starts the same way: Which table should I use? Does it include test accounts? Are definitions consistent across teams? Why do two “correct” queries return different numbers?

The hidden problem

Most data platforms store schemas and query logs. They don’t store what you actually need: intent.

A table like user_events_v2 looks clean in the warehouse, but its real behavior lives in code: filtering rules, deduplication logic, late-arrival windows, and joins that can silently inflate results if you miss one constraint. None of this is visible in the schema.

We built something really cool

We taught the system to read data pipelines the way an engineer does.

We built an in-house data reasoning agent and treated context as infrastructure – a queryable system:

  1. Table usage + lineage — How it’s actually joined and relied on in production.
  2. Human annotations — Domain experts know the caveats. We capture them explicitly because metadata alone can’t tell similar tables apart.
  3. Code-level enrichment — We crawl Airflow, dbt, Spark, and ETL scripts to extract what pipelines do – grain, keys, freshness, exclusions. This is how you distinguish two tables that look identical but behave differently.
  4. Institutional knowledge — Docs, postmortems, launch notes, experiment definitions. The “why did this metric dip in December?” answers live here, not in the warehouse.
  5. Memory — When a human corrects the system (“this experiment filters via gate X”), it stores that constraint so you don’t pay the same debugging tax next week.
  6. Runtime verification — If context is missing or stale, the agent inspects tables live and sanity-checks joins, null behavior, and cardinalities before trusting results.

We run a pipeline that normalizes these sources, embeds them, and retrieves only relevant pieces at query time via RAG – keeping latency predictable even at tens of thousands of tables.

Our recipe for evals

Inspired by Anthropic’s eval work, Trao treats agent outputs like code.

Each question has a golden SQL query. We generate SQL from natural language, execute both, and compare results using an LLM grader that accounts for acceptable variations. These evals run continuously, catching regressions before they reach production.

The result

Simple questions stopped taking three days. Analysts could trust their first answer.

If you’re thinking about building AI systems, feel free to email rgupta@trao.ai. We’re happy to share our learnings.

How we built an AI Data Analyst: your question (“How many customers did we get last month?”) goes to a context infrastructure of company knowledge, pipeline logic, expert knowledge and usage patterns. A data reasoning agent retrieves that context, checks corrections stored in persistent memory, and executes SQL against a 5PB data warehouse, returning the answer along with the transparent SQL.
Tap to view full size

Join our newsletter

and stay up to date with us!