AI Made Friendly HERE

A Practical Introduction to Evaluation Engineering for Production Quality|はしコップ/旧帝理系卒/ランナー/外資系エンジニア

When developing generative AI applications, everyone experiences a moment like this at least once:

“I tested it locally with Claude, and it returned exactly the response I expected. Alright, it’s done!”

However, in real production development, this is where the real work actually begins.

Even with the same prompt, outputs will fluctuate if user input varies even slightly. It is not uncommon for a case that worked flawlessly yesterday to suddenly fail just because you made minor tweaks to the model, prompt, System Prompt, or available tools.

Furthermore, when it comes to developing autonomous AI agents, the number of aspects you need to evaluate increases dramatically:

  • Is the content of the response factually correct?

  • Did it select the appropriate tool?

  • Did it pass the correct arguments (parameters) to the tool?

  • Is it repeatedly calling unnecessary tools?

  • Was it able to carry out multi-step processing all the way to completion?

What is essential for overcoming this uncertainty and running products in production with confidence is Evaluation Engineering.

In this article, based on two key themes highlighted in “Evaluation Engineering and Quality Assurance” from Anthropic’s official curriculum, Claude Certified Developer Professional Prep Course—“Continuous Evaluation in CI” and “Creating Tools for Claude to Choose”—we will thoroughly explain from an engineer’s perspective how to assure the quality of Claude applications.

■ 1. Why Conventional Testing Doesn’t Work for LLMs

In traditional deterministic software, consider a function like the following, for example:

def add(a, b):
return a + b

To guarantee the quality of this function, writing a simple assertion like the following was sufficient:

However, what happens when you ask Claude to perform a task like this?

お客様からの問い合わせメールに丁寧に返信してください。

In this case, the answer that Claude returns is not limited to just one.

お問い合わせありがとうございます。

This is a correct answer, and

ご連絡いただきありがとうございます。

this is also perfectly correct.

In other words, LLMs have the fundamental characteristic that “the expected output is not uniquely determined (it is non-deterministic).” For that reason, unlike traditional testing,

expected_output == actual_output

Simply relying on exact-match comparisons like this makes it impossible to measure system quality.

■ 2. What Is “Evaluation Engineering”?

If you were to define evaluation engineering in a single phrase, it is “designing a mechanism to measure whether an AI system meets expected quality in a reproducible manner.”

The most important aspect here lies not in one-off “evaluating” itself, but rather in “turning evaluation into a systematic process.” For example, in a customer support system powered by Claude, you can define multifaceted evaluation axes like the following:

  • Correctness: Is the content of the response grounded in facts and data?

  • Relevance: Does it accurately answer the user’s question?

  • Completeness: Does it include all necessary information without omission?

  • Safety: Does it refrain from outputting inappropriate or confidential information?

  • Instruction Following: Did it follow constraints such as formatting and character count?

  • Tool Selection: Did it choose the correct tool according to the situation?

  • Tool Arguments: Did it pass the correct parameters to the tool?

  • Task Completion: Did it see the task through to the user’s ultimate goal?

The starting point for everything is for developers to first define “what constitutes a ‘good response and good behavior’ in this system.” If the target criteria remain ambiguous, you cannot objectively improve the quality of your AI.

■ 3. Building the “Evaluation Dataset” That Serves as the Foundation for Everything

The very first step when systematizing evaluation is building an Evaluation Dataset. For instance, in the case of a customer support agent, you prepare a large volume of data pairing inputs with “expected behaviors.”

{
“input”: “パスワードを忘れました”,
“expected_behavior”: {
“should_use_tool”: “search_knowledge_base”,
“should_not_use_tool”: “delete_account”,
“must_include”: [
“パスワードリセット”
]
}
}

The golden rule you must strictly follow when creating a dataset is “not to limit it only to the happy path.” In actual production environments, differences in quality are exposed far more by edge cases and irregular inputs than by happy paths. At a minimum, be sure to incorporate the following four types of cases into your dataset.

  • Happy Path (Standard Behavior)

  • Edge Case (Boundary Values / Missing Information)

  • Adversarial Case (Adversarial / Permission Violation)

  • Ambiguous Case (Ambiguous Instructions)

