AWS、AIエージェント評価の生産用ブループリントを公開
Motorway と AWS は、AI エージェントの信頼性を確保するための評価パイプラインを構築し、Strands Agents SDK と Amazon Bedrock AgentCore を活用して誤検出率を大幅に削減する実証例を示した。
キーポイント
実運用における課題と解決
Motorway は AI エージェントのツール選択エラー、意味解釈のズレ、文脈の逸脱などにより信頼性が損なわれるリスクに対し、AWS と共同で評価パイプラインを構築し、誤り率を 1/8 から 1/50 に改善した。
2 フェーズの評価戦略
開発段階でのテストにはオープンソースの「strands-agents-evals」を、本番環境では「Amazon Bedrock AgentCore Evaluations」を活用する 2 フェーズ構成を採用し、継続的な品質保証を実現した。
3 レイヤー評価フレームワーク
ツールの使用状況、推論の質、出力の良さを網羅的に評価するための 3 レイヤー構造を確立し、AI エージェントの多面的な性能を定量化可能にした。
品質ゲート付きデプロイパイプライン
5 つの段階からなるデプロイプロセスに品質ゲートを設け、指標が閾値を下回る場合はリリースを自動的にブロックする仕組みを導入した。
重要な引用
The agent gives a confident-sounding response, but how do you prove it works reliably with real money on the line?
Together, Motorway and AWS built an end-to-end evaluation pipeline that reduced incorrect results from 1 in 8 queries to 1 in 50
Although the blueprint uses AWS services, the core principles are essential and system-agnostic requirements for any production-ready AI agent.
影響分析・編集コメントを表示
影響分析
この記事は、AI エージェントの実装において「開発と運用のギャップ」を埋めるための具体的な解決策を示しており、単なる技術紹介を超えて、実社会での信頼性確保という重要な課題に対する実践的なアプローチを提供しています。特に、評価指標の定量化と自動リリースブロックの仕組みは、企業レベルで AI を導入する際のリスク管理基準として広く参照される可能性が高いです。
編集コメント
AI エージェントの導入において、機能の実装だけでなく「信頼性の証明」がいかに重要かを説く、極めて示唆に富む記事です。特に評価パイプラインの構築プロセスは、実務で AI を運用するエンジニアにとって即座に活用できるフレームワークとして価値が高いと言えます。
本記事は、Motorway および AWS Prototyping と AI Customer Engineering (PACE) チームとの共著です。
英国に拠点を置くオンラインカーマーケットプレイス「Motorway」では、毎日最大 8,000 のディーラーが最大 2,500 台の車両を競り落とすオークションを開催しています。Motorway は AWS Prototyping と AI Customer Engineering (PACE) チームと協力し、AI を活用したディーラー向け在庫検索エージェントを開発しました。これにより、ディーラーは従来の数時間にわたる手動フィルタリングに代わり、自然言語によるクエリで車両を検索できるようになりました。
課題
エージェントが自信ありげな回答を返すことはできても、実際に金銭がかかっている状況でその信頼性をどう証明すればよいのでしょうか?
- ツールの選択ミスにより検索結果が誤り、ディーラーの信頼が失われるリスクがあります。
- セマンティック検索の解釈ミスにより、関連性の低い結果が返される問題です。例えば「5 年以内のガソリン車、ハイブリッド車、電気自動車」といったクエリでは、エージェントが複数の制約条件を正しく解析する必要があります。
- 複数回の対話における文脈のズレ(コンテキストドリフト)により、ディーラーによる絞り込み条件が見失われる恐れがあります。
- 出力が非確定的であるため、単発のテスト結果だけで信頼性を判断することはできません。
解決策
Motorway と AWS は共同でエンドツーエンドの評価パイプラインを構築し、検索クエリあたりの誤り率を「8 件に 1 件」から「50 件に 1 件」に低減するとともに、問題の検出時間を数時間から数分に短縮しました。
このパイプラインは、Strands Agents SDK と Amazon Bedrock AgentCore を組み合わせています。Bedrock AgentCore は、大規模な AI エージェントの展開と運用を完全に管理するサービスです。本記事では、あなた自身も同様の評価パイプラインを構築する方法をご紹介します。
- Strands Agents のオープンソース評価ライブラリ「strands-agents-evals」を用いたビルド時のテストと、Amazon Bedrock AgentCore Evaluations による本番環境のモニタリングを組み合わせる、2 フェーズからなる評価戦略。
- ツール使用能力、推論プロセス、出力品質を多角的に検証する 3 レイヤー構成の評価フレームワーク。
- メトリクスが閾値を下回った際にリリースを自動ブロックする品質ゲートを備えた、5 ステージのデプロイパイプライン。
A companion repository では、実環境で即座に導入可能なブループリントを提供しています。このブループリントは AWS サービスを前提としていますが、その根幹となる原則は、あらゆるプロダクション対応型 AI エージェントにとって不可欠なシステム非依存の要件です。具体的には、3 レイヤー構成の評価フレームワークと、一貫性を測るための pass^k メトリクスの活用が挙げられます。
前提条件
本記事の内容を実践するには、以下の環境準備が必要です。
本チュートリアルを実行するには、以下の環境と権限が必要です。
- Amazon Bedrock、AWS Lambda、Amazon Simple Storage Service (Amazon S3)、Amazon DynamoDB、Amazon EventBridge、Amazon CloudWatch、および Amazon Simple Notification Service (Amazon SNS) へのアクセス権限を持つ AWS アカウント
- インストール済みかつブートストラップされた AWS Cloud Development Kit (AWS CDK) v2
- Python 3.14 以降
- Amazon Bedrock を通じた Anthropic Claude モデルおよび Amazon Titan モデルの利用権限
- Python、AWS CDK、およびエージェントの基本概念(ツール呼び出しや多段階対話など)に関する知識
所要時間: 初期デプロイに 30〜45 分、ドメイン固有のカスタマイズに 2〜3 時間。
想定コスト: サンプル評価スイートの実行には、Amazon Bedrock の推論利用料として約 5〜10 ドルがかかります。本番環境の監視コストはサンプリングレートに応じて変動します。
セキュリティに関する注意: 補完リポジトリでは、最小権限の原則に基づいた AWS Identity and Access Management (IAM) ロールを実装しています。また、API キーは環境変数ではなく AWS Systems Manager Parameter Store に保存し、型付きパラメータを使用してインジェクション攻撃を防ぐ設計となっています。詳細については リポジトリの README をご確認ください。
実例:ディーラー在庫検索エージェント
Motorway社は、Strands Agents SDK と Amazon Bedrock AgentCore を活用して、ディーラー向け在庫検索エージェントを構築しました。このエージェントは 8 つのツールを公開しており、89 項目を超える車両属性に対する構造化フィルタリングと、LanceDB や Amazon Titan Text Embeddings V2 を活用したベクトル類似度検索を組み合わせています。
従来、ディーラーは CSV ファイルや固定されたフィルタリング機能を使って在庫一覧を閲覧するのに数時間を要していました。しかし、会話型 AI エージェントを導入することで、ユーザーは自然な言葉でエージェントに指示できるようになりました。「250 万ドル以下のディーゼル SUV を近くの店舗で探して」や「家族向けでスポーティーかつオートマチックな車」といった問い合わせが可能です。
ピーク時には約 1,500 人の同時接続ユーザーが利用するため、エージェントの動作を正確に制御することは必須です。ツールの選択ミスや意味検索の誤解釈は、直ちにユーザーの信頼を損なう要因となります。図 1 はエンドツーエンドのリクエストフローを示しています。ディーラーは Web インターフェースから自然言語でクエリを入力し、それが Amazon Bedrock AgentCore Runtime にルーティングされます。Runtime が Claude を用いた推論や Amazon Titan を活用した埋め込み処理を行いながら、8 つの異なるツールへの呼び出しを調整します。ツールの応答は再び Runtime を経由して戻され、最終的にディーラー向けに結果が生成されます。

