Skip to content

Building an eval framework that catches regressions before customers do

Two-pass scoring, version-aware quality tracking, automatic regression detection — what we built so agent updates stop being a coin flip.

EngineeringApril 17, 20265 min read

Anyone who's shipped AI products has had this conversation: "the agent worked great yesterday, what changed?" Usually nothing — except instructions were tweaked, the underlying AI rolled to a new revision, or a new knowledge base entry contradicted an old one.

Without an eval framework, you find out about regressions when customers complain. With one, you find out before you hit the deploy button.

The structure

SAQR's eval framework has three pieces:

1. Golden questions. A list of canonical customer questions, with expected answers. For NeoCare, this includes "بكم حشوة العصب؟" with expected answer "55 KWD". For Elite Gym, "متى تفتحون يوم الجمعة؟" with expected answer "From 5pm to 11pm". The list grows over time — every time a real customer reports a wrong answer, that becomes a new golden question.

2. The runner. Cron job that takes each golden question, sends it to the live agent (the same code path a real customer would hit), captures the response, and scores it.

3. The judge. This is where it gets interesting. We can't just keyword-match — "55 KWD" and "55 dinars" and "خمسة وخمسين دينار" are all valid answers. So we use a two-pass scoring:

  • Pass 1: literal match. Fast, free. If the expected literal string appears in the response, pass. Saves money on the easy cases.
  • Pass 2: AI judge. If literal fails, we send the question + expected + actual to a small, fast judge AI with a strict scoring rubric: "Does the actual response contain the same factual claim as the expected, ignoring wording? Yes/No + reasoning". The AI judge catches semantic equivalents and saves us from false negatives.

The combination is fast, cheap, and accurate. Across 200+ golden questions running nightly, false-positive rate is under 2%.

Wiring it to prompt versions

Every eval run is stamped with the active prompt version ID. So when you change the system prompt and pass rate drops from 94% to 81%, you know exactly which version to roll back to. The history view shows pass-rate-over-time per prompt version, with regression warnings when a new version scores lower.

This unlocks a real workflow: edit the prompt, run evals, see the diff in pass rate, decide whether to promote or rollback. No more "let's just push and hope".

What we don't try to evaluate

Tone. Personality. "Did the agent feel friendly?" — these are real concerns but they're better caught by sampling production conversations and reading them. The eval framework is for factual correctness and policy compliance, not for vibe-checking. We use it ruthlessly for the first; we use human review for the second.

How to bootstrap one

Start with 20 questions. Pick the ones your customers ask most often, with answers you know are correct. Run them daily. Watch the pass rate. Add a new question every time a real customer reports a wrong answer.

After 60 days, you have a real test suite. After 6 months, every prompt change is gated by it. After a year, you wonder how you ever shipped without it.

Was this article helpful?