Skip to main content
Delivery

Building an automated regression harness for retrieval-grounded agents

A change to a prompt, a retriever or a base model can quietly break an answer that used to be correct. We stopped checking that by hand.

Delivery
Internal capability build, operated by Humint Labs, not a client deliverable.
System proof points

Measured system behaviour

VersionedEvaluation suite

Reference design target: cases remain comparable across releases.

AutomatedRelease check

Reference design target: retrieval and prompt changes are checked on change.

ClassifiedFailure review

Reference design target: grounding, context and policy failures stay distinct.

ReplayableEvidence trail

Reference design target: a result carries its configuration and retrieved context.

The Challenge

The operating challenge

Every retrieval-grounded agent we shipped needed the same check before every release: does a change to the prompt, the retriever or the base model quietly break an answer that used to be correct. We were doing this by hand, on a spreadsheet, for every build. A single manual regression pass across a hundred-question suite took a senior engineer the better part of a day, which meant it happened before a release, not on every commit.

The harder problem was not generating another score. It was making a release conversation possible when a result changed. A product owner needed to know whether the failure affected a real journey, an engineer needed the exact inputs to reproduce it, and a risk owner needed to know whether the behaviour was unsafe or simply outside the test boundary. The harness had to make those questions answerable without turning the review into a meeting of people comparing screenshots.

The review model also had to survive ordinary delivery pressure. A team may change a prompt, swap a retrieval source or alter a tool permission without thinking of the change as a model release. Each can still change the customer-facing behaviour. The harness therefore treats the surrounding configuration as part of the evidence and makes the boundary of each run visible to reviewers.

What we found

  • The manual process wasn't slow because grading was hard. It was slow because nobody had separated 'did retrieval find the right passage' from 'did the model answer correctly given that passage', so every failure required re-diagnosing both at once.
  • Once the two were split apart, most regressions traced back to retrieval, not generation.

Where the bottleneck sat

The bottleneck was a missing separation between retrieval quality and generation quality in how we measured failures, not a lack of compute or tooling.

Design rationale

The honest first move wasn't a new tool. It was a taxonomy: we defined four failure classes, no-retrieve, wrong-passage, right-passage-wrong-answer, and hallucinated-citation, before writing a line of harness code. A faster wrong measurement is worse than a slow right one.

The boundary of the harness is deliberate. It measures the claims the team has chosen to make about a workload; it does not certify a model in the abstract. New journeys are added when the product changes, and high-consequence cases are reviewed with the people who own the operation rather than left to an engineering-only score.

Build

Our Solution

A CI-integrated regression harness that runs a fixed question suite against retrieval and generation independently, classifies every failure into one of four categories, and blocks a merge on any regression in the no-retrieve or hallucinated-citation classes.

The work established a small, versioned evaluation service around the application rather than a separate research notebook. Cases describe the user intent, expected evidence, prohibited behaviour and acceptable variation. Runs retain the model and prompt configuration, retrieved sources, tool calls and assertions. Reviewers can label the failure class, attach a decision and compare the result with the previous release. That makes the harness useful to delivery teams because it connects a technical regression to the behaviour it could change in production.

The operating pattern gives the team a practical release rhythm: define the claim, select the cases that exercise it, run the suite, inspect material failures and record the decision. That sequence is small enough to use during delivery and explicit enough to support a later review. It also creates a reusable foundation for new agents rather than a one-off report for one launch.

The implementation is also useful because it makes ownership visible. Product defines the journey claim, engineering owns the executable case, and risk or operations decides which failures require escalation. That division prevents evaluation from becoming either an engineering-only benchmark or a vague stakeholder review. The evidence can be carried into release notes, incident review and future change analysis, giving the team a durable record of why a behaviour was considered acceptable at a particular point in time.

The pattern also makes future change safer. When a new model, prompt or retrieval strategy is introduced, the team can compare the same behavioural claims before deciding whether the change is ready. When a case is retired, the reason is recorded rather than silently removing a difficult test. This creates a living quality model that follows the system as its users, tools and operating boundaries change.

A further benefit is that the evidence model can be reused across teams. A customer-service agent, an internal knowledge assistant and a tool-using workflow can each define different acceptance criteria while sharing the same run record, review states and escalation conventions. This avoids building a new evaluation process for every workload. It also helps an organisation compare readiness without reducing every system to one score: the important comparison is whether the right claims have been tested, whether failures have owners and whether the release decision is supported by evidence. In practice, that makes the harness a piece of delivery infrastructure rather than a demonstration asset.

This gives the team a practical way to explain quality to a buyer or operating sponsor: the system is not presented as magically reliable, but as a workload with defined claims, visible controls and a repeatable release decision. That is the useful story for enterprise delivery.

The operational value is that the team can make a decision with the evidence in front of it. A reviewer can see the user journey, the expected behaviour, the system response, the retrieved context and the disposition in one chain. That reduces ambiguity between product, engineering and risk, and it leaves a record that can be revisited when the workload changes. It also gives future delivery teams a starting point for their own cases, because the questions around ownership, severity and release readiness have already been made explicit.

Retrieval scorer

Grades retrieved passages against a labelled gold set independently of generation, using recall at k against curated relevance judgements rather than a proxy metric.

Generation scorer

An LLM-as-judge step constrained to the passages actually retrieved, so it can only fail generation, not retrieval, when a question misses.

Suite runner

Runs the full question suite on every pull request through a queued worker pool, sharded so a full evaluation run completes inside a single CI timeout window.

Making the LLM-as-judge scorer itself stable release to release. We pinned its model version and prompt separately from the system under test, and re-baseline it against a held-out human-graded sample every quarter, otherwise the judge's own drift shows up as a false regression in the system being tested.

Outcome

What changed

  • A regression that used to surface in user acceptance testing now surfaces on the pull request that caused it.
  • Retrieval and generation failures are diagnosed separately by default, rather than re-litigated together every time.
  • The eval suite is versioned alongside the code it tests, rather than living in a spreadsheet outside source control.
  • A release review can trace a failure from user intent to retrieved evidence and assertion.
  • New cases can be added without changing the application under test.
  • The team has a repeatable way to decide whether a regression is fixed, accepted or escalated.
EvaluationRetrievalCI/CDInternal tooling

Ready to shipEnterprise AI?

Get the Executive Guide