エージェント評価がなぜ異なるのか
大規模言語モデル(LLM)の評価は、主にテキスト生成の質——一貫性、事実の正確さ、回答の関連性——に焦点を当てます。一方、エージェントの評価は根本的に異なるものを測るものです。
例えて言えば、LLM の評価が「エンジンの性能」をチェックするものだとすれば、エージェントの評価は「雨の日や渋滞の中、後部座席に人を乗せて走ったとき、車全体がどう振る舞うか」を問うことになります。
従来の LLM 指標だけでは、Motorway エージェントが「Grade 1 スズキのモデル」を検索する際に適切な検索ツールを選んだかどうかは分かりません。また、LanceDB に渡したフィルタパラメータが正しいかどうかも確認できません。さらに、前のターンで得た結果をディーラーが精査して最終回答を出すプロセスが適切に行われたかも見逃してしまいます。
| 評価の次元 | エージェントにとってなぜ重要なのか |
|---|---|
| タスク完了 | エージェントは多段階のワークフローを実行するため、部分的な完了が頻繁に起こります。 |
| ツール使用の正しさ | 間違ったツールや不適切なパラメータは、ワークフロー全体を破綻させる恐れがあります。 |
| 推論の一貫性 | 推論に欠陥があると、状況の変化に応じて予測不能な失敗が起きます。 |
| 信頼性と一貫性 | 非決定性(ノンデターミニズム)のため、同じ入力でも異なる結果が生じることがあります。 |
| セーフティとコンプライアンス | 自律的なエージェントは、現実世界に実際に影響を与える行動をとる可能性があります。
コストと効率性
タスクごとに API 呼び出しを 50 回も必要とするエージェントは、経済的に成り立たない可能性があります。
「Volkswagen Golf 7-12 years old」のような正確なクエリなら完璧に機能するかもしれませんが、「古めの VW を探している」といった口語的な表現では、セマンティック検索層が適切に評価されていないと失敗する恐れがあります。
strands-agents-evals でデプロイ前の課題を把握する
このブループリントは、GenAIOps ライフサイクル に沿った 2 つのフェーズで評価を実施します。ビルド時の評価はデプロイ前の課題を捉え、本番環境での評価は合成テストでは見逃される問題を検出します。
以下の図(Figure 2)は、ツール使用、推論、出力品質の各レイヤーがデプロイ前に通過すべき基準を示しています。このフレームワークでは、エージェントを 3 つのレイヤーで評価します。
- レイヤー 1(ツール使用):ツールの正しい選択とパラメータ引渡しが検証され、95% 以上の閾値を満たす必要があります。
- レイヤー 2(推論):論理的な意思決定が評価され、85% 以上の閾値を満たす必要があります。
- レイヤー 3(出力品質):回答の有用性と正確性が測定され、90% 以上の閾値を満たす必要があります。デプロイに進むには、これらすべてのレイヤーを通過させることが必須です。

