Build a Lightweight LLM Evaluation Harness in Python A tutorial demonstrates building a lightweight LLM evaluation harness in under 150 lines of Python that combines normalized exact-match scoring for deterministic tasks like ticket routing, rubric-based LLM-as-a-judge grading with structured Pydantic output for open-ended responses, and versioned regression tracking that compares runs case by case to catch prompt regressions an overall pass rate can hide. The harness runs on the Gemini API free tier using the gemini-2.5-flash model and includes a mock mode (USE_MOCK_LLM=True) so it can be tested without an API key. The approach targets teams that currently evaluate prompts by eye in a playground, where a small wording change can silently break a previously passing case. In this article, you will learn how to build a lightweight, reusable LLM evaluation harness in Python that combines exact-match scoring, an LLM-as-a-judge, and versioned regression tracking to catch prompt regressions. Topics we will cover include: - How to score deterministic tasks like ticket routing with a normalized exact-match scorer. - How to grade open-ended responses with a rubric-based LLM-as-a-judge that returns structured Pydantic output. - How to log each prompt version’s results and compare runs case by case to detect regressions that an overall pass rate can hide. Introduction When teams need to evaluate prompts passed to LLMs, they typically do so “by eye”: they run several examples in a playground environment while tweaking a system instruction, pick the one that looks better, and ship it. This might seem to work at first, but a tiny wording change can silently break a case that passed just a few days before. The good news: we don’t need a heavy MLOps stack or observability platform to make this evaluation procedure more robust. This article will guide you through constructing, in under 150 lines of Python code, a reusable evaluation harness that combines multiple metrics: - For deterministic tasks like entity extraction or classification, we use Exact-Match EM scoring . - For open-ended response generation with varying wording, we consider rubric-based LLM-as-a-judge . - To catch any PASS that flips to FAIL in successive prompt versions, we will use versioned regression tracking . Setup The code example accompanying this article, which consists of a lightweight LLM evaluation harness, is ready to copy and run in a Python notebook environment, such as Colab. It runs on the Gemini API’s free tier, and it also includes a built-in “mock mode” that lets you test the harness without creating and using your own API key. Let’s start by installing some necessary packages: Installing dependencies pip install -q google-genai pydantic 12 Installing dependencies pip install -q google-genai pydantic Next, notice that we use USE MOCK LLM=True to run this code on the fly with simulated outputs. To run live calls to Gemini LLMs at no cost, get a free API key from Google AI Studio, add it as a new secret in Google Colab the key icon in the left-hand menu named GEMINI API KEY , and set USE MOCK LLM=False . python Setup client and model wrapper import json import os import re from datetime import datetime, timezone import pandas as pd from pydantic import BaseModel, Field pd.set option "display.max colwidth", None Set to False if you later add GEMINI API KEY to Colab Secrets USE MOCK LLM = True MODEL NAME = "gemini-2.5-flash" client = None if not USE MOCK LLM: from google import genai from google.genai import types try: from google.colab import userdata api key = userdata.get "GEMINI API KEY" except Exception: api key = os.getenv "GEMINI API KEY" if not api key: raise ValueError "Add GEMINI API KEY to Colab Secrets or set USE MOCK LLM = True." client = genai.Client api key=api key 12345678910111213141516171819202122232425262728 Setup client and model wrapperimport jsonimport osimport refrom datetime import datetime, timezoneimport pandas as pdfrom pydantic import BaseModel, Field pd.set option "display.max colwidth", None Set to False if you later add GEMINI API KEY to Colab SecretsUSE MOCK LLM = TrueMODEL NAME = "gemini-2.5-flash" client = Noneif not USE MOCK LLM: from google import genai from google.genai import types try: from google.colab import userdata api key = userdata.get "GEMINI API KEY" except Exception: api key = os.getenv "GEMINI API KEY" if not api key: raise ValueError "Add GEMINI API KEY to Colab Secrets or set USE MOCK LLM = True." client = genai.Client api key=api key LLM Evaluation Harness Step-by-Step The first building block for our LLM evaluation harness is a wrapper function that decouples the overall harness from the model calls. The third argument, version tag , indicates the specific version of a prompt or use case being tested via multiple model calls. To make the code accessible and help readers understand the rationale of the evaluation framework, we will use, by default, a set of mock LLM outputs — for real, generated LLM outputs, you will need to use your own Gemini API key and perform model calls for inference, as stated earlier. My main purpose is to have you learn the key steps and elements to consider throughout the process of building the framework: php def call llm system prompt: str, user input: str, version tag: str = "v1" - str: """Calls the target LLM or returns deterministic mock outputs for free offline testing .""" if USE MOCK LLM: mock outputs = { "v1 baseline": { "My invoice 4021 charged me twice this month.": "Category: BILLING.", "The mobile app crashes every time I tap 'Export PDF'.": "BUG REPORT", "Cancel my plan immediately, I'm frustrated with the downtime.": "Sorry to hear that. You can cancel in Settings." , "Can I switch from monthly to annual billing mid-cycle?": "Yes Go to Billing Plan to switch. We prorate your remaining days automatically." , }, "v2 strict": { "My invoice 4021 charged me twice this month.": "BILLING", "The mobile app crashes every time I tap 'Export PDF'.": "BUG REPORT", "Cancel my plan immediately, I'm frustrated with the downtime.": "I'm really sorry about the downtime. I can help you cancel right away—please " "confirm your account email, or go to Settings Subscription Cancel Plan." , "Can I switch from monthly to annual billing mid-cycle?": "BILLING" Simulated regression: strict label instruction bled into an open-ended reply , }, } return mock outputs.get version tag, {} .get user input, "UNKNOWN" response = client.models.generate content model=MODEL NAME, contents=user input, config=types.GenerateContentConfig system instruction=system prompt, temperature=0.0, , return response.text.strip 12345678910111213141516171819202122232425262728293031323334353637 def call llm system prompt: str, user input: str, version tag: str = "v1" - str: """Calls the target LLM or returns deterministic mock outputs for free offline testing .""" if USE MOCK LLM: mock outputs = { "v1 baseline": { "My invoice 4021 charged me twice this month.": "Category: BILLING.", "The mobile app crashes every time I tap 'Export PDF'.": "BUG REPORT", "Cancel my plan immediately, I'm frustrated with the downtime.": "Sorry to hear that. You can cancel in Settings." , "Can I switch from monthly to annual billing mid-cycle?": "Yes Go to Billing Plan to switch. We prorate your remaining days automatically." , }, "v2 strict": { "My invoice 4021 charged me twice this month.": "BILLING", "The mobile app crashes every time I tap 'Export PDF'.": "BUG REPORT", "Cancel my plan immediately, I'm frustrated with the downtime.": "I'm really sorry about the downtime. I can help you cancel right away—please " "confirm your account email, or go to Settings Subscription Cancel Plan." , "Can I switch from monthly to annual billing mid-cycle?": "BILLING" Simulated regression: strict label instruction bled into an open-ended reply , }, } return mock outputs.get version tag, {} .get user input, "UNKNOWN" response = client.models.generate content model=MODEL NAME, contents=user input, config=types.GenerateContentConfig system instruction=system prompt, temperature=0.0, , return response.text.strip Importantly, setting temperature=0.0 helps keep the evaluation runs as deterministic as possible, avoiding noise between runs so that score changes reflect prompt edits instead of random sampling. Next, to build a golden test dataset, we don’t really need hundreds or thousands of examples, as long as we have a few high-signal ones. Our set of examples mixes two types of tasks for a support assistant: ticket routing that requires an exact label exact match and replies where facts and tone matter the most rubric . Defining the golden test dataset TEST CASES = { "id": "tc 01 billing route", "task type": "exact match", "input": "My invoice 4021 charged me twice this month.", "expected": "BILLING", }, { "id": "tc 02 bug route", "task type": "exact match", "input": "The mobile app crashes every time I tap 'Export PDF'.", "expected": "BUG REPORT", }, { "id": "tc 03 angry cancel", "task type": "rubric", "input": "Cancel my plan immediately, I'm frustrated with the downtime.", "expected": "1. Empathetically acknowledges the user's frustration about downtime. " "2. Gives clear next steps to cancel without being pushy or defensive." , }, { "id": "tc 04 plan switch", "task type": "rubric", "input": "Can I switch from monthly to annual billing mid-cycle?", "expected": "1. Answers the question directly in full sentences. " "2. Mentions where to change the plan or how billing adjustment/proration works." , }, 123456789101112131415161718192021222324252627282930313233 Defining the golden test datasetTEST CASES = { "id": "tc 01 billing route", "task type": "exact match", "input": "My invoice 4021 charged me twice this month.", "expected": "BILLING", }, { "id": "tc 02 bug route", "task type": "exact match", "input": "The mobile app crashes every time I tap 'Export PDF'.", "expected": "BUG REPORT", }, { "id": "tc 03 angry cancel", "task type": "rubric", "input": "Cancel my plan immediately, I'm frustrated with the downtime.", "expected": "1. Empathetically acknowledges the user's frustration about downtime. " "2. Gives clear next steps to cancel without being pushy or defensive." , }, { "id": "tc 04 plan switch", "task type": "rubric", "input": "Can I switch from monthly to annual billing mid-cycle?", "expected": "1. Answers the question directly in full sentences. " "2. Mentions where to change the plan or how billing adjustment/proration works." , }, Time to implement the first main pillar of the evaluation harness: a deterministic exact-match scorer. This is a cheap and fast approach aimed at catching outputs such as Category: BILLING . php Exact-match scorer def normalize text text: str - str: text = text.strip .upper text = re.sub r" ^\w\s ", "", text return re.sub r"\s+", " ", text def score exact match output: str, expected: str - dict: passed = normalize text output == normalize text expected return { "score": 5 if passed else 1, "passed": passed, "reasoning": "Exact match" if passed else f"Expected '{expected}', got '{output}'", } 1234567891011121314 Exact-match scorerdef normalize text text: str - str: text = text.strip .upper text = re.sub r" ^\w\s ", "", text return re.sub r"\s+", " ", text def score exact match output: str, expected: str - dict: passed = normalize text output == normalize text expected return { "score": 5 if passed else 1, "passed": passed, "reasoning": "Exact match" if passed else f"Expected '{expected}', got '{output}'", } The exact-match scorer returns 5 or 1 to keep every scorer on the same 1-5 scale used by the rubric-based LLM judge we will add next, so no normalization logic is needed when we aggregate the scores of all metrics. Meanwhile, instead of using string matching to assess open-ended answers, we will pass the user prompt, model response, and rubric to a judge model. This forces the judge to return JSON matching a Pydantic schema that includes a 1-5 score, a boolean flag indicating whether the test is passed, and a brief reasoning string. Having structured model outputs at this point is important, as it saves us from writing brittle parsers based on complex regular expressions: Rubric-based LLM-as-a-judge scorer class JudgeVerdict BaseModel : score: int = Field ge=1, le=5, description="Quality score from 1 poor to 5 meets all rubric criteria " passed: bool = Field description="True if score is 4 or 5, False otherwise" reasoning: str = Field description="One-sentence justification grounded in the rubric" JUDGE PROMPT TEMPLATE = """You are a strict QA evaluator. Grade the assistant's response against the rubric. USER INPUT: {user input} ASSISTANT RESPONSE: {output} RUBRIC: {rubric} Scoring guide: - 5: Fully satisfies every rubric requirement. - 4: Satisfies requirements with minor wording flaws. - 3: Partially satisfies requirements; misses a key detail. - 1-2: Fails requirements, wrong format, or unhelpful. Set passed=true only if score is 4 or 5. """ def score with judge user input: str, output: str, rubric: str - dict: if USE MOCK LLM: Simple deterministic simulation of a judge for mock mode if len output.split < 3: return { "score": 1, "passed": False, "reasoning": "Output is just a bare label instead of a helpful answer.", } if "downtime" in rubric.lower and "downtime" not in output.lower : return { "score": 2, "passed": False, "reasoning": "Did not acknowledge the user's frustration about downtime.", } return { "score": 5, "passed": True, "reasoning": "Meets all rubric criteria clearly and concisely.", } prompt = JUDGE PROMPT TEMPLATE.format user input=user input, output=output, rubric=rubric, response = client.models.generate content model=MODEL NAME, contents=prompt, config=types.GenerateContentConfig temperature=0.0, response mime type="application/json", response schema=JudgeVerdict, , verdict = JudgeVerdict.model validate json response.text return verdict.model dump 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 Rubric-based LLM-as-a-judge scorerclass JudgeVerdict BaseModel : score: int = Field ge=1, le=5, description="Quality score from 1 poor to 5 meets all rubric criteria " passed: bool = Field description="True if score is 4 or 5, False otherwise" reasoning: str = Field description="One-sentence justification grounded in the rubric" JUDGE PROMPT TEMPLATE = """You are a strict QA evaluator. Grade the assistant's response against the rubric. USER INPUT:{user input} ASSISTANT RESPONSE:{output} RUBRIC:{rubric} Scoring guide:- 5: Fully satisfies every rubric requirement.- 4: Satisfies requirements with minor wording flaws.- 3: Partially satisfies requirements; misses a key detail.- 1-2: Fails requirements, wrong format, or unhelpful. Set passed=true only if score is 4 or 5.""" def score with judge user input: str, output: str, rubric: str - dict: if USE MOCK LLM: Simple deterministic simulation of a judge for mock mode if len output.split < 3: return { "score": 1, "passed": False, "reasoning": "Output is just a bare label instead of a helpful answer.", } if "downtime" in rubric.lower and "downtime" not in output.lower : return { "score": 2, "passed": False, "reasoning": "Did not acknowledge the user's frustration about downtime.", } return { "score": 5, "passed": True, "reasoning": "Meets all rubric criteria clearly and concisely.", } prompt = JUDGE PROMPT TEMPLATE.format user input=user input, output=output, rubric=rubric, response = client.models.generate content model=MODEL NAME, contents=prompt, config=types.GenerateContentConfig temperature=0.0, response mime type="application/json", response schema=JudgeVerdict, , verdict = JudgeVerdict.model validate json response.text return verdict.model dump Time to wire the scorers and the dataset into an overarching run eval function. At each run, the results are logged to a local file named eval history.json , using the prompt version as the key. This output log acts as the regression ledger, but it could be replaced by a database if you migrate this approach to a production setting: Evaluation runner with local JSON history HISTORY FILE = "eval history.json" def run eval prompt version: str, system prompt: str, test cases: list - pd.DataFrame: rows = for case in test cases: output = call llm system prompt, case "input" , version tag=prompt version if case "task type" == "exact match": result = score exact match output, case "expected" else: result = score with judge case "input" , output, case "expected" rows.append { "id": case "id" , "task type": case "task type" , "output": output, "score": result "score" , "passed": result "passed" , "reasoning": result "reasoning" , } df = pd.DataFrame rows pass rate = df "passed" .mean 100 avg score = df "score" .mean Load existing history and save this version snapshot history = {} if os.path.exists HISTORY FILE : with open HISTORY FILE, "r" as f: history = json.load f history prompt version = { "timestamp": datetime.now timezone.utc .isoformat , "system prompt": system prompt, "pass rate": round pass rate, 1 , "avg score": round avg score, 2 , "results": rows, } with open HISTORY FILE, "w" as f: json.dump history, f, indent=2 print f" {prompt version} Pass Rate: {pass rate:.1f}% | Avg Score: {avg score:.2f}/5.00" return df 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 Evaluation runner with local JSON historyHISTORY FILE = "eval history.json" def run eval prompt version: str, system prompt: str, test cases: list - pd.DataFrame: rows = for case in test cases: output = call llm system prompt, case "input" , version tag=prompt version if case "task type" == "exact match": result = score exact match output, case "expected" else: result = score with judge case "input" , output, case "expected" rows.append { "id": case "id" , "task type": case "task type" , "output": output, "score": result "score" , "passed": result "passed" , "reasoning": result "reasoning" , } df = pd.DataFrame rows pass rate = df "passed" .mean 100 avg score = df "score" .mean Load existing history and save this version snapshot history = {} if os.path.exists HISTORY FILE : with open HISTORY FILE, "r" as f: history = json.load f history prompt version = { "timestamp": datetime.now timezone.utc .isoformat , "system prompt": system prompt, "pass rate": round pass rate, 1 , "avg score": round avg score, 2 , "results": rows, } with open HISTORY FILE, "w" as f: json.dump history, f, indent=2 print f" {prompt version} Pass Rate: {pass rate:.1f}% | Avg Score: {avg score:.2f}/5.00" return df Now we start the real evaluation, using two prompt versions for the same scenario: the first, baseline version is a loose prompt, while the second version is stricter and also asks for empathy in one of its rules. Run v1 and v2 prompts through the harness PROMPT V1 = """You are a customer support assistant. If the user reports a bug or billing error, classify it as BUG REPORT or BILLING. Otherwise, answer their question briefly.""" PROMPT V2 = """You are a customer support assistant. Rule 1: For ticket routing billing errors or bug reports , output ONLY the single label BILLING or BUG REPORT with no extra words. Rule 2: For cancellations, acknowledge the user's frustration empathetically and provide clear steps. Rule 3: For general questions, answer clearly in full sentences.""" df v1 = run eval "v1 baseline", PROMPT V1, TEST CASES display df v1 "id", "task type", "score", "passed", "reasoning" print "\n" + "-" 60 + "\n" df v2 = run eval "v2 strict", PROMPT V2, TEST CASES display df v2 "id", "task type", "score", "passed", "reasoning" 1234567891011121314151617 Run v1 and v2 prompts through the harnessPROMPT V1 = """You are a customer support assistant.If the user reports a bug or billing error, classify it as BUG REPORT or BILLING.Otherwise, answer their question briefly.""" PROMPT V2 = """You are a customer support assistant.Rule 1: For ticket routing billing errors or bug reports , output ONLY the single label BILLING or BUG REPORT with no extra words.Rule 2: For cancellations, acknowledge the user's frustration empathetically and provide clear steps.Rule 3: For general questions, answer clearly in full sentences.""" df v1 = run eval "v1 baseline", PROMPT V1, TEST CASES display df v1 "id", "task type", "score", "passed", "reasoning" print "\n" + "-" 60 + "\n" df v2 = run eval "v2 strict", PROMPT V2, TEST CASES display df v2 "id", "task type", "score", "passed", "reasoning" Let’s see the evaluation results: v1 baseline Pass Rate: 50.0% | Avg Score: 3.25/5.00 id task type score passed reasoning 0 tc 01 billing route exact match 1 False Expected 'BILLING', got 'Category: BILLING.' 1 tc 02 bug route exact match 5 True Exact match 2 tc 03 angry cancel rubric 2 False Did not acknowledge the user's frustration about downtime. 3 tc 04 plan switch rubric 5 True Meets all rubric criteria clearly and concisely. ------------------------------------------------------------ v2 strict Pass Rate: 75.0% | Avg Score: 4.00/5.00 id task type score passed reasoning 0 tc 01 billing route exact match 5 True Exact match 1 tc 02 bug route exact match 5 True Exact match 2 tc 03 angry cancel rubric 5 True Meets all rubric criteria clearly and concisely. 3 tc 04 plan switch rubric 1 False Output is just a bare label instead of a helpful answer. 1234567891011121314151617 v1 baseline Pass Rate: 50.0% | Avg Score: 3.25/5.00id task type score passed reasoning0 tc 01 billing route exact match 1 False Expected 'BILLING', got 'Category: BILLING.'1 tc 02 bug route exact match 5 True Exact match2 tc 03 angry cancel rubric 2 False Did not acknowledge the user's frustration about downtime.3 tc 04 plan switch rubric 5 True Meets all rubric criteria clearly and concisely. ------------------------------------------------------------ v2 strict Pass Rate: 75.0% | Avg Score: 4.00/5.00id task type score passed reasoning0 tc 01 billing route exact match 5 True Exact match1 tc 02 bug route exact match 5 True Exact match2 tc 03 angry cancel rubric 5 True Meets all rubric criteria clearly and concisely.3 tc 04 plan switch rubric 1 False Output is just a bare label instead of a helpful answer. Although the code uses mocked examples to avoid API costs, the failure mode is a realistic one: tc 04 plan switch returns a bare label in response to an open-ended billing question. This is a classic, easily identifiable bug in prompt engineering. Overall, a pass rate that increases from 50% to 75% might look like a good reason to celebrate. Finally, we add the regression tracker: a function that compares two saved runs from the evaluation history log and explicitly flags status changes: python Per-case regression tracker def compare versions base version: str, new version: str, history file: str = HISTORY FILE - pd.DataFrame: with open history file, "r" as f: history = json.load f base run = history base version new run = history new version base df = pd.DataFrame base run "results" .set index "id" new df = pd.DataFrame new run "results" .set index "id" comparison = for tc id in base df.index: b pass = bool base df.loc tc id, "passed" n pass = bool new df.loc tc id, "passed" b score = int base df.loc tc id, "score" n score = int new df.loc tc id, "score" if b pass and not n pass: status = "REGRESSION PASS - FAIL " elif not b pass and n pass: status = "FIXED FAIL - PASS " elif b pass and n pass: status = "STILL PASSING" else: status = "STILL FAILING" comparison.append { "id": tc id, "status": status, f"{base version} score": b score, f"{new version} score": n score, "score delta": n score - b score, "new reasoning": new df.loc tc id, "reasoning" , } diff df = pd.DataFrame comparison pass delta = new run "pass rate" - base run "pass rate" regressions = diff df "status" == "REGRESSION PASS - FAIL " .sum print f"Comparison: {base version} - {new version}" print f"Pass Rate Delta: {pass delta:+.1f}% {base run 'pass rate' }% - {new run 'pass rate' }% " print f"Regressions Detected: {regressions}\n" return diff df diff df = compare versions "v1 baseline", "v2 strict" display diff df 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 Per-case regression trackerdef compare versions base version: str, new version: str, history file: str = HISTORY FILE - pd.DataFrame: with open history file, "r" as f: history = json.load f base run = history base version new run = history new version base df = pd.DataFrame base run "results" .set index "id" new df = pd.DataFrame new run "results" .set index "id" comparison = for tc id in base df.index: b pass = bool base df.loc tc id, "passed" n pass = bool new df.loc tc id, "passed" b score = int base df.loc tc id, "score" n score = int new df.loc tc id, "score" if b pass and not n pass: status = "REGRESSION PASS - FAIL " elif not b pass and n pass: status = "FIXED FAIL - PASS " elif b pass and n pass: status = "STILL PASSING" else: status = "STILL FAILING" comparison.append { "id": tc id, "status": status, f"{base version} score": b score, f"{new version} score": n score, "score delta": n score - b score, "new reasoning": new df.loc tc id, "reasoning" , } diff df = pd.DataFrame comparison pass delta = new run "pass rate" - base run "pass rate" regressions = diff df "status" == "REGRESSION PASS - FAIL " .sum print f"Comparison: {base version} - {new version}" print f"Pass Rate Delta: {pass delta:+.1f}% {base run 'pass rate' }% - {new run 'pass rate' }% " print f"Regressions Detected: {regressions}\n" return diff df diff df = compare versions "v1 baseline", "v2 strict" display diff df Output: php Comparison: v1 baseline - v2 strict Pass Rate Delta: +25.0% 50.0% - 75.0% Regressions Detected: 1 id status v1 baseline score v2 strict score score delta new reasoning 0 tc 01 billing route FIXED FAIL - PASS 1 5 4 Exact match 1 tc 02 bug route STILL PASSING 5 5 0 Exact match 2 tc 03 angry cancel FIXED FAIL - PASS 2 5 3 Meets all rubric criteria clearly and concisely. 3 tc 04 plan switch REGRESSION PASS - FAIL 5 1 -4 Output is just a bare label instead of a helpful answer. 12345678910 Comparison: v1 baseline - v2 strictPass Rate Delta: +25.0% 50.0% - 75.0% Regressions Detected: 1 id status v1 baseline score v2 strict score score delta new reasoning0 tc 01 billing route FIXED FAIL - PASS 1 5 4 Exact match1 tc 02 bug route STILL PASSING 5 5 0 Exact match2 tc 03 angry cancel FIXED FAIL - PASS 2 5 3 Meets all rubric criteria clearly and concisely.3 tc 04 plan switch REGRESSION PASS - FAIL 5 1 -4 Output is just a bare label instead of a helpful answer. At first glance, the second, stricter version looks like the winner, but the per-case analysis shows that this conclusion might be a mistake. Two examples flipped from failure to pass, and these are real wins. However, one case shows a score drop from 5 to 1, i.e. the stricter rule bled into an open-ended question about billing, causing the model to reply with a bare label where an actual answer was expected. Next Steps The lightweight LLM evaluation harness shown throughout this article is designed to be incrementally expanded into a production-ready workflow. Ways to do this include adding an automated CI gate — a checkpoint that runs the tests before updated prompt or model versions go live — turning real bugs into new test cases to ensure the same errors don’t quietly return, and tracking cost and speed to avoid paying twice as much for a marginal improvement.