Building a Knowledge Agent on Databricks: The Evaluation Set Was the Real Product

Disclaimer: This post was written in November 2026 on Databricks Free Edition. Genie One, Genie Agents and the model line-up are moving fast - some limits described here may have changed by the time you read this.
This season I've been umpiring my son's teeball games. Under-9s, playing for Woodlands, a team Mechanical Rock sponsors. Runners go on every hit, a fielder stands on second without the ball, a coach asks if that run counts, and you've got about four seconds to decide.
The rules are spread across a few documents - the TBAWA (Teeball Association of Western Australia) Rule Book, Edition 8, an older Annotated Rule Book & Umpire Manual, and our local club's by-laws. They don't always agree. After each game I'd take the tricky calls to a local Claude session with them loaded, and keep a log of the answers I'd checked.
Then I wanted it on my phone, so I built it on Databricks. The surprise was what turned out to matter: the most valuable thing I built wasn't the agent - it was the set of trusted answers I could measure it against.
Key takeaways
- Keep the questions and answers you already trust. They become your evaluation set, and every change after that is measurable.
- Check the evaluator, not just the model. Our "best" model returned empty answers and the LLM judge still marked them correct.
- Check retrieval separately before you fix anything. Our biggest gain came from the prompt, not from search or a bigger model.
- On Databricks Free Edition you can ship a mobile-accessible agent with nothing running all the time - for workspace admins. Test as your real users: ours failed silently for everyone else.
Three questions from my notebook
I'll follow three real questions through this post. They're from my log, and each one breaks in a different way.
- The tag-up. "Runner on 1st runs on the hit, the ball is caught. Is the runner out?" Answer: not automatically. Leaving on the hit is legal. The runner is out only if they or 1st base are tagged before they get back (Rule 17.10).
- Time. "Does the ball need to be inside the diamond before the umpire can call Time?" Answer: no. Rule 11 says the ball must be held by a player in an infield position, and most infield positions are outside the diamond.
- Rotation. "Can the same kid play the same position two innings in a row?" Answer: we'll get to that one. Nobody got it right the first time, including Claude.
Why not just keep using Claude?
Honestly, for a few rulebooks you could.
All three documents together are about 65,000 tokens. That fits easily in a modern model's context window, and Claude reading the whole lot is what produced the answers I trusted in the first place.
So why bother?
The phone wasn't the reason. My Claude Code session lives on my laptop, but the Claude mobile app with a Project holding the PDFs would answer the same questions from my pocket. For one umpire, that's the simplest option. Genie One has a mobile app too, so it's a draw.
I wanted to try Databricks on something real. Genie One, Genie Agents and the new bundle resource types are easier to judge on a small real problem than on a demo.
I wanted the option to share it. If the local association or other umpires ever wanted it, Unity Catalog permissions would let me give a group access, with audit and usage tracking. That was the plan, anyway - it turned out harder than it looks (more below). Claude Team or Enterprise projects can be shared too, but everyone needs a seat in your organisation. Not a great fit for volunteers.
I wanted to build it as if the rules were much longer. A few rulebooks fit in a prompt. A company's policies or product manuals won't. Retrieval also means each question sends 5-10k tokens to a cheap model instead of the whole corpus to an expensive one.
What Claude still does better
- Model quality. Free Edition has no Claude models. I ended up on GPT-OSS-120B, and it shows on edge cases.
- Memory. My local session kept a log of past rulings and built on them. Genie remembers your conversations, but the agent doesn't learn from them.
- Zero infrastructure. The Claude setup took minutes. The Databricks version took a pipeline, a SQL function, an agent, permissions and an evaluation framework.
What did I actually build?