開発中および継続的インテグレーション・継続的デプロイメント(CI/CD)の過程では、strands-agents-evals フレームワークを活用して、本番環境への展開前に問題を早期に発見します。このフレームワークは、出力の検証や実行経路の評価、多段階会話のシミュレーション、そして自動化された実験生成をサポートしています。これらはすべて、Strands Agents SDK をベースに構築されたエージェントとネイティブに連携するように設計されています。
同フレームワークでは、3 つの基本要素(プリミティブ)を提供します。
- 実験(Experiment):エージェントに対して実行されるテストケースの集合体です。
- ケース(Case):入力クエリ、期待される出力、そして期待されるツールの実行経路から構成されます。
- エvaluator(評価器):スコアリングロジックを提供します。決定論的な手法や LLM を活用した手法が利用可能です。
テストはレイヤー構造で構築しましょう。第 1 レイヤーでは、ツール選択の精度を判定する決定論的なコードベースの評価器を実行します。一方、第 2 レイヤーと第 3 レイヤーでは、LLM-as-judge(LLM を用いた評価)を採用し、推論能力や出力品質をチェックします。
カスタム評価器のサブクラスを作成することで、ドメイン固有の課題に対応できます。例えば「Motorway」エージェントの場合、データの鮮度、ディーラーのスコーピング、そして安全性に関するガードレールが対象となります。各エージェントには独自の制約条件が存在するため、それに応じた設計が必要です。
3 つの評価器(Grader)の種類
評価フレームワークでは、異なる評価ニーズに対応できるよう、3 つの Grader タイプを用意しています。
| Grader type | Layer | What it measures | Trade-off |
|---|---|---|---|
| Code-based deterministic | Layer 1 | ツール選択、パラメータ渡しの精度、実行経路の順序付け | 高速・低コスト・再現性が高い |
LLM-as-judge(Claude Sonnet 4.6)
レイヤー2〜3
推論の質、出力の有用性、目標達成度
フレキシブルですが非決定的(pass^k で制御可能)
人間のレビュー
キャリブレーション
エッジケースと安全性
コスト高;LLM ジャッジのプロンプト調整に使用
実務では、エージェントが辿った経路を評価するよりも、最終的な成果物を評価する方が多くの課題を発見できます。重要なのはユーザーが適切な結果を得たかどうかであり、どのツールを最初に呼び出したかではありません。
3 レイヤー評価フレームワーク
ビルド時の評価は、それぞれに明確な合格・不合格の閾値を持つ 3 つの異なるレイヤーで行われます。
レイヤー1:ツールの使用(95% 以上の閾値)
エージェントは正しいツールを適切なパラメータで呼び出しましたか?
- 「£7,000〜£20,000 のディーゼル車」というクエリには、検索機能
search_vehiclesを使用し、燃料タイプ(diesel)、最低価格(7000)、最高価格(20000)といった型付きフィルタを適用する必要があります。
- 「走行距離の短い現代的なハッチバック」というクエリには、セマンティック埋め込みと構造化フィルタを組み合わせた
hybrid_searchをトリガーさせるべきです。
この評価は決定論的に行われます。ToolSelectionGrader が呼び出されたツールを確認し、TrajectoryOrderGrader が呼び出し順を検証します。
レイヤー2:推論(閾値85%以上)。意思決定プロセスは論理的だったか?strands-agents-evals に含まれる HelpfulnessEvaluator と TrajectoryEvaluator は、LLM を審判として用いたスコアリングにより、エージェントの推論が整合しているかを評価します。間違った推論プロセスを経て正しい回答にたどり着いた場合でも、環境条件の変化に応じて予期せぬ失敗を引き起こす可能性があります。
レイヤー3:出力品質(閾値90%以上)。回答は有益で正確かつ実行可能だったか?strands-agents-evals の OutputEvaluator と GoalSuccessRateEvaluator は、LLM を用いた評価によって、ユーザーが有用で適切に整形された回答を受け取れたかを判断します。
これら3つのレイヤーをすべて通過して初めてデプロイ可能です。いずれかのレイヤーで失敗すると、パイプラインはブロックされます。
非決定性の扱い
LLM の出力は実行ごとにばらつくため、単一の試行結果だけでは誤解を招く恐れがあります。これに対処するため、コンパニオンリポジトリの run_all_layers() 関数には num_trials パラメータが用意されています。信頼性を測定するために、コード生成研究コミュニティから採用された2つの指標を使用します:
pass@k は、k 回の試行のうち少なくとも 1 回成功する確率を測る指標です。これは「正解が一つ見つさえすればよい」という場合に有用な評価基準となります。
一方、pass^k(pass の k 乗)は、k 回の連続した試行すべてで成功する確率を表します。こちらは、ユーザーが毎回確実に動作することを求めるシナリオに適しています。
顧客対応を行うエージェントにおいては、この pass^k が最も重要です。例えば、1 回ごとの成功率が 75% のエージェントでも、3 回連続して成功する確率は 0.75³ で約 42% に過ぎません。ユーザーは、どのやり取りにおいても一貫した品質を期待しているからです。
関連するコードでは、run_all_layers(task_fn, registry, num_trials=5) を実行することで、複数回試行に対応した評価レイヤーを実行し、pass^k の基準を満たした場合のみデプロイが許可される仕組みになっています。詳細は こちら をご覧ください。
テストケースの管理
テストケースは以下のカテゴリに整理されます:
- ハッピーパス:成功が期待される一般的な問い合わせ
- エッジケース:曖昧なクエリ、スラング、複数回のやり取りによる修正など
- セーフティ/ガードレール:エージェントが拒否または誘導すべき問い合わせ
本番環境のモニタリングで問題を検知した場合、そのやり取りは新たなテストケースとして登録されます。Motorway の事例では、初期の 50 件から 3 ヶ月で 150 件に増えましたが、これらはすべて実際のユーザー行動に基づいています。まずは 20〜50 件のケースから始め、本番環境のデータによって徐々に_suite_を充実させていくのがおすすめです。
エージェントが特定のツールを呼び出すべきではないケースも評価に含める必要があります。例えば、プロフィール照会では検索ツールではなくプロフィール専用ツールを使用すべきですし、構造化されたクエリには生 SQL のフォールバックではなく、構造化検索を利用するべきです。片側だけの評価は、片側への最適化しか生まれません。
マルチターン会話テスト
単一ターンの評価では見逃しがちなのが、会話の一貫性という重要な次元です。ディーラーは自然に複数のターンにわたって検索を洗練させていきます:
- ターン 1:「ディーゼル SUV を探して」
- ターン 2:「今度はオートマチック車だけにして」
- ターン 3:「ステーションワゴンならどう?」
Strands エージェント評価フレームワークには、現実的なマルチターン対話を生成する ActorSimulator と、ターンをまたぐ文脈保持能力をスコアリングする InteractionsEvaluator が用意されています。マルチターンのテストでは、単一ターンのテストでは見逃される文脈のズレや、フィルターの蓄積によるエラー、代名詞の解決失敗などを検出できます。
AgentCore Evaluations で本番環境の動作を監視する
Strands Agent を Amazon Bedrock AgentCore Runtime にデプロイした後、AgentCore Evaluations が継続的な監視を提供します。これは業界標準の観測性フレームワークである OpenTelemetry による計測を通じて Strands Agent と統合されています。図 3 は本番環境でのアーキテクチャを示しており、観測性のトレースは 1〜5% の割合でサンプリングされ、メトリクスは Amazon CloudWatch に集約されます。

