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.
| Question | The 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:
- Change the sandbox copy of the agent.
- Run the benchmarks against it and read every failure.
- Pull the definition into the repository.
- Open a merge request with the benchmark score in it.
- The production deploy publishes it.
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.