It's RAG - retrieval-augmented generation. Instead of giving the model every document every time, you first retrieve the few sections that match the question, then the model generates an answer from just those. It answers from the rulebook in front of it rather than from what it half-remembers about baseball, and it can cite the rule it used.
There are two flows: one runs when a rulebook changes, the other every time someone asks a question.
- Rulebooks - the PDFs sit in the repo, and a job copies them into a Unity Catalog volume.
- Parse & chunk -
ai_parse_documentturns each PDF into headings, text and page numbers. I split that into one chunk per rule (17.10 Leaving Base Early), each prefixed with the document, rule number and pages so it makes sense on its own. - Knowledge base - chunks go into a Delta table with an embedding each (
gte-large-en), plus a small table of keyword weights. - Phone - I ask a question in the Databricks mobile app. Genie One routes it to the "Teeball Umpire" Genie Agent.
- Genie agent - its only job is to call a SQL function,
ask_rulebook(question). - Find rules + answer - the function embeds the question, ranks chunks by similarity plus keyword overlap, takes the top 5 from each document and sends them to GPT-OSS-120B with an answering prompt. The answer comes back with citations: "Fair ball (Rule 14c, p12)".
Everything is deployed with Declarative Automation Bundles (DABs) - schema, volume, jobs, permissions and the Genie Agent itself, via the genie_spaces resource type in newer CLI versions. Nothing runs all the time: serverless jobs, pay-per-token models, and a SQL warehouse that auto-stops.
The code is on GitHub: databricks-teeball-agent - the bundle, ingest and evaluation jobs, prompts and evaluation sets.
The Genie Agent definition caught me out. I told it in plain text to "always call ask_rulebook", and it ignored me - it kept trying to answer from the table and then said it couldn't. What worked was an example query with a parameter:
example_question_sqls:
- question:
- "Runner on 1st runs on the hit and the ball is caught. Is the runner out?"
sql:
# Genie maps any similar question onto this pattern and fills :question
- "SELECT ${var.catalog}.${var.schema}.ask_rulebook(:question) AS answer"
parameters:
- name: question
type_hint: STRING
Genie answers by writing SQL, so give it SQL to copy. With one example it sent my questions to the function every time. (Mine, at least. More on that later.)
What didn't work along the way?
My Genie One post covered the business-user side. This time I was building on it, and Free Edition pushed back.
| Attempt | What happened | Lesson |
|---|---|---|
| Genie Agent with the PDFs attached (file search) | Blocked on Free: REQUIRED_MODEL_NOT_AVAILABLE | Check Free Edition limits before designing around a preview feature |
Vector Search index + vector_search() in the function | Worked on its own; failed from Genie with PERMISSION_DENIED, even after granting access | Genie couldn't reach Vector Search, but ai_query worked fine |
| Embeddings in Delta, similarity in plain SQL | Works from Genie and mobile | Pay-per-use, and brute force is fine for thousands of chunks |
| Genie One routing on mobile | First answer: "I don't have any knowledge about teeball" | A keyword-heavy agent description plus table and column comments fixed it |
Losing Vector Search was a blessing. A Vector Search endpoint is billed every hour it exists, whether anyone asks a question or not. Embeddings in a Delta column got rid of the permission problem and the always-on cost.
The one that stung was an orphan agent. Early on, before we'd committed to doing everything with DABs, Claude Code poked at the Genie API to see how agents were created. One call returned an error, so we both assumed nothing had been created. Days later, after tearing down my dev environment, the workspace still had two "Teeball Umpire" agents.
Genie One had been sending some of my real phone questions to the orphan, which didn't use the rulebook pipeline at all. Lesson: an error response doesn't mean nothing was created, and the bundle can't clean up what it didn't create.
Deleting it caused a second problem. My test business user could open the real agent directly, but Genie One's chat couldn't find it: "I'm not finding a Genie space called 'teeball umpire'... a Genie space that hasn't been indexed yet". We'd recreated the agent twice that day to move it between folders, and each time it got a new ID. Genie One learns about agents in the background, and that takes a while.
A few hours later chat found it on the web. On mobile it still needed the agent's name before it went looking. Chat routing is best-effort, the direct agent link always works, and don't recreate an agent the day before you need it.
How do you know it's any good?
I already had 12 questions from real games, each with an answer I'd checked against the rulebooks. That turned out to be the most useful thing in the repo. Instead of asking the agent questions one at a time and judging each answer by eye, I could check every change against all of them at once.
The evaluation is just another bundle job. It runs every question through the agent, has a second LLM grade each answer against my ruling (CORRECT, PARTIAL or WRONG, plus "did it cite the right rule?"), and writes the results to a table. Comparing three models was one parameter:
# '|' separates the models because --params splits on commas
databricks bundle run -t prod eval_rulings \
--params "label=iter1-models,models=databricks-gpt-oss-120b|databricks-qwen35-122b-a10b|databricks-meta-llama-3-3-70b-instruct"
Each model gets a temporary copy of the SQL function, built from the same template as the live one, so experiments never touch the agent people are using.
First result: 5 correct, 3 partial, 4 wrong. Not great, but now I had a number to beat.
And the notebook questions? The tag-up came back as a bold "Out", with the right condition in the bullets underneath. Right rule, wrong headline. An umpire glancing at a phone reads the headline. The judge marked it PARTIAL, and it has stayed PARTIAL in almost every run since.
Can you trust the judge?
Not blindly. In the model comparison, Qwen 3.5 came out on top with 8 out of 12 correct. Then I read its answers.
They were all empty.
Qwen is a reasoning model. With a 2,000-token limit it spent the whole budget thinking and returned nothing. The judge still marked 8 of those blank answers correct.
The fix was a higher token limit, plus a plain code check that marks empty answers WRONG before the judge sees them. Which brings me back to the main point: the evaluation set is the product, but only if you check the evaluator too.
Same story, smaller: when GPT-OSS judged its own answers it marked 4 WRONG. An independent judge (Llama 4 Maverick) marked the same answers 0 WRONG. Use a judge that isn't the model being judged, and read anything that looks odd.
Is 12 questions enough?
No. With 12 questions, one answer changing moves the score by 8 points, and the margin of error is around ±25 points. Fine for catching blank answers, useless for comparing two decent options.
So I went back to the model that wrote my trusted answers. Four Claude Opus 5.5 sub-agents, each reading both full TBAWA documents (the by-laws came later), wrote 301 questions with answers across all the rule areas in about six minutes. I checked a random 26 as the umpire. All 26 were right.
This is a "teacher and student" set-up: the expensive model with the whole document writes the test, and the cheap agent sits it.
Bonus: writing the test exposed the rulebooks. The sub-agents skipped questions the documents can't settle. Batting out of the box: the Rule Book says the ball is dead at contact, the Manual says wait and see if it's caught. A fair ball rolling over the dead-ball line untouched isn't covered at all. The Rule Book even refers to a rule (9.1d) that doesn't exist.
With 301 questions the margin dropped to about ±5 points, and some of my earlier conclusions fell apart.
Where was it actually failing?
The bigger set was less flattering: 69% correct, 24% partial, 7% wrong. The breakdown by rule area was more useful than the total.
| Area | Correct |
|---|---|
| Rule 17 (base running) | 82% |
| Rules 1-9 | 78% |
| Rules 10-16 | 71% |
| Rules 18-22 + Manual umpiring (signals, positioning, procedures) | 48% |
Two things I'd believed from the small set didn't hold up. Hybrid search (keywords plus vectors) didn't beat plain vector search overall - running the same setup twice differed by 4 points, more than the gap between them. And it helped the numbered rules but hurt the Manual's umpiring sections.
My instinct was to fix search. First I added a retrieval-only check: for each question, did the right rule even make it into what the model saw? No answers, no judge, so it was quick and nearly free.
Search found the right section 95% of the time, even in the weak area. The problem was what the model did with it.
The Time question is the clearest case. Search finds Rule 11 every time, and the agent even quotes the right definition of "infield position" - then concludes "inside the diamond" anyway. It flips between right and wrong across runs, and it's wrong in the latest ones. That one needs a better model, not a better pipeline.
The rest of the failures had a pattern. My prompt said the Rule Book wins over the Manual, and the model took that too far: it ignored the Manual's interpretations and procedures, which is exactly what an umpire needs for "what do I do and say?". The prompt also asked for "the ruling in one line", which suits "out or safe?" but not "how do I handle a tee foul?".
Here's the rewritten prompt:
You are a TBAWA teeball rules assistant. The user is an umpire asking a situational or
procedural question, often during or right after a game, reading on a phone.
Answer ONLY from the excerpts below. Each excerpt starts with a header: document title |
rule number and heading (or section name) | pages.
The documents work together:
- The Rule Book (Official Rules, Edition 8) states the rules.
- The Manual (Annotated Rule Book & Umpire Manual 7A) explains how to apply them:
interpretations, worked scenarios, umpire procedures, exact calls and signals,
positioning, and how to deal with coaches and spectators.
- The By-Laws (Wembley Tee-Ball Association, WTBA) are local rules for games in the
Wembley competition. They add to the TBAWA rules (e.g. fielding position rotation,
weather and heat, finals, fines) and are numbered separately: By-Law 12 is not
Rule 12.
Use them together. Apply the Manual's interpretations and procedures unless they
directly contradict the Rule Book. Only on a direct contradiction does the Rule Book
(newer edition) win; then say so briefly.
Where a By-Law adds a requirement the TBAWA rules don't have, include it and label it as
a WTBA local rule (it applies to Wembley competition games). Never present a By-Law as a
TBAWA rule.
How to answer:
- Situation/ruling questions: start with the ruling in one line (e.g. "Out", "Safe",
"Foul ball", "Dead ball, runners return", "Obstruction - award 3rd"), then the key
conditions that decide it (including exceptions the Manual adds).
- Procedure questions ("what should the umpire do/say/signal"): give the steps in order,
with the exact calls in quotes (e.g. "Time!", "Batter Up", "Play Ball") and signals,
as the Manual describes them.
- Keep to what decides the case. Max ~6 short bullets.
- Cite every point as (Document Rule X.Y, p N), e.g. (Rule Book 17.10, p15), (Manual
17.11, p41) or (WTBA By-Law 12.3, p6). For Manual sections without a rule number, cite
the section name and page, e.g. (Manual "Signals", p62). Take rule numbers ONLY from
excerpt headers or text; never invent them.
- Teeball is NOT baseball. Never apply baseball/MLB rules that aren't in the excerpts
(e.g. fair/foul is decided by where the ball FIRST lands).
- If the excerpts don't cover the situation, say "Not covered by the rules provided" and
flag it as umpire judgement, citing the closest rules.
- Be concise. No preamble. Refer to players as "the runner", "the fielder" (no he/she).
The important line is the one about precedence: the Rule Book only wins on a direct contradiction, not by default. Procedure questions also get their own answer format. (This is the live version, which also covers the Wembley by-laws - more on that below.)
That one change beat every model and search change I tried:
| Change | Correct (301 questions) |
|---|---|
| Starting point (hybrid search, original prompt) | 66.9% |
| New prompt | 73.8% |
| New prompt + cleaner chunking of the Manual (two runs) | 75.6% (75.1% and 76.1%) |
| Weakest area (Manual umpiring) | 48% → 67% |
I also tidied how the Manual's practical section was chunked, so sub-headings like "SAFE" and "OUT" keep their parent "Signals". Search got slightly better, but the answers moved within the noise. I kept it because the data is cleaner, not because it helped.
Ask it now "the batter hit more tee than ball, what do I do and say?" and you get the Manual's answer: pick up the tee, wait for the ball to land, both arms up, "Time, Foul Ball!", reset, announce the strike, "Play Ball!". That's what I want in my ear at the plate.
What happens when a document is missing?
Then came the rotation question: can a kid play first base two innings running?
I asked Claude. Claude searched both rulebooks and said no, there's no rotation rule - only Rule 19.2, which stops a player sitting out two fielding innings in a row. Confident, cited, and wrong for our games.
Wembley, my association, has its own by-laws. By-Law 12.3: "A player cannot play in the same position for two consecutive fielding innings." Neither Claude nor the agent could know that. It wasn't in anything they'd been given.
This is the case the whole design was built for. Adding the by-laws was one PDF in a folder, one line in a metadata file, and one run of the ingest job. One ingest run later the agent answered with the by-law and labelled it a local rule, not a TBAWA one.
It had one catch. The by-laws number from 1 to 43, so "By-Law 17" (safety bases) and "Rule 17" (base running) would have looked like the same rule to my search. They're now labelled differently, and the rule-number boost only applies to TBAWA rules.
Three new questions went into the evaluation set. The original 15 scored exactly the same as before. And the rotation answer? Right ruling, right citation, plus a penalty that doesn't exist - borrowed from the next by-law down. PARTIAL.
Who can actually use it?
Here's what it looks like from the dugout, with the question from the diagram: the ball first lands fair between home and 3rd, then rolls foul before reaching 3rd. A coach once told me that's foul, which is the baseball rule. In teeball only the first landing counts, so it's fair.
I named the agent in the question, and Genie One handed it straight to the Teeball Umpire agent. After a wait (sped up below), the answer is right: fair, because it first landed in fair territory, citing Rule 14(c) in both the Rule Book and the Manual. Under it is the query the agent ran - one call to ask_rulebook - with the function's own answer in the result row.
One thing worth knowing: Genie One rewrites that answer in its own words for the chat. The text you read isn't exactly what the evaluation set measured.