2 つの監視アプローチ
AgentCore Evaluations は、相補的な 2 つのモードを提供しています。
オンデマンド評価では、Amazon CloudWatch ログから特定のスパンを指定して、エージェントの相互作用を分析します。これは問題のデバッグや修正内容の検証に役立ちます。
オンライン評価は、ライブトラフィックを自動的にサンプリングし、バックグラウンドで評価器を実行します。サンプリング率(推奨値は 1〜5%)を設定し、最大 10 個の評価器を選択して実行するだけです。
組み込みとカスタム評価器
AgentCore では、一般的なシナリオに対応した事前設定済みの評価器が用意されています。以下の表に、利用可能な組み込み評価器とその測定項目を示します。
| Evaluator | Level | What it measures |
|---|
Builtin.Helpfulness
TRACE
エージェントの回答がいかに役立ったかを評価する(0~1 のスコアを 7 レベルで判定)
Builtin.GoalSuccessRate
SESSION
ユーザーの全体の目標が達成されたかどうかを確認する
Builtin.ToolSelection
原文を表示
*This post was co-written with Motorway and the AWS Prototyping and AI Customer Engineering (PACE) team.*
Motorway, a UK-based online car marketplace, runs a daily auction where up to 8,000 dealers bid on up to 2,500 vehicles. Motorway worked with AWS Prototyping and AI Customer Engineering (PACE) to build an AI-powered dealer stock search agent that transforms how dealers find vehicles, replacing hours of manual filtering with natural language queries.
The challenge
The agent gives a confident-sounding response, but how do you prove it works reliably with real money on the line?
- Tool selection errors cause wrong search results, eroding dealer trust.
- Semantic search misinterpretations return irrelevant results. A query like “Petrol, Hybrid and electric cars up to 5 years old” requires the agent to correctly parse multiple constraints.
- Context drift in multi-turn conversations loses dealer refinements.
- Non-deterministic outputs make single-trial testing unreliable.
The solution
Together, Motorway and AWS built an end-to-end evaluation pipeline that reduced incorrect results from 1 in 8 queries to 1 in 50 and cut issue detection time from few hours to few minutes.
The pipeline combines the Strands Agents SDK with Amazon Bedrock AgentCore, a fully managed service for deploying and operating AI agents at scale. In this post, you will learn how to build this pipeline for your own agents:
- A two-phase evaluation strategy spanning build-time testing with strands-agents-evals (the open source evaluation library for Strands Agents) and production monitoring with Amazon Bedrock AgentCore Evaluations.
- A three-layer framework for assessing tool usage, reasoning, and output quality.
- A five-stage deployment pipeline with quality gates that block releases when metrics fall below thresholds.
A companion repository provides a deployable blueprint that you can adapt for your own agents. Although the blueprint uses AWS services, the core principles are essential and system-agnostic requirements for any production-ready AI agent. These principles include the three-layer evaluation framework and the use of the pass^k metric for consistency.
Prerequisites
You must have the following prerequisites to follow along with this post.
- An AWS account with permissions for Amazon Bedrock, AWS Lambda, Amazon Simple Storage Service (Amazon S3), Amazon DynamoDB, Amazon EventBridge, Amazon CloudWatch, and Amazon Simple Notification Service (Amazon SNS).
- AWS Cloud Development Kit (AWS CDK) v2 installed and bootstrapped.
- Python 3.14+.
- Access to Anthropic Claude models and Amazon Titan models through Amazon Bedrock model access.
- Familiarity with Python, AWS CDK, and agent concepts (tool calling, multi-turn conversations).
Time to complete: 30–45 minutes for initial deployment and 2–3 hours to customize for your domain.
Estimated costs: Running the sample evaluation suite costs approximately $5–10 in Amazon Bedrock inference charges. Production monitoring costs vary based on sampling rate.
Security note: The companion repository implements least-privilege AWS Identity and Access Management (IAM) roles, stores API keys in AWS Systems Manager Parameter Store (not environment variables), and uses typed parameters to help prevent injection attacks. See the repository README for details.
The worked example: A dealer stock search agent
Motorway built the dealer stock search agent on the Strands Agents SDK and Amazon Bedrock AgentCore. The agent exposes eight tools that combine structured filtering across over 89 vehicle attributes with vector similarity search powered by LanceDB and Amazon Titan Text Embeddings V2.
Dealers typically spent hours browsing through listings using CSVs and rigid filters. By introducing a conversational AI agent, dealers can now talk to the agent: “Find me diesel SUVs under 25k near my dealership” or “something sporty and automatic for a family.”
With around 1,500 concurrent users during peak hours, getting agent behavior right isn’t optional. A tool selection error or semantic search misinterpretation directly impacts user trust. Figure 1 shows the end-to-end request flow: dealers submit natural language queries through a web interface, which routes to Amazon Bedrock AgentCore Runtime. The runtime orchestrates calls to eight different tools while using Amazon Bedrock models (Claude for reasoning, Amazon Titan for embeddings). Tool responses flow back through the runtime to generate the final dealer-facing results.