■ 4. “LLM-as-a-Judge” and the Secrets of Rubric Design

How should we automatically score the “quality” of natural language outputs that lack a single definitive answer? A prominent approach is LLM-as-a-Judge. In other words, you have an LLM (Claude) dedicated to evaluation score the generated response itself.

Question:
How do I reset my password?

Expected criteria:
– Explain the reset procedure
– Mention identity verification
– Do not ask for the current password

Assistant response:
…

Score the response from 1 to 5.

You construct the prompt in this way and have it output the evaluation results as structured JSON.

{
“correctness”: 5,
“completeness”: 4,
“safety”: 5
}

▼ However, the Judge is Not Omnipotent

This is where evaluation engineering becomes profound and challenging. Since the evaluator itself is an LLM, non-determinism (variability) will also emerge in the evaluator’s judgments.

You should not ask vague questions such as “Is this answer good?” To minimize scoring variance, you must explicitly articulate a rubric (scoring criteria) as shown below.

以下の基準で1〜5点を付けてください。

5: すべての質問に正しく回答し、必要な情報を完全に含む。
4: 主要部分は正しいが、軽微な情報が不足している。
3: 概ね正しいが、重要な情報が不足している。
2: 複数の重要な誤りを含む。
1: 質問に回答していない、または重大な誤情報を含む。

Designing the evaluation criteria themselves as precisely as code—that is precisely why it is called “Evaluation Engineering”.

■ 5. Integrating Evaluation into CI to Prevent Regressions

The first pillar of the curriculum, “Continuous Evaluation in CI,” is an extremely critical practice in team development. You must not run LLM application development using an “intuition-dependent workflow” like the following.

【アンチパターン】
開発者が手元でClaudeと会話
↓
「なんとなく良さそう」
↓
PR作成 → Merge

What you should aim for is a pipeline that passes through automated quality gates, just like in traditional software development.

【理想のCIフロー】
コード / プロンプト変更
↓
Pull Request作成
↓
Unit Test
↓
LLM Evaluation(評価スイート実行)
↓
品質基準を満たすか判定(Quality Gate)
↓
Pass → Merge / Fail → 修正

▼ Why Relying Solely on “Average Scores” Is Dangerous

For example, suppose you rewrite the System Prompt as follows:

Even if it looks improved by becoming more concise in the test case right in front of you, a regression might be occurring in other cases, such as “necessary prerequisites were stripped away,” “it stopped calling tools,” or “explanations for handling errors became insufficient.”

At this point, if you only look at the overall average score, you will fall into a trap.

Prompt v1 → Eval Score: 91%
Prompt v2 → Eval Score: 94% (全体では上がったように見える!)

However, when broken down by evaluation criteria, anomalies such as the following can sometimes be observed.

Correctness : 95 → 96
Tool Selection : 93 → 97
Safety : 100 → 100
Completeness : 92 → 84 ← Regression!(網羅性が大きく劣化)

Therefore, in production practice, we run around 100 evals per PR and define Quality Gates (acceptance criteria) for each evaluation dimension in code.

results = run_evaluation(test_cases)

if results[“safety”] < 1.0: raise Exception("Safety evaluation failed") if results["tool_selection"] < 0.98: raise Exception("Tool selection regression") if results["overall"] < 0.95: raise Exception("Quality threshold not met")

By combining tools like GitHub Actions, you can fully automate the entire pipeline: “PR creation → Execution of Evaluation Suite → Score calculation → Quality Gate assessment → Merge eligibility control.”

■ 6. The Core of AI Agents: Designing “Tools Claude Chooses”

The second key theme of the curriculum is “Creating Tools That Claude Chooses.” This is the core element that makes or breaks implementations for engineers working with Claude Code, MCP (Model Context Protocol), and autonomous AI agents.

For example, suppose you provide the following five tools to Claude:

  • get_weather

  • search_documents

  • send_email

  • create_calendar_event

  • delete_file

If a user asks, “What’s the weather in Tokyo tomorrow?” the correct answer is obviously get_weather. However, if your tool definitions are sloppy, Claude will casually select search_documents instead.

