How I fix it · Step 02 of 4

Build one agent that works

An agent is a set of instructions, example queries and tables. Built carelessly, it answers confidently and wrongly. I build one agent for one team’s real questions, test it before anyone relies on it, and keep it in code.

What I do

  • Start from the team. A short session with the team lead and two or three users to collect the questions they actually ask, not a guess at what they might.
  • Instructions in a fixed shape. Purpose, which table for which question, the defaults (“last month” means the previous calendar month), and what is out of scope, with the agent to use instead.
  • Example queries with guidance. The questions people ask most, each with the correct SQL and a note on when to use it.
  • Benchmarks, including traps. Every agent ships with questions and the expected SQL, and a runner that asks each one and compares the results.
  • The agent as code. The definition lives in version control and is deployed like any other code. Changes go to a sandbox copy first, never to the production agent by hand.

Trap questions

A trap question is one where the obvious query gives the wrong answer. It only passes if the agent applies the rule.

QuestionThe trap
How many active customers do we have?Leave out internal and test accounts
What was revenue last quarter?Fiscal quarter, not calendar quarter, if that is the agreed definition
How many prospects did we reach by phone?Logged calls include unanswered dials
How many new customers did we win this year?First signed contract, not the date the account was created

How a change ships

Every change follows the same loop, so nothing reaches users untested:

  1. Change the sandbox copy of the agent.
  2. Run the benchmarks against it and read every failure.
  3. Pull the definition into the repository.
  4. Open a merge request with the benchmark score in it.
  5. The production deploy publishes it.
$ run_benchmarks agent.json --space sandbox # illustrative output PASS How many active customers per region? PASS Revenue last quarter by product line FAIL How many new customers did we win this year? expected 412 got 437 ... 18/20 benchmarks passed

Lesson learned

A failing benchmark is not always the agent’s fault

When a benchmark fails, the agent is often not the problem. Sometimes the expected answer is stricter or looser than the question; sometimes a rule is missing from the instructions; sometimes the question is ambiguous and the result flips between runs. Each needs a different fix, and reading failures carefully is half the value of benchmarks.

You get: one production agent for one team, in version control, with its instructions, example queries and a benchmark score you can re-run after every change.

Want this for your team?

It starts with a two-week readiness review.

Book a 30-minute call