Why agent evaluation is different
Large language model (LLM) evaluation focuses on text generation quality: coherence, factual accuracy, response relevance. Agent evaluation assesses something fundamentally different. Think of it this way: LLM evaluation examines engine performance. Agent evaluation assesses how the whole car drives in traffic, in rain, or with a backseat full of passengers.
Traditional LLM metrics don’t tell you whether the Motorway agent called the right search tool for “Grade 1 Suzuki models.” They don’t reveal if the agent passed correct filter parameters to LanceDB. And they miss whether a dealer refining results from a previous turn gets the right response.
Evaluation dimension
Why it matters for agents
Task completion
Agents run multi-step workflows where partial completion is common
Tool use correctness
Wrong tools or bad parameters can derail entire workflows
Reasoning coherence
Flawed reasoning leads to unpredictable failures as conditions change
Reliability and consistency
Non-determinism means the same input can produce different outcomes
Safety and compliance
Autonomous agents can take actions with real-world consequences
Cost and efficiency
An agent requiring 50 API calls per task may not be economically viable
A precise query like “Volkswagen Golf 7-12 years old” might work perfectly, but a colloquial variant like “I’m looking for an older VW” could fail if the semantic search layer isn’t properly evaluated.
Catch issues before deployment with strands-agents-evals
The blueprint implements evaluation across two phases that map to the GenAIOps lifecycle. Build-time evaluation catches issues before deployment, and production evaluation catches what synthetic tests miss. The following diagram (Figure 2) shows how the tool usage, reasoning, and output quality layers must pass before deployment. The framework evaluates agents across three layers:
- Layer 1 (Tool Usage) validates correct tool selection and parameter passing with a greater than 95 percent threshold.
- Layer 2 (Reasoning) assesses logical decision-making with a greater than 85 percent threshold.
- Layer 3 (Output Quality) measures response helpfulness and accuracy with a greater than 90 percent threshold. All three layers must pass before deployment proceeds.