I recorded that as an admin. My first attempt was as my test business user, and there the generated code showed something else: no ask_rulebook, just Genie's own keyword search on the chunks table. That was the clue. Genie hadn't skipped ask_rulebook by choice. The query history showed that every call that user had ever made to it had failed:
[AI_FUNCTION_REGISTRY_LOOKUP_FAILURE] Failed to dynamically resolve function "ai_query" from AI Function Registry. INTERNAL: An unknown error occurred.
Genie quietly fell back to its own keyword search and answered from that. Plausible answers, no error on screen, and none of the search or prompt work behind them. I'm an admin, so it always worked for me, and every check I ran passed.
Peeling it back took an afternoon, with Claude Code reading the query history and Genie Code suggesting fixes from inside the workspace. Each fix uncovered the next problem:
| Problem (non-admin user) | Fix | Then |
|---|---|---|
Consumer access can't run ai_query at all | Give the group SQL access | Direct calls work, ask_rulebook still fails |
ai_query fails inside a function someone else owns | Split the function: ranking and prompt in SQL, both model calls in Genie's query | Fails on modelParameters |
ai_query with any modelParameters fails, even just max_tokens | Drop them | GPT-OSS spends its default output budget reasoning and returns nothing about 1 time in 4 |
A fourth problem made it all confusing: permission changes don't reach sessions that are already open, even after logging out and back in. The same query would fail in one SQL editor tab and work in a new one.
To be sure it was about being an admin and not about who owned the function, I made the same test user an admin, with fewer grants than before. Everything worked, on the web and on the phone.
So it's admin-only for now. I undid the workarounds, and the agent still makes one call to ask_rulebook.
Opening it up properly means taking the model calls out of the user's hands, for example with a Databricks App that runs as a service principal and calls the models itself. The catch: an app runs, and costs, while it's started, which undoes "nothing always-on". I couldn't tell whether these are Free Edition limits or platform bugs. On a paid workspace I'd check before designing around them.
The lesson I'd take to any project: test as the user you're building for, not as yourself. My evaluation set measured the pipeline well. It never checked whether my users could reach it.
What are the honest caveats?
- 75% correct is not 100%. About 1 in 20 answers is wrong. Fine as a second opinion at a teeball game, not for anything that matters more.
- Answers are only as complete as the documents. Claude and the agent both missed the rotation rule until the by-laws went in. Neither knew what it didn't have.
- The test agrees with Opus, not with the truth. My check of 26 answers is what makes the teacher trustworthy, and 26 is a sample, not proof.
- Free Edition shapes the design. No Claude models and no Genie file search, plus a daily usage cap. On a paid account I'd make different choices.
- No memory. The agent doesn't learn from conversations yet.
- Admins only. Non-admin users hit
ai_queryerrors on this workspace, and Genie hid them behind its own fallback answers. - Chat routing isn't guaranteed. Genie One's chat finds agents through a background index, which took a few hours to pick up a new agent (this workspace is also on the older Genie API version). On mobile, naming the agent in the question helps. Opening the agent directly always works.
How do you start something like this?
- Write down the questions you already have, with answers you trust. Quick win: an hour. Ten to twenty real ones beat a hundred made-up ones.
- Put the evaluation in a job before you build the clever bit. A day. Question in, answer out, judge, table. Add a code check for empty or uncited answers, and run it as a real user, not just as yourself.
- Build the simplest pipeline that answers with citations. A few days. Parse, chunk by the document's own structure, embed, one function. Deploy it with DABs from day one, agent included.
- Grow the evaluation set with a stronger "teacher" model, and spot-check it. Half a day. Aim for a few hundred questions, tagged by area.
- Diagnose before you fix. Ongoing. Break scores down by area, check retrieval on its own, and run the same setup twice so you know your noise.
What would I plan for before scaling it?
Opening it up to every umpire. An app in front that calls the models as a service principal, or whatever removes the non-admin ai_query limits. Decide whether an always-on app is worth it, or check whether a paid workspace behaves differently.
Testing as real users, end to end. My evaluation calls the SQL function directly, so it never saw what users saw. I've since added a job that asks the deployed agent through the Genie API and records which query it ran. Next step is to run it as a non-admin test account, so a permissions problem shows up as a failed test, not a week of quiet fallback answers.
Watching for silent failures. Genie hid every error behind a plausible answer. A small scheduled check on the query history - failed ask_rulebook calls, or agent questions answered without it - would have caught this on day one.
Grading the answer people read. Genie One rewrites the function's answer for the chat, and its shorter version drops conditions. When I graded what Genie actually showed, fewer answers were fully correct than when I graded the function on its own. If the chat is the product, that's the version to test.
A bigger corpus. Brute-force similarity in SQL is fine for a few thousand chunks. Beyond that you'd want a Vector Search index - but that costs money around the clock, and from Genie you'd need a different front end or a fix for the permission issue.
Shared memory. Not built yet: a scheduled job pulls Genie conversations through the API, an LLM drafts candidate rulings, a human approves them, and approved rulings go into the knowledge base. Every umpire benefits from every good answer.
More real questions in the evaluation set. My 12 notebook questions, three I asked from my phone and three about the by-laws are all in there now. They're the best material there is, because that's how the agent actually gets used.
A long-context comparison. On a paid account I'd add a "whole rulebook to Claude" mode to the same evaluation and let the numbers decide between accuracy and cost per question.
So, can it replace my Claude session?
Sort of.
It's on my phone, adding a document means dropping in a PDF, it gets three answers in four fully right, and it cites the rule every time. Sharing it with every umpire in the association will take an app in front of it.
But look at the notebook. The tag-up: right rule, misleading headline. Time: still wrong. Rotation: right after the by-laws went in, with a made-up penalty attached. Claude would have done better on the first two. It also missed the third.
Start with the test, not the agent
Building the pipeline and wiring it to Genie was the easy part. Getting it onto other people's phones wasn't, as it turned out. And making it good only became possible once I could measure it, and that came from the questions I'd been scribbling down at games all along.
Before you build your next agent, write down the questions you already know the answers to. The evaluation set is the real product - the agent is just the current best attempt at passing it.
Are you getting started with Databricks?
Here at Mechanical Rock, we build AI and data solutions on Databricks, and we care about whether they actually work. If you're putting an agent in front of your users and want to measure it properly, let's have a chat.