---
title: "What we learned running an analytics agent bench 150+ times - Atlan Frontier Labs"
url: "https://atlan.com/frontier/essays/a-context-bench-for-analytics-agents/"
description: "107 real business questions, more than 150 runs, one kind of context changed each time. Describing the data barely helped; the SQL analysts had already run took an analytics agent from 32% to 83%."
---

Field notes from Atlan Frontier Labs (essay 010) by Himanshu Sikaria, Head of AI Labs & Field Engineering, Atlan. Part of [Becoming Frontier](https://atlan.com/frontier/).

Every company wants self-serve analytics: anyone asks a question and gets a number they can trust. In practice, most answers still go through an analyst. The usual fix is to give an AI agent the context a human analyst would need: descriptions of tables and columns, documentation, definitions. That barely moves the agent's accuracy, and writing it by hand doesn't scale. We wanted to know exactly which context does move accuracy, and how to test that rigorously. We only tested context that AI generated from what the warehouse and dashboards already hold, because nobody will write it by hand at scale. So we asked an agent 107 real questions about our business, more than 150 times, changing one kind of context each time.

**Headline results: with AI-generated context, here is what we found**

```text
32% -> 83%
Share of 107 real business questions answered correctly: tables only, then AI-generated context. Same model.
11% -> 82%
The same, on the 61 harder questions that need data from more than one table
3-6x cheaper
Cost per correct answer with AI-generated context, against semantic views written by hand (3x) and an ontology (6x)
```

## The Problem Which Isn't Solved Yet

Everyone is building agents that let people talk to their data. We tested ours on our own go-to-market data, which hundreds of Atlanians query every day and which is as messy as any customer's. We built a bench: real questions, each with a sealed right answer, put to the agent again and again with one thing changed at a time.

Here is an example to make this real. One question in our benchmark asks, "How much sales pipeline did a conference influence?" The answer has to count each customer account once.

The tables to answer it are all there: who registered, who attended, which accounts they belong to, which deals those accounts have. Give an AI agent the table definitions and it writes a tidy query and returns a number without hesitation.

The number is 4.4 times the right answer. The agent added up every deal for every person on every row. It counted deals that existed before the conference, and people who registered but never showed up. Anyone on our marketing team knows the three rules for this question:

1. count each account once, however many of its people came;
2. count only deals that started after the event;
3. count only people who actually attended.

None of those rules is written in the tables. That is what goes wrong with most analytics agents. The model can write SQL. What it lacks are the decisions a business has made and never written down, and describing tables and columns doesn't solve that. We wanted to know which kind of context actually gets those decisions to an agent, so we tested every kind we could find.

## How We Tested

The benchmark is 107 hard questions our own teams asked of that data: dashboard tiles, questions from business reviews, requests that landed on an analyst's desk. Each has one right answer, usually a number, a count or a date. We sealed each answer by running the correct SQL against a frozen copy of the warehouse and checking it against the dashboard the business already trusts.

**The questions: 107 questions from five parts of the business**

```text
The questions
107 questions from five parts of the business
Questions per business area, with a few of them as they were asked.
40 22 21 17 7
Marketing events and campaigns Account and product usage Sales pipeline Customer success Sales operations
Marketing How many customer contacts registered for our spring event? Asked by a CSM
Marketing How many opportunities entered the first stage after the event? Asked by a RevOps lead
Pipeline As of the date of last quarter's business review, how much open new-business and upsell pipeline did we have? Asked by a RevOps lead
Customer success How many customer accounts churned this quarter? Asked by a CSM manager
Customer success What is Nora's E2E like? Asked by a CX lead
Questions arrive in the team's own shorthand. Nora is our AI support agent, and E2E is its end-to-end resolution rate.
```

Every run used the same single read-only SQL tool, the same step limit and the same questions. Only the context placed in front of the agent changed. Code graded every answer: counts had to match exactly and amounts agree within half a percent, and a refusal counted as a miss.

With two exceptions, **no person wrote the context**. Every metric, past query and definition the agent saw was built by our systems from what the warehouse already had, mainly the log of queries our analysts had run. The exceptions are the comparisons: we wrote the semantic views by hand, and people built the ontology with a model's help, to match how teams build them today.

The query log was the main source, but not the only one worth mining. Dashboards hold the definitions the business already agreed to show, so reverse-engineering the BI reports leaders read is the other half of the job.

**Figure 1: How one run works**

```text
Figure 1
How one run works
The agent sees the question and the context being tested. Only the grader sees the right answer.
Question
as the business asked it
Context being tested
the one thing that changes
AI agent
one read-only SQL tool
Frozen warehouse
same copy every run
Answer
Grader
code
Right answer
sealed
WHAT THE AGENT SEES
GRADER ONLY
```

Here are the pieces of context we compared, and how each one performed.

**Figure 2: The setups**

```text
Figure 2
The setups
Same model, same questions. Each row adds one kind of context to the bare table definitions.
Setup What the agent was given Right
Describes the data
Bare schema
Table and column names and types. Nothing else.
31.8%
Documentation
Written descriptions of every table and column, plus usage notes mined from the query log.
43.9%
Profiling
Column statistics, sample values and likely joins.
34.6%
Semantic views
40 hand-written semantic model files describing tables, joins and measures.
38.3%
Ontology
A business knowledge graph, queried in SPARQL.
33.6%
Shows decisions as SQL
Past SQL
The five most relevant queries our analysts had run, served whole.
70.1%
Ranked past SQL
Past queries deduplicated and ranked by how many analysts ran them.
75.7%
Metrics layer
The configuration we ship: metrics mined from the query log, each with checked SQL, plus trusted past SQL, a handful served per question.
83.2%
```

## First Up: Back to Our Original Question

Before any averages, here is the conference question from section 01 run through the setups. For each, we read the agent's SQL to see which of the three rules it applied, and how far off its answer was.

**Figure 3: "How much pipeline did the conference influence, counting each account once?"**

```text
Figure 3
"How much pipeline did the conference influence, counting each account once?"
The agent's answer as a multiple of the right one. 1.00x is correct.
Rule 1 / Once per account However many of its people came
Rule 2 / After the event Only deals that started after it
Rule 3 / Attended Not registered and absent
Bare schema Table definitions only
 Once per account After the event Attended
4.4x too high
Profiling, semantic views or ontology All three gave the same answer
 Once per account After the event Attended
4.0x too high
Past SQL Five analyst queries
 Once per account After the event Attended
1.7x too high
Metrics layer What we ship
 Once per account After the event Attended
1.00x correct
From the run traces for this question; answers shown as multiples to keep our pipeline figures private.
```

Describing the data got the agent one rule out of three, and three quite different ways of describing it landed on exactly the same wrong number. The rules that fixed the answer, the date cut-off and the attendance filter, arrived only in SQL that someone had already written. The rest of this piece shows the same pattern across all 107 questions.

## Describing the Data Barely Helped

We started where most teams start, and where most advice points: tell the agent more about the data.

- **Documentation** gave the agent table and column descriptions, detailed READMEs, and the popular filters and joins mined from the query log. It reached 43.9%, twelve points above bare schema. The written descriptions alone reached 39.3%; the filters and joins added the rest.
- **Semantic views**, 40 files written by hand, reached 38.3%. Each view declares how its tables join, but not when a join should be used, and the agent struggled to join one semantic view to another.
- **The ontology** reached 33.6%, and took more than five minutes per question. It was a virtual knowledge graph built with Ontop. Most of our questions ask what happened, which means aggregates, and running aggregates through the knowledge graph was slow and didn't lift accuracy.
- **Column profiling** reached 34.6%. It made the agent far more willing to answer: refusals fell from 33 to 9. But only three of those became right answers. The rest became wrong ones. We call this *confident drift*.

Each of these tells the agent what the data is. None tells it a decision the business has made.

## What Worked: SQL That Shows the Decision

An analyst who has already written the right query for the conference question has already decided to count accounts once, cut off at the event date and drop the no-shows. The query carries those decisions. So does every query in the log that someone wrote, ran and kept using. The problem is separating that signal from the noise.

Giving the agent the five most relevant past queries took it from 31.8% to 70.1%. **Trust what people reuse:** ranking queries by how many analysts ran them reached 75.7%, at 1.3¢ per right answer, the cheapest we measured.

The metrics layer goes one step further. Our systems mine the query log for metrics, merge duplicates, run each metric's SQL against the warehouse to check it, and serve the few that fit each question alongside trusted past SQL. It reached **83.2%**, and broke nothing: every question bare schema got right, it got right too.

**Figure 4: Describing the data vs showing the decision**

```text
Figure 4
Describing the data vs showing the decision
Share of all 107 questions answered correctly.
Describes the data Shows decisions as SQL
Metrics layer
83.2%
Ranked past SQL
75.7%
Past SQL
70.1%
Documentation
43.9%
Semantic views
38.3%
Profiling
34.6%
Ontology
33.6%
Bare schema
31.8%
0 25 50 75 100%
We quote the configuration we ship, not its best run; on the same model, variants of the same layer scored between 74.8% and 84.1%.
```

## Why SQL Worked: The Hard Questions Need Complex Rules

Why did SQL work where descriptions didn't? Most of the difference comes from one kind of question: the ones that need data from more than one table. With bare schema, the agent answered 31.8% of questions correctly. That average hides two very different results. On the 42 questions a single table can answer, it got 64% right. On the 61 that need data from more than one table, it got 11% right, and it refused to answer half of them.

Describing how the tables connect did not fix this, because the join was never the whole problem. The rules were missing, and on these questions the rules are more complex and span tables: count each account once, count only deals after the event, count only people who attended. That is where the agent struggled most. Semantic views and the ontology both spell out the joins, and both stayed under 20% on these questions. We tried five different ways of describing joins in all; every one landed between 15% and 18%. When we read the agent's SQL, it often contained no join at all: the agent had found one wide table and answered from that.

We call this *join blindness*. Only past SQL and the metrics layer, both of which show joins that already worked, broke through it.

**Figure 5: Questions that need a join are where setups differ**

```text
Figure 5
Questions that need a join are where setups differ
Share answered correctly, on 42 single-table and 61 multi-table questions.
One table Needs a join
Bare schema
64%
11%
Documentation
schema docs + usage patterns
79%
16%
Semantic views
74%
16%
Ontology
60%
18%
Past SQL
83%
61%
Metrics layer
93%
82%
Four questions with no reference SQL sit in neither group. Documentation is the strongest "describe" setup on single-table questions, and it still stalls at 16% once a join is needed.
```

## Does It Have to Be SQL? Why Not Just English?

So is it the knowledge in the SQL that helps, or the SQL itself? Could the same rules, written in plain English, work as well? We tested it directly. We took the metrics layer and served every metric two ways: once as its name and SQL, once as its name and English prose carrying all the same logic. Nothing else changed.

SQL won, 84.1% to 74.8%. On questions that need a join, SQL got 50 of 61 right and English got 40. On single-table questions, they tied at 40 of 42. When the answer sits in one table, a sentence is enough. When it needs a join, the agent has to turn the sentence into SQL itself, every time, and every translation is another chance to drop a rule.

**Figure 6: The same metric, in English and in SQL**

```text
Figure 6
The same metric, in English and in SQL
Only the form changed. The example is simplified; the scores are measured across all metrics.
In English
Conference-influenced pipeline: for each account with someone who attended, the pipeline of deals that started on or after the event date. Count each account once.
40/61 needs a join
40/42 one table
74.8% overall
In SQL
SELECT account_id,
MAX(pipeline) AS pipeline
FROM event_attendees
WHERE event = :event
AND status = 'Attended'
AND deal_start >= :event_date
GROUP BY account_id
50/61 needs a join
40/42 one table
84.1% overall
Both variants ran on the same day as the 83.2% configuration.
```

Taking each metric apart pointed the same way. Removing its English description cost nothing. Removing its SQL cost 8 points.

**Figure 7: What each part of a metric is worth**

```text
Figure 7
What each part of a metric is worth
The metrics layer with one part removed from every metric. The axis starts at 60%.
Name and SQL only
84.1%
Everything (as shipped)
83.2%
Without its trust signals
81.3%
Name and English only
74.8%
60 70 80 90 100%
None of the 21 questions that SQL turned from wrong to right was fixed by values alone, such as a stage name. The query supplied the values, the right column and the shape of the calculation together.
```

The same held at the level of a single table. In a separate test on 35 questions, with the same table scope and budget, we swapped only the notes on each table. The table's own DDL, the SQL that created it, beat our pre-existing catalog description by 20 points, with half the queries. The gotchas live in the SQL; descriptions don't carry them.

**Figure 8: The table's own DDL beat its written description**

```text
Figure 8
The table's own DDL beat its written description
A separate test on 35 questions, not the 107. Same table scope and budget; only the table notes changed.
No table notes
42.9%
Catalog description pre-existing
48.6%
Raw DDL the table's own SQL
68.6%
Given Correct Cost per task Seconds Queries
No table notes
15/35
$0.020
85.2
11.6
Catalog description
17/35
$0.009
34.3
5.1
Raw DDL
24/35
$0.006
18.6
2.5
```

## The Most Accurate Setups Were Also the Fastest

Accuracy is only part of the picture. An agent people use every day also has to be cheap and fast enough to run, so every run logged tokens, dollars and seconds per question. The two most accurate setups were also the two fastest: 29 and 22 seconds per question. Ranked past SQL produced the cheapest right answers, at 1.3¢. The metrics layer cost 3.9¢ per right answer, close to bare schema's 3.4¢, for 2.6 times as many right answers.

The setups that describe the data were slower, and the slowest by far was the ontology: more than five minutes per question and 22.6¢ per right answer, about six times the metrics layer. Describing the data gives the agent more to read and no query that already works, so it searches more before it answers.

**Figure 9: Accuracy against cost per right answer**

```text
Figure 9
Accuracy against cost per right answer
Top left is best: more right answers, each costing less.
30% 50% 70% 90%
0¢ 6¢ 12¢ 18¢ 24¢
cost per right answer
Metrics layer: 83.2%, 3.9¢
Ranked past SQL: 75.7%, 1.3¢
Past SQL: 70.1%, 2.1¢
Documentation: 43.9%, 3.7¢
Semantic views: 38.3%, 11.9¢
Profiling: 34.6%, 6.7¢
Ontology: 33.6%, 22.6¢
Bare schema: 31.8%, 3.4¢
Metrics layer / 83.2%
Ranked past SQL / 75.7%
Past SQL / 70.1%
Documentation / 43.9%
Semantic views / 38.3%
Profiling / 34.6%
Ontology / 33.6%
Bare schema / 31.8%
```

**Figure 10: Accuracy, cost and time**

```text
Figure 10
Accuracy, cost and time
One run of all 107 questions per setup.
Setup Right Cost per right answer Seconds per question Cost for 107 questions
Metrics layer
83.2%
3.9¢
29
$3.45
Ranked past SQL
75.7%
1.3¢
22
$1.07
Past SQL
70.1%
2.1¢
45
$1.55
Documentation
43.9%
3.7¢
78
$1.73
Semantic views
38.3%
11.9¢
146
$4.87
Profiling
34.6%
6.7¢
64
$2.48
Ontology
33.6%
22.6¢
317
$8.14
Bare schema
31.8%
3.4¢
31
$1.16
Cost per right answer is the run's cost divided by its right answers, so a cheap setup that is mostly wrong still costs a lot per right answer.
```

There is one more cost no token counter sees: the people who write the context. Nobody wrote our metrics layer; our systems mined it. The two setups people built, the semantic views (about 60 hours) and the ontology (about 100), scored near the bottom.

**Figure 11: Who wrote the context**

```text
Figure 11
Who wrote the context
Setup Built by Hours of human work Right
Documentation
A model
0
43.9%
Semantic views
People, 40 files
~60
38.3%
Ontology
People and a model
~100
33.6%
Metrics layer
Our systems, from the query log
0 to build
83.2%
In a real deployment, a domain owner reviews each metric before it goes live. We haven't measured what that review adds.
```

## Context or Intelligence: Which Matters More?

New models arrive every few months. Could a smarter one make all this context unnecessary? Changing the model mattered less than changing the context. With bare schema, five models scored between 31.8% and 42.1%. Given past SQL, GLM-5.2 went from 31.8% to 70.1% and GPT-5.6 from 40.2% to 66.4%. The model that started ahead finished behind.

**Figure 12: Better context beat a better model**

```text
Figure 12
Better context beat a better model
Two models, before and after adding past SQL.
BARE SCHEMA WITH PAST SQL
GLM-5.2 / 31.8% GPT-5.6 / 40.2% GLM-5.2 / 70.1% GPT-5.6 / 66.4%
five models: 31.8-42.1%
Heights to scale. With past SQL, every model we ran scored above 66%. Source: analytics-playbook , chapter 01 (model chart).
```

## How to Get to 100%

The configuration we ship missed 18 of 107. Most misses are rules about which rows belong: a cohort, an exclusion, a population. None came from a wrong value such as a stage name, because the metric SQL carries those. 46% of the remaining misses needed a definition nobody had ever written down, and only an owner can make that call.

The last stretch to 100% comes from a loop, not more documents. Read the trace of every miss, find the step where the agent guessed, and sort it into one of three kinds.

**Figure 13: Three kinds of miss, and the smallest fix for each**

```text
Figure 13
Three kinds of miss, and the smallest fix for each
Kind 1
Never written The trace shows The decision exists nowhere in the context.
Smallest fix Write the definition. If the data can't settle it, whoever owns that number decides.
Kind 2
Written, not served The trace shows The definition exists and never reached the agent.
Smallest fix Fix retrieval: a term link, alternate labels, a rank.
Kind 3
Served, ignored The trace shows The definition was in front of the agent and it took a simpler path.
Smallest fix Make it a rule the agent must follow, or make the SQL a metric.
Source: analytics-playbook , Results ("Why the last answers still fail") and Phase 3.
```

One fix can close several misses. Four of ours landed within 1% of the right answer, and all four trace to one missing rule that leaves out internal contacts. Write that rule once and four answers become right. Then rerun, and stop when the score stops moving.

## What We Learned

Two sets of lessons came out of this work: one on building the bench, one on building the agent.

**On building the bench**

- **Answers can leak into the context.** Early on, the agent was partly looking up answers in SQL our team wrote for the answer keys. Removing it dropped one setup from 64.5% to 53.3%.
- **Freeze the warehouse.** On live data the right answer changes every day, so every run queries the same read-only copy.
- **Grade the value, not the text.** Code compares each answer with the sealed key: counts must match exactly, amounts within half a percent, and a fraction equals its percentage, so 0.67 and 67% are the same answer.
- **Best of many runs can say anything.** 105 of 107 questions were answered right in at least one run, but the best single run got 90. We score one run, and treat gaps under about seven points as noise: the same setup run twice moved by six questions.

The same lessons apply to any benchmark you read, ours included. Here are the eight questions we'd ask, answered for this one.

**Figure 14: Eight questions to ask of any AI benchmark**

```text
Figure 14
Eight questions to ask of any AI benchmark
Answered for this one.
 Is the model the same in every setup being compared? Yes.
 Are there at least 20 to 30 test questions? Yes. We used 107.
 Is each score from one run, not the best of several? Yes. We quote what we ship.
 Does a refusal count as a wrong answer? Yes.
 Are cost and time reported next to accuracy? Yes. Figure 10.
 Are hard questions reported separately from easy ones? Yes. Joins vs single tables, Figure 5.
 Is the run-to-run noise stated? Yes. About 7 points.
 Was the context checked for leaked answers? Yes, after we found one.
```

**On building the agent**

These are the seven rules from our playbook, starting with the one we would do first.

1. **Start with one domain.** One domain is small enough to finish, and its open questions have someone who can settle them.
2. **Build the golden set before any context.** Without sealed answers, you can't tell a fix from luck.
3. **Fix the context before you change the model.** Switching models moved our score far less than adding context.
4. **Write each business rule into a metric's SQL.** The past queries your analysts already ran carry the rules, and a sentence leaves the agent to translate them.
5. **Settle conflicts before the agent sees them: provenance first, then the owner.** The definition most analysts ran recently, and that matches the warehouse, usually wins. A definition kept only in a spreadsheet leaves no query history, so whoever owns that number settles it. Never let the agent pick.
6. **Read the raw trace of every miss, and feed real usage back.** The summary hides the step where the agent guessed, and context left alone goes stale within a quarter.
7. **Make the agent reliable on what happened before you ask it why.** "What was pipeline last quarter?" needs metrics. "Why did it drop?" needs a model of how the business works on top of them, and it is only worth building once the numbers hold.

## Build Your Own, or Get in Touch

Everything here, and the method behind it, is in our open-source FDE Playbook for Analytics Agents: what the agent has to know, how to build and measure it, and who does what, phase by phase. Every number in it comes with how we measured it.

[Read the playbook](https://analytics-playbook.atlan.com/) / [The method on one map](https://analytics-playbook.atlan.com/#start-map) / [Contribute on GitHub](https://github.com/atlanai/analytics-playbook)

**Rather not go it alone?** Reach out to us, and we will work with you to launch your first analytics agent on your own data. ailabs@atlan.com

## Appendix: Every Question, Every Setup

Averages hide which questions moved. Below, each column is one question and each row is one setup. Read it top to bottom: blue fills in as the context improves. The gray left in the bottom row is what we still miss.

**Figure 15: All 107 answers, for each setup** (interactive grid on the page: each of the 107 questions by setup, right, wrong or refused).

## Next steps

- To see Atlan's context layer in action first, watch a recorded demo: [Atlan context layer demos](https://atlan.com/context-layer-demo/)
- To see Atlan working on your own data stack, book a demo: [Book a demo with Atlan](https://atlan.com/forms/talk-to-sales-contact/)