During development and continuous integration and continuous deployment (CI/CD), the pipeline uses the strands-agents-evals framework to catch issues before deployment. It provides output validation, trajectory evaluation, multi-turn conversation simulation, and automated experiment generation. Each is designed to work natively with agents built on the Strands Agents SDK. The framework provides three primitives:
- Experiment: A collection of test cases run against the agent.
- Case: Input query, expected output, and expected tool trajectory.
- Evaluator: Scoring logic (deterministic or LLM-based).
Structure your tests into layers. Layer 1 runs deterministic code-based graders for tool selection accuracy. Layers 2 and 3 use LLM-as-judge evaluators (using an LLM to score agent outputs) for reasoning and output quality.
Custom Evaluator subclasses handle domain-specific concerns. For the Motorway agent, these cover data freshness, dealer scoping, and safety guardrails. Your agent will have its own domain constraints.
Three types of graders
The evaluation framework uses three grader types, each suited to different evaluation needs.
Grader type
Layer
What it measures
Trade-off
Code-based deterministic
Layer 1
Tool selection, parameter passing, trajectory ordering
Fast, cheap, reproducible
LLM-as-judge (Claude Sonnet 4.6)
Layers 2–3
Reasoning quality, output helpfulness, goal success
Flexible; non-deterministic (controlled via pass^k)
Human review
Calibration
Edge cases and safety
Expensive; used to calibrate LLM judge prompts
In practice, grading what the agent produced catches more issues than grading the path it took. You care that the user got relevant results, not which tool the agent called first.
Three-layer assessment framework
Build-time evaluation operates across three distinct layers, each with specific pass/fail thresholds.
Layer 1: Tool Usage (> 95 percent threshold). Did the agent call the right tools with correct parameters?
- “Diesel vehicles from £7,000 to £20,000” should use search_vehicles with typed filters (fuel_type=diesel, min_price=7000, max_price=20000).
- “Modern hatchback with low mileage” should trigger hybrid_search, combining semantic embeddings with structured filters.
You measure this deterministically: ToolSelectionGrader checks which tools were called, TrajectoryOrderGrader verifies the call sequence.
Layer 2: Reasoning (> 85 percent threshold). Was the decision-making process logical? The HelpfulnessEvaluator and TrajectoryEvaluator from strands-agents-evals use LLM-as-judge scoring to assess whether the agent’s reasoning holds together. An agent that arrives at the right response through illogical reasoning will fail unpredictably as conditions change.
Layer 3: Output Quality (> 90 percent threshold). Was the response helpful, accurate, and actionable? The OutputEvaluator and GoalSuccessRateEvaluator from strands-agents-evals use LLM-as-judge evaluation to assess whether the user got a useful, well-formatted response.
The three layers must pass before deployment. A failure in a layer blocks the pipeline.
Handling non-determinism
Because LLM outputs vary between runs, single-trial results can be misleading. The run_all_layers() function in the companion repository accepts a num_trials parameter to address this. Two metrics from the code generation research community help measure reliability:
- pass@k measures the likelihood of succeeding at least once in k attempts. This metric is useful when finding one correct solution is sufficient.
- pass^k (pass to the power of k) measures the probability of succeeding in k consecutive trials. This metric is useful when users expect reliable behavior every time.
For customer-facing agents, pass^k matters most. An agent with a 75 percent per-trial success rate has only a 42 percent chance of passing three consecutive trials (0.75³). Users expect consistent quality on every interaction.
In the companion code, run_all_layers(task_fn, registry, num_trials=5) runs the evaluation layers with multi-trial support and gates deployment on pass^k. See the full implementation.
Test case management
Test cases are organized by category:
- Happy path: Common queries that should succeed.
- Edge cases: Ambiguous queries, slang, multi-turn refinements.
- Safety/Guardrails: Queries the agent should refuse or redirect.
When production monitoring detects an issue, that interaction becomes a new test case. Motorway’s suite grew from an initial 50 cases to 150 in three months, each grounded in real user behavior. Start with 20 to 50 cases and let production data grow the suite.
Include negative cases where the agent should *not* call certain tools. For example, a profile query should call the profile tool, not the search tool. A structured query should use structured search, not a raw SQL fallback. One-sided evals create one-sided optimization.
Multi-turn conversation testing
Single-turn evaluation misses a critical dimension: conversational coherence. Dealers naturally refine searches across multiple turns:
- Turn 1: “Find me diesel SUVs.”
- Turn 2: “Now show me only the automatics.”
- Turn 3: “What about estates instead?”
The strands-agents-evals framework provides ActorSimulator to generate realistic multi-turn interactions and InteractionsEvaluator to score context retention across turns. Multi-turn tests catch context drift, filter accumulation errors, and pronoun resolution failures that single-turn tests miss.
Monitor production behavior with AgentCore Evaluations
After you deploy your Strands Agent to Amazon Bedrock AgentCore Runtime, AgentCore Evaluations provides continuous monitoring. It integrates with Strands Agents through OpenTelemetry instrumentation (the industry-standard observability framework). Figure 3 illustrates the architecture in production, with observability traces sampled at 1–5 percent and with metrics aggregating to Amazon CloudWatch.

Two monitoring approaches
AgentCore Evaluations offers two complementary modes:
On-demand evaluation analyzes specific agent interactions by selecting spans from Amazon CloudWatch logs. This is useful for debugging issues or validating fixes.
Online evaluation automatically samples live traffic and applies evaluators in the background. Configure a sampling rate (1–5 percent is recommended), select up to 10 evaluators, and let it run.
Built-in and custom evaluators
AgentCore provides pre-configured evaluators for common scenarios. The following table shows the built-in evaluators and what they measure.
Evaluator
Level
What it measures
Builtin.Helpfulness
TRACE
How helpful the agent’s response is (0–1 score across 7 levels)
Builtin.GoalSuccessRate
SESSION
Whether the user’s overall goal was achieved
Builtin.ToolSelection
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み