Mastra、マルチターン評価機能でエージェントの会話精度を検証可能に
本文の状態
日本語全文を表示中
詳細モードで約3分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Mastra Blog
Mastra は新機能「Multi-turn Evals」を導入し、ツール呼び出しなどの確定的なアクションをゲートで検証するとともに、LLM をジャッジとして活用して会話文脈の正確性をスコアリングできる機能を公開した。
AI深層分析を開く2026年8月25日 01:21
AI深層分析
キーポイント
多ターン評価機能の導入
Mastra は単発の評価ではなく、会話全体の文脈や正確性を LLM をジャッジとして用いて評価する機能を追加し、開発者が一連の対話を包括的に検証できるようになった。
ゲートとスコアラーの統合
ツール呼び出しなどの確定的アクションを検証する「gates」と、会話の質を点数化する「scorers」を同時に使用可能にし、複雑な評価ロジックを簡素化した。
メモリ設定の要件
多ターン評価を実行するには、各ラウンドが過去の対話履歴を観察できる有効なメモリ構成が必要であり、これが機能の前提条件となっている。
@mastra/evalsパッケージのインストール
Multi-turn Evals機能を利用するには、@mastra/coreと@mastra/evalsをnpm installでインストールする必要がある。
評価実行に必要な要件バージョン
この機能はPR #21930で追加され、@mastra/coreのバージョンが1.61.0以降であることが必須条件となる。
重要な引用
gates assert deterministic actions like tool calls, and scorers can use an LLM-as-judge to grade the conversational context for accuracy.
With multi-turn, the judge uses a criterion to score the whole conversation, and gates can be used to bulk-assert deterministic actions.
Multi-turn assertions take an inputs array, and gates apply to the whole run.
Per-turn assertions can be configured using a turns array where each turn declares its own gates and scorers, and an optional threshold to be met:
編集コメントを表示
編集コメント
この機能は、複雑化する AI エージェントの品質保証において、単発の評価から包括的な評価への転換を促す重要なステップである。開発者は、会話履歴を保持するメモリ設定の重要性を再認識し、本機能を活用してより堅牢なエージェントの構築を進めるべきだ。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
今や、multi-turn 評価機能を使って会話全体を検証できるようになりました。ゲートはツール呼び出しなどの決定論的なアクションを確認し、スコアラーは LLM-as-judge を活用して対話の文脈が正確かどうかを採点します。
runEvals では gates と scorers の両方を指定できます。
gates:calledTool、includes、またはexcludesといったクイックチェックを利用して、結果として0または1を返すことができます。
scorers: 会話全体を評価するために、multi-turn ジューサーのようなマルチターン対応の組み込みスコアラーを使用し、対話に対してscoreとreasonを返すことができます。
また、特定の単語が含まれているかをテストするために scorers を使用したクイックチェックも可能です。runEvals を利用すれば、1 回ごとの評価と複数回の評価 を同時に実行できます。 (原文の技術表記: includes)
お使いのブラウザは動画タグをサポートしていません。
マルチターン評価が登場する前は、会話の評価とは各ターンごとに「ゲート」と「スコアラー」を設定し、その結果を結合して全体のやり取りについて推論を行うことを意味していました。一方、マルチターンでは、ジャッジが「基準(criterion)」を用いて会話全体にスコアを付けます。また、ゲートは決定的なアクションを一括で検証するために使用できます。例として、 (原文の技術表記: gates、scorers)
checks.calledTool("get_weather", { times: 3 }).
マルチターン評価を利用するには、各ターンで過去のランニング結果を観測できるよう、エージェントに有効な メモリ 設定が必要です。
はじめに
必要な Mastra コアと評価パッケージをインストールします。
npm install @mastra/core @mastra/evals
注意
@mastra/core@1.61.0 以降が必要です。これは PR #21930 で追加されました。 (原文の技術表記: @mastra/core@1.61.0)
マルチターンアサーションでは、inputs 配列を受け取り、gates は実行全体に適用されます。会話の評価には、判定器スコアラーに criterion を与えてください。
しきい値(threshold)を指定して、その基準を満たすかどうかを確認することも可能です。
import { runEvals } from "@mastra/core/evals";
import { checks } from "@mastra/evals/checks";
import { createMultiTurnJudgeScorer } from "@mastra/evals/scorers/prebuilt";
import { travelAgent } from "../agents/travel-agent";
const result = await runEvals({
target: travelAgent,
data: [
{
inputs: [
"I'm planning a 3-city trip next week — London, Paris, and Tokyo.",
"How's the weather looking in London?",
"And Paris?"
// ...
]
}
],
gates: [checks.calledTool("get_weather", { times: 3 })],
scorers: [
{
scorer: createMultiTurnJudgeScorer({
model: "anthropic/claude-haiku-4-5",
criterion: "The agent provided weather forecasts for London, Paris, and Tokyo, and gave weather-appropriate packing or clothing advice."
}),
threshold: 1
}
],
onItemComplete: ({ scorerResults }) => {
const judge = scorerResults?.["multi-turn-judge-scorer"];
if (judge?.reason) console.log(judge.reason);
}
});
Per-turn assertions can be configured using a turns array where each turn declares its own gates and scorers, and an optional threshold to be met:
const result = await runEvals({
// ...
data: [
{
turns: [
{ input: "I'm planning a 3-city trip next week — London, Paris, and Tokyo." },
{
input: "How's the weather looking in London?",
gates: [checks.calledTool("get_weather", { times: 1 })],
scorers: [{ scorer: checks.includes("London"), threshold: 1 }]
},
{
input: "And Paris?",
gates: [checks.calledTool("get_weather", { times: 1 })],
scorers: [{ scorer: checks.includes("Paris"), threshold: 1 }]
}
// ...
]
}
]
});詳細情報および設定オプションについては、以下のドキュメントをご覧ください。
- マルチターン評価
- マルチターンジャッジスコアラー
- クイックチェック
- runEvals() リファレンス](https://mastra.ai/reference/evals/run-evals)
- ゲートと判定
- 組み込みスコアラー
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み