▼ Tool Descriptions are “API Design for Agents”

Take a look at the following example of a poor tool definition.

{
“name”: “search”,
“description”: “Search things”
}

With this, Claude has no idea whatsoever what kind of information the tool searches for. A tool’s description is not merely supplementary documentation for humans; it is “a decision-making interface for AI agents to choose their actions.”

To build highly accurate agents, you need to provide concrete decision criteria like this:

{
“name”: “search_internal_documents”,
“description”: “Search internal company documents stored in the corporate knowledge base. Use this when the user asks about internal policies, procedures, or company documentation. Do not use this tool for public web information.”
}

▼ Clarify Boundary Conditions Between Similar Tools

Mishaps are especially prone to happen when tools with similar roles sit side by side, such as search_web, search_documents, and search_email. If all of their descriptions just say “Search information,” Claude won’t be able to distinguish between them.

Draw clear boundaries by explicitly specifying “Use when” and “Do not use when” for each tool.

  • search_web

  • search_documents

  • search_email

Simply articulating these boundary conditions dramatically stabilizes tool selection accuracy.

■ 7. Evaluate Agents by “Trajectory (Execution Path),” Not Just Isolated Points

Once you design your tools, incorporate tool selection itself into your evaluation dataset and track it continuously.

  • “What’s today’s weather in Tokyo?” → Expected tool: get_weather

  • “Look up the company leave policy” → Expected tool: search_internal_docs

  • “Find the email that came from Mr. Tanaka” → Expected tool: search_email

  • “Create a meeting for tomorrow at 10:00” → Expected tool: create_calendar_event

accuracy = correct_tool_calls / total_tool_calls

If 97 out of 100 cases are correct, you can track it in CI as Tool Selection Accuracy = 97%.

▼ Merely Calling a Tool Is Not “Success”

However, in practical agent evaluation, Tool Selection alone is not enough.

For example, even if Claude correctly chooses create_calendar_event, if the arguments that should have been specified were

{
“date”: “2026-12-01”,
“time”: “15:00”
}

yet it passes arguments that are

{
“date”: “2026-12-02”,
“time”: “15:00”
}

and off by a day, the system has failed. When evaluating agents, you need to verify this entire chain.

Tool Selection(どのツールを選んだか)
↓
Argument Accuracy(正しい引数を渡したか)
↓
Tool Result Handling(ツールの返り値・エラーを正しく解釈したか)
↓
Final Answer(最終回答は適切か)
↓
Task Completion(目的は達成されたか)

▼ Evaluating the Execution Path: “Agent Trajectory”

As agents become more sophisticated and operate by combining multiple tools, evaluating only the final response reaches its limits.

For example, when a user makes the request, “Check my available times tomorrow and set up a 30-minute meeting with Tanaka-san,” the agent operates as follows.

get_calendar
↓
find_available_slot
↓
create_event
↓
ユーザーへ結果を報告

This series of execution steps is called the Agent Trajectory, and it is evaluated from the following five perspectives:

  1. Tool Selection: Did it select the appropriate tools?

  2. Tool Order: Did it call them in the correct order? (e.g., did it schedule the meeting before checking availability?)

  3. Arguments: Are arguments such as date/time, duration, and participants accurate?

  4. Efficiency: Does it avoid wasteful tool calls and repetitive loops?

  5. Completion: Did it actually follow through to the completion of the meeting creation?

This applies equally to Claude Code or custom agents connected to MCP servers (such as search_code, read_file, create_file, run_test, deploy, etc.). Agent quality is determined by the sum of “Model + System Prompt + Context + Tool Definition / Description + Evaluation Dataset”. It is not always true that “switching to a smarter, newer model will solve the problem.”

■ 8. An Evaluation Pipeline That Works in Practice and “Capitalizing on Failures”

Synthesizing the elements discussed so far, an ideal evaluation pipeline for a Claude-based application looks like this:

┌→ Unit Tests
│
Code / Prompt ────┼→ Prompt Eval
Change │
├→ Tool Selection Eval
│
├→ Tool Argument Eval
│
├→ Safety Eval
│
└→ End-to-End Agent Eval
↓
Quality Gate
↓
Pass → Deployment

And what is even more important is the post-deployment feedback loop.

Production Logs(本番ログ)
↓
Failure Analysis(失敗の原因分析)
↓
New Evaluation Case(新しい評価ケースの作成)
↓
Evaluation Datasetへ追加
↓
CIパイプラインで継続検証

When comparing traditional software development side by side with LLM development, you will find that their underlying philosophies are surprisingly similar.

【従来のソフトウェア開発】
Bug発生 → Fix → Unit Test追加 → Regression防止

【LLM / エージェント開発】
AI Failure発生 → Failure分析 → Prompt/Tool改善 → Eval Case追加 → Regression Eval

Just because you are doing LLM development does not mean the discipline of quality assurance disappears. Rather, evaluation engineering is “the engineering discipline that extends the principles of traditional software testing to probabilistic systems.” Instead of patching production failures with quick, makeshift fixes, let’s transform them into valuable assets—”Eval Cases that never allow the same failure to recur”—and integrate them into your CI.

■ 9. Four Common Pitfalls in the Field

Finally, let’s summarize four anti-patterns that teams easily fall into when taking Claude applications to production.

  1. Releasing after testing only around 10 prompts Never settle for just the happy paths thought up by developers. Intentionally mix edge cases, ambiguous questions, erroneous inputs, and unauthorized requests into your dataset.

  2. Looking only at the average score Even if the overall average is 96%, if safety-critical cases drop to 70%, it cannot be considered production quality. Set strict, independent thresholds for critical evaluation criteria.

  3. Neglecting changes to tool descriptions In agents that perform tool calling, the tool definitions and descriptions themselves are part of the agent’s behavior (logic). Whenever you modify a tool name or description, always run a regression eval just as you would for a prompt change.

  4. Looking only at the final answer Even if the final text looks plausible, it might be calling unnecessary tools under the hood or updating incorrect data. Monitor the entire trajectory from reasoning to tool invocation and result processing.

■ Conclusion: “Engineering Quality” Even in AI Development

If the essence of evaluation engineering could be summed up in a single sentence, it would be this:

“Evaluate not ‘Is the AI smart?’, but ‘Can this system stably execute the required task?'”

When comparing individual models on benchmarks, attention easily turns to “Model A vs. Model B.” However, in actual product development, the target of evaluation is the entire system, encompassing prompts, context, retrieval, tools, the agent loop, and application logic in addition to the model itself.

Let’s review the key points from this article across 10 items.

  1. Because LLM outputs are non-deterministic, exact-match testing alone is insufficient

  2. Build an evaluation dataset that includes happy paths, edge cases, and adversarial inputs

  3. Define evaluation criteria—such as correctness, safety, and tool selection—beforehand

  4. Measure quality using an LLM-as-a-Judge designed with clear rubrics (scoring criteria)

  5. Integrate evaluations into the CI/CD pipeline and control merges with quality gates

  6. Always run a regression eval even for minor prompt adjustments

  7. For agents, refine tool descriptions as part of API design

  8. Evaluate not just tool selection, but the entire trajectory, including arguments and execution order

  9. Turn production failures into new eval cases to build up reusable assets

  10. Evaluate the reliability of the entire AI system, not just the model in isolation

Once you acquire this perspective, your vantage point as an engineer will rise to the next level in the following ways.

Prompt Engineering(どう指示を書くか)
↓
Agent Engineering(どうツールと自律ループを組むか)
↓
Evaluation Engineering(どう品質を測り、保証するか)
↓
Production AI Engineering(どう本番で安定稼働させ続けるか)

Especially in agent development leveraging Claude Code or MCP, “how you prove that Claude is selecting the right tool with the right arguments” is just as crucial as “how you build convenient tools.”

To graduate from the “It works!” phase of a PoC (proof of concept) and deliver AI products that teams and users can rely on with confidence, be sure to start integrating an “evaluation mechanism” into your development cycle today.

Originally Appeared Here

You May Also Like

About the Author:

Early Bird