Dieser Blogpost ist auch auf Deutsch verfügbar

TL;DR

  • Tested in the chat is not tested: as soon as model output influences product logic, you need reproducible evals instead of one-off happy-path prompts.
  • A usable eval consists of a dataset, a defined success criterion, at least one grader or verifier, a reproducible run, and a comparison across changes.
  • The sensible mix: deterministic code checks for what’s objectively verifiable, LLM-as-a-judge with rubrics for nuance, human review for calibration and edge cases, plus trace and workflow evals for agents.
  • Evals belong in CI as regression protection (close to a 100% pass rate), complemented by observability and feeding real production errors back into the eval set.

Tested in the chat window

… is not tested.

Building AI features often starts in the chat UI or with a few prompts in the developer playground. After a few happy-path questions, we have a prompt that looks perfect at first glance and lets us implement the feature right away. Sure, a bit of manual fine-tuning is probably part of it.

And that’s exactly perfect! For exploration, to try whether the actual idea of the feature works out, to uncover hidden assumptions and gross failures. What falls by the wayside, as in many deterministic software projects, is testing. And testing is precisely where reproducible quality assurance begins. Code in production that has only ever been tested manually always carries the risk of having missed something, especially with regressions, and exactly the same applies to prompts created during exploration.

If a vendor releases a new model in two months that we then want to integrate directly because it seems better suited, we quickly end up flying blind if we created the prompt through exploration and then simply leave it sitting in the project without testing again. But it’s not only a new model that triggers this; a (potentially invisible) change to the model vendor’s system prompt could fundamentally change the behavior of our prompts, and AI features. Without reproducible evaluation, we’re flying completely blind here.

Works in the demo and holds up under changes are two different things. And this is exactly where Continuous Evaluation (CE) comes in.

Where prompt engineering ends

As soon as model output becomes part of the product logic, good prompting is no longer enough. Then contracts, evals and observability count at least as much as the prompt itself.

If we keep iterating on a prompt, we may hit limits, the result just doesn’t get better, the evals stay red. It might be time to change the model. Because not every problem is the prompt’s fault, some other reasons for failures are model choice, architecture, tooling, data or the workflow itself.

Better prompting optimizes the model’s answers, engineering stabilizes the system around them.

Note

Let’s look at an example: an online shop orchestrates agents that handle direct user support. There are several agents the orchestrator can call, and each agent is handed tools via an MCP server to carry out support actions for the user.

A specialized refund agent handles the processing of a user’s refunds, checks against given criteria whether the product in question can be returned, and then triggers the return process in the background after the user has confirmed that a return may be processed. The agent reports back that a return was successful, that the goods don’t have to be sent back, and that the money will reach the customer next week. The money doesn’t arrive. The agent never triggered a return.

Why, in this example, was no return triggered? In the eval process the answers were always perfect, and the tool calls always worked too. Looking at the example, one thing stands out: an MCP server? It serves its tool descriptions itself, and something changed here, but the prompt no longer matches, so the logic might stop working, and a case like this can occur.

When evals become mandatory

As soon as nondeterminism enters the system, it’s a good idea to run evals. Not necessarily when we deliver the AI outputs directly to the user, but right away when model output influences the product logic.

Routing, tool calls, writing or changing data, preparing or preventing user actions, being part of a workflow chain, all of these are reasons to run evals, and they are mandatory for high-quality systems.

The more places for nondeterminism exist in the system, the greater the need for systematic evals. This ranges from single-turn (one model output controls one thing), through workflows (a chain of prompts that build on the previous one’s output), through single agents (an agent keeps calling tools or working until it “thinks” it’s done), to multi-agents that communicate with each other. By that point at the latest it’s highly relevant, and already recommended for single-turns, to run systematic evals.

As an example, a FAQ bot that fetches product knowledge for a question via, say, RAG and plays it back to the user carries rather low risk, whereas the refund agent described above with tool calls to refund tools brings significantly higher risk. If that agent then sits next to a buying agent that can make purchases for me, and is managed by an orchestrator, we have extremely high complexity, and the systematic evals become all the more important.[1]

Whoever takes model output into product logic takes on test responsibility.

What makes a usable eval

You need:

  • a concrete dataset
  • a defined success criterion
  • at least one grader or verifier
  • a reproducible run
  • a comparison across changes

It’s not only positive behavior that should be tested, but also when certain behavior should not occur. Manual verifiers in particular are expensive, so a small, real, targeted set of cases is worth more there than a perfect benchmark with an incredible number of data points.

Compared to human evals, automatically scored graders (llm-as-a-judge) are much cheaper. Another option is code-based grades, and (where possible) these should make up the bulk of the evals, but because of nondeterminism they should never be the only kind of verification.[2]

To stay with the refund agent example: a good start for evaluation is a smaller, manageable seed set consisting of:

  • 4 positive refund cases
  • 4 negative refund cases
  • 4 lookup cases
  • 4 ambiguity cases
  • 4 edge cases that should flag a potential policy case

Based on this test set, we can then check whether tool calls did [not] happen, whether the response to the user (or orchestrator) is appropriate, whether clarifying questions are requested correctly, and so on. At this point it comes down to creativity within the business rules to formulate sensible, helpful tests.

According to both major LLM providers, it’s not about rating prompts, it’s about specifying AI behavior so that it becomes testable, explainable and automatable. Prompt evals are not a side topic here but the transition from “we’re trying something out” to “we can visibly safeguard quality”.

Ideally, the success definition is formulated first, and only afterwards is a prompt worked out, similar to test-driven development. Without the defined success there’s no basis on which to evaluate.

When designing evals, several evaluation dimensions have to be considered. Anthropic names, among others, task fidelity, consistency, relevance, privacy, context usage, latency and cost; OpenAI describes comparable dimensions too. The key is to formulate the criteria so that they can be checked with suitable methods: first the most deterministic, technically measurable success criteria possible, then criteria that can be assessed with nondeterministic methods like LLMs as a judge, and finally those that require human judgment.

Since the outputs are nondeterministic, a single run can still be rated in binary terms as passed or not passed. For unstable tasks or agent loops with highly varying runs, however, a single run is often not enough to sensibly judge the system’s reliability. In such cases the same scenario should be run several times and the result aggregated over suitable metrics, for example with pass@k, when at least one successful attempt counts, or over a consistency threshold, when reliable behavior is expected. For instance, you can define that a scenario must pass in at least 9 out of 10 repetitions. For regression suites, on the other hand, the pass rate should be as close to 100% as possible.[3]

A bad eval score can be a model problem. But it can just as easily be a broken test.


Evaluation by example: a support agent with tools

Building on the examples already outlined above, we want to work with a support team. In this case a chat interface actually makes the most sense; we won’t need much UI around it, but in return the agent is connected directly to our system and can retrieve information about the user and do things on the user’s behalf, concretely for example cancel products.

The UI will mainly contain debug output to improve the agent team. A chat interface is enough there, plus tracing of the tool calls and routings, built-in eval tests, editability of the prompts, and a “backend” state to check what exactly happens to the data.

Support Agent Reliability Lab - UI with chat, traces and eval runner
Support Agent Reliability Lab - UI with chat, traces and eval runner

Claude kindly built me an application that sets up a support agent. After a fairly successful one-shot prompt, I adjusted a few small things, and we’re ready to go with an orchestrated support agent team.

One-shot prompt (generated by GPT 5.4 Pro)
Du bist ein senior Fullstack TypeScript Engineer und sollst eine lokale Demo-Anwendung bauen.

Ziel Baue eine moderne, screenshot-taugliche Web-App für einen Blogpost über AI-Evals, Tool-Verträge, Orchestrierung und Drift. Die App soll glasklar zeigen:

"Eine plausible Assistant-Antwort ist kein Beweis dafür, dass der richtige Tool-Call oder ein echter Seiteneffekt stattgefunden hat."

Das Produkt ist keine echte Support-Plattform, sondern eine fokussierte Reliability-Workbench rund um ein Orchestrator-/Refund-Agent-Szenario.

Arbeitsmodus Arbeite in dieser Reihenfolge:

- Sehr kurze Architekturzusammenfassung
- konkrete Dateistruktur
- Implementierung
- README
- kurze Liste bewusst verschobener Punkte

Warte nicht auf breite Rückfragen. Triff vernünftige Entscheidungen und halte den Scope eng.

Strikte Scope-Grenze

- Kein generischer AI-Playground
- Kein echtes Auth-System
- Keine echte Datenbank
- Kein echter MCP-Server
- Kein LangChain
- Keine Produktions-Härtung
- Keine SaaS-Observability
- Kein autonomer Agent-Schwarm

Stattdessen:

- lokale Demo
- explizite, gut prüfbare Workflows
- sichtbare Tool-Trajectories
- reproduzierbare Seed-Evals
- editierbare Prompt-/Tool-Contracts

Tech Stack

- Next.js App Router
- TypeScript
- Tailwind CSS
- shadcn/ui
- lucide-react
- aktuelle stabile APIs aus ai-sdk.dev
- AI SDK UI im Client
- AI SDK Core im Server
- zod für Schemas
- Vitest für ein paar gezielte Tests

Wichtige Architekturentscheidung Stelle das System auf Produktebene als "Agents" dar, aber implementiere es kontrolliert und explizit:

- Orchestrator
- Refund Agent
- Order/Lookup Agent
- Account/FAQ Agent

Vermeide ein riesiges Black-Box-Agentensystem. Ich will explizite, nachvollziehbare Module/Funktionen mit klaren Verträgen und strukturierten Traces.

Produktidee App-Name: Support Agent Reliability Lab

Die App soll demonstrieren:

- Routing durch einen Orchestrator
- spezialisierte Bearbeitung durch einen Refund Agent
- klare Tool-Verträge
- Approval für destruktive Aktionen
- Unterschied zwischen Antworttext und echtem Seiteneffekt
- Drift durch veränderte Tool-Beschreibungen
- kleine reproduzierbare Eval-Suite

Local-only Regel

- Provider API Keys werden im Browser localStorage gespeichert
- diese Keys werden pro Request an die lokalen API-Routen gesendet
- Keys niemals loggen
- Keys in der UI maskieren
- klare Warnung in der UI: "Local-only demo. Do not deploy as-is."

Provider Support

- OpenAI
- Anthropic

Settings sollen erlauben:

- Provider wählen
- Modell-ID eingeben
- API-Key eingeben
- Key presence anzeigen
- lokale Daten komplett löschen

Zentrale Produkt-Screens Baue ein modernes Layout mit Header + Tabs.

Tabs:

- Playground
- Trace
- Evals
- Contracts
- Backend State
- Settings

Die Prompts des Teams sind komplett anpassbar. Das Team selbst besteht aus:

- Orchestrator (orchestriert an die einzelnen Agents)
- Refund Agent (kennt die Regeln und Tools für Refunds)
- Lookup Agent (kümmert sich um Bestellstatus & Tracking Anfragen)
- Account & FAQ Agent (Passwort-Resets & Policy-Fragen)

Relevante Tools dabei sind: lookup_order(order_id), refund_order(order_id, reason), reset_password(account_id), faq_search(query) und verifyCustomer(account_id, email). In der generierten Anwendungen lassen sich hier auch die jeweiligen Toolbeschreibungen anpassen, um auch hier andere Prompts zu evaluieren, um bessere Ergebnisse erhalten zu können.
Chat interface of the support agent team with tool tracing
Chat interface of the support agent team with tool tracing

Contract and definition of done for the system

To implement the evals, we should be aware of the success criteria. For that, in our example, the following questions need answering:

When may a refund be triggered?

When all conditions are met:

  • identity verified: verify_customer must succeed
  • order exists: lookup_order must succeed
  • order.isRefundable === true
  • order.refundedAt === null
  • order.status !== 'refunded'
  • user approval: the workflow should pause and wait for explicit confirmation

When does the agent have to ask after all?

The orchestrator routes to the clarify route when the request is ambiguous or key info is missing, so it should know how the tools are called without being able to call them.

When may it only return an FAQ answer?

The faq route is only chosen for general policy questions that have nothing to do with refunds, order lookup or account management. There’s a faq_search tool there to answer questions from the FAQs.

When is a password reset permitted?

When the customer’s email address is known, the actions are audited and carried out by the account agent.

Which answers would be wrong in substance or security terms?

  • refund without lookup_order
  • refund without identity check
  • refund when isRefundable: false
  • duplicate refund
  • “false success”, the agent claims a refund was made, but the tool is never called
  • tool isolation violated, the FAQ agent calls refund_order
  • password reset without email

So without knowing the contract, no good evals can be formulated, and now we know the support team’s contract. From the last points in particular we can name fairly clear, measurable success criteria, our “definition of done”.

The smallest sensible eval mix

Code-based checks: what’s objectively verifiable belongs in code

Everything that is deterministically verifiable should also be verified deterministically. Because whoever lets hard rules go soft builds in unnecessary instability.

Rules that already exist in the app should also be found in the app. And in the context of the current application, exactly that is already happening. In the SDK we already define the inputSchema of tool inputs via a zod schema. Incorrect tool calls are already caught there. Via a lookup map, the allowed tool names per agent are defined and only those tools are offered to the LLM. Via the eval runner we check that the tools that should be called are called, when a defined LLM request comes in, and also that tools are not called. Tools with approval are not executed without user interaction (who the user is in that case, user or human agent, could be decided later).

More generally, elements that are objectively verifiable belong there, such as:

  • correctness of the schema
  • allowed tool names
  • completeness of the required parameters
  • exactness of IDs and labels
  • no action before verification
  • no duplicate or impermissible calls

Different eval pipelines have different grader types for this. In our project we wrote a custom evaluation area that has several graders like routeMatch, requiredToolsCalled, forbiddenToolsAvoided and a few more that check different rules.

Selection of code graders in the project that run along in the eval process and rate the prompt
Selection of code graders in the project that run along in the eval process and rate the prompt

Model-based grading: scale nuance, don’t simulate truth

LLM as a judge is better than gut feeling, but not identical to the truth.

“Is the result appropriate for the prompt? Answer with yes/no.” That will probably get us a surprising number of yes votes if we don’t define criteria. How would the LLM know what to look out for? So we need several clear, so-called rubrics, categories for rating my prompt. In them, evaluation criteria and possible points are defined, as well as a minimum score to reach. For example, the following criteria could be given to let the LLM rate the result automatically:

  • correctness: 0–2
  • completeness: 0–2
  • grounded in tool results: 0–2
  • tone/empathy appropriate: 0–2
  • no hallucinations: 0–2

Alternatively, we can define several pass/fail scenarios as rubrics that we only rate with pass/fail. In the following example, an LLM-as-a-judge run was carried out, here the AI explains in each case what was good or not good about the answer, and whether the answer passed the test or not.

LLM-as-a-judge results with explanations per test case
LLM-as-a-judge results with explanations per test case

So what’s tested is above all the quality of the answers in certain areas, and whether things are communicated clearly to the user. Cases that can’t be decided deterministically. Of course humans can decide even better here whether they understand the answer, but probably not as thoroughly reasoned as the LLM across many test cases.[1]

Human evals as a technique for calibration, discovery and edge cases

Does what comes out read well linguistically? Do I, as a user, feel comfortable with it? That’s perfectly decided by humans. In general, for calibrating the rest of the LLM ratings, having a human judge is well suited. Also, to identify edge cases that neither the code nor the LLM found, a human can investigate and potentially solve them, and possibly new code- or llm-as-a-judge graders fall out of it that ultimately improve the system’s quality.

Human judging of a result set
Human judging of a result set
Display of the human judges in the results view
Display of the human judges in the results view

Humans can additionally rate the subjective quality dimensions, as mentioned new elements or difficult edge cases, or the calibration of the cheaper graders.

Humans are not the scalable substitute for regression tests on every merge.

Precisely because human judging doesn’t scale arbitrarily, human review is the instance that sharpens the system, not the instance that manually signs off on everything every time. Especially when there are still few sensible graders, human review is incredibly important in order to write exactly those graders, llm- or code-based.

Trace and workflow evals: evaluating agents

Not only the result counts. The path, too, can be expensive, risky or broken.

So far we’ve primarily rated the agent’s answers (in the code checks we already built in first workflow evals). But this can be extended with further process-dependent checks. And the human feedback can also be extended with a process rating:

Extending the human feedback with the option to rate the process (tool usage)
Extending the human feedback with the option to rate the process (tool usage)

Possible automated checks of agent-based AI features here are questions like: was the right tool used? Are the arguments correct? Were there unnecessary loops? Was delegation done at the wrong time? Were tools called unnecessarily? Was the handoff clean?

What matters in this step is not output quality but process and workflow quality. Still, care should be taken not to define the paths too strictly, otherwise it’s a sign that maybe a deterministic system is the right thing after all.

Evals belong in CI

Continuous integration is the place where regular regression detection happens. As is well known, it’s the place where test suites are run. In the end, evals are nothing other than test runs. If the success criteria are drawn too tightly, the test becomes flaky, similar to load tests. But if the values are chosen well, the evals should really indicate that something is wrong when something really is wrong. And with this kind of test in particular, it’s important to run it only when something has changed. So, for example, when the prompt was adjusted, the model was changed, or something changed in the tools.

But exactly when something changes in the AI features, I want to notice that something is no longer right. So the ideal would be a small, fast regression suite that checks the critical core cases as often as possible on changes to any of the variables described, and at least runs the deterministic checks.

In CI, accordingly, a lower (not: too low) threshold of test cases should be set, potentially a lower one than in exploratory analysis. According to Anthropic, regression suites should have a nearly 100% pass rate.

Whoever merges AI features without an eval gate shifts QA into production.

A realistic operating model instead of an ideal

So far we’ve got to know many concepts that can be used for prompt eval and quality assurance, and in an ideal world should be. But from experience I know: not every project has 100% test coverage from the start (if that ever happens), nor is it feature-complete right after release. The aspects from this article should be viewed in the same way.

A sensible operating model for quality assurance could look like this:

  • on every PR, a small regression suite of the critical spots
  • deterministic checks
  • less stable judge-based core metrics
  • nightly / regularly: larger eval suite, broader datasets, several attempts for less stable tasks, trend comparisons
  • weekly / in the review rhythm: human sampling, calibration of the rubrics, analysis of new error patterns, decisions on which cases move into a suite
  • after incidents / support cases: turn production errors into new regression tests

At this point it becomes clear: good eval strategies are not a one-off action, they are an operating model.

CI is not enough: observability and production feedback

At the latest after incidents, when we take new errors into our suite, we see: some unknowns potentially only appear in production, and precisely here the following are all the more important:

  • reasonable tracing, monitoring & sampling of my AI features
  • incident reviews with adjustments to the prompts, tools, code checks

and, connected to that, feeding real errors back into the eval set.

Evals without production feedback go stale, production monitoring without evals stays reactive.

Common counterarguments, and why they don’t hold

  • LLMs are nondeterministic, so tests do little: That’s exactly why we need structured evals, trials & comparison runs with success metrics worked out from the start.

  • But we do manual checks before the release: Manual checks are perfect for uncovering new points, but really ineffective at detecting regressions.

  • LLM-as-a-judge is too unreliable: True in general. But for everything? No. For rubric-able nuances, calibrated with human feedback, it’s actually quite useful.

  • We don’t have a big benchmark yet & data is missing: Synthetic cases are a good start, after which production cases, logs, incidents, historical data, human-curated examples can go into the set. OpenAI itself recommends a similar mix.

  • This is too expensive: The tests are more expensive than unit tests, but it will be even more expensive to use real users as a test system. Evals aren’t perfect, but they are systematically superior to implicit hopes.

Quality is not claimed, it is measured

What we can’t check reproducibly can’t be improved in a controlled way. That includes deterministically written code just as much as the nondeterministic AI features that, beyond a certain point, become normal software responsibility. Tests are important in both worlds, and in LLM & agent systems these tests are called evals.

  1. Evaluation best practices | OpenAI API — Learn best practices for designing evals to test and improve model performance in production. (developers.openai.com)  ↩︎

  2. Define success criteria and build evaluations — Define measurable success criteria for your LLM application and build evaluations to test it, from exact match checks to LLM-based grading. (platform.claude.com)  ↩︎

  3. Demystifying evals for AI agents — Guidance on designing more rigorous, useful evals for AI agents across a range of architectures and real-world deployment use cases. (anthropic.com)  ↩︎

Conclusion

And here’s the live example:

Refund agent — multi-agent support system with evals, observability and contracts

App: refund-agent.pages.dev GitHub: rubenvitt/refund-agent