m365-agent-evaluator
microsoft/skills
使用 @microsoft/m365-copilot-eval CLI 為 Microsoft 365 Copilot 聲明式代理程式建立、執行及分析評估套件。
...展開全部M365 代理程式評估工具
使用此技能協助使用者透過@microsoft/m365-copilot-eval 評估 Microsoft 365 Copilot 宣告式代理程式。此技能會設計符合架構規範的評估資料集、執行公開預覽版 CLI、分析結果,並建議針對性的修正方案。
若偵測到 Microsoft 365 Agents Toolkit (ATK) 專案,則預設使用該專案;但不會僅因當前目錄非 ATK 專案而強制中止執行。該 CLI 亦可透過明確指定M365_AGENT_ID或--m365-agent-id 參數,來評估已部署的代理程式。
請始終使用以下 CLI 呼叫方式
npx -y --package @microsoft/m365-copilot-eval@latest runevals
不建議使用舊版的私有aka.ms安裝程式、全域安裝、未指定參數的runevals、未指定參數的npx runevals,以及--input 或--html 參數。
啟用工作流程
- 確定使用者目標:設定、資料集建立、執行評估、分析結果,或更新現有的評估套件。
- 僅載入當前目標所需的參考資料:
references/workflow.md:用於端到端操作員工作流程及 CLI 指令。references/azure-setup.md:用於查閱先決條件、環境設定檔及機密資訊處理。references/eval-templates.md:用於建立或編輯評估資料集。references/pra-framework.md:用於決定要生成哪些情境。- 當 JSON/CSV/HTML 結果產生後,請參閱
references/result-analysis.md。 references/guardrails.md:在寫入檔案、處理機密資訊、清除快取、登出或進行疑難排解之前。
- 偵測專案結構:
- ATK:
.env.local、.env.local.user、env\.env.local.user、m365agents.yml或appPackage\declarativeAgent.json。 - 非 ATK:一個 eval 資料集加上
M365_AGENT_ID、--m365-agent-id,或一個命名環境檔案(例如env\.env.dev)。
- ATK:
- 在不洩露數值的情況下驗證先決條件:
- Node.js 24.12.0 或更新版本。
- Microsoft 365 Copilot 授權及已部署的 M365 Copilot 代理程式。
- 租戶管理員對 WorkIQ Client App 的同意。
TENANT_ID、Foundry Models 中的 Azure OpenAI 端點/金鑰,以及建議/預設的gpt-4o-mini部署。
- 選擇工作流程:
- 無資料集:建立
evals\evals.json。 - 已有資料集:執行、分析先前結果或提出變更建議。
- 快速檢查:使用內嵌提示字串。
- 探索:使用互動模式。
- 無資料集:建立
當前資料集合約
產生包含根項目陣列的1.2.0版本模式文件。請勿產生舊版PromptsObject或根提示格式。
最小結構:
{
"schemaVersion": "1.2.0",
"metadata": {
"name": "Agent evaluation suite",
"tags": ["starter"]
},
"default_evaluators": {
"Relevance": {},
"Coherence": {}
},
"items": [
{
"prompt": "這個代理程式能幫我做什麼?",
"expected_response": "該代理程式會說明其支援的範圍,且不會虛構未支援的功能。"
}
]
}
請使用references\prompts-schema.json作為本地模式來源,並參考references\eval-templates.md中的可複製範例,包含單輪對話、多輪對話、評估器及閾值設定等範例。
公開的評估器名稱
評估器的名稱會區分大小寫。除非有較新的權威來源證明否則,否則僅使用公開的可配置評估器名稱。
| 評估器 | 語義 |
|---|---|
相關性 |
1 至 5 分的 LLM 分數;預設閾值為 3。 |
連貫性 |
LLM 分數範圍為 1 至 5;預設閾值為 3。 |
實證性 |
根據上下文/預期證據評定的 LLM 分數,範圍為 1 至 5;預設閾值為 3。 |
相似度 |
相較於預期回應 (expected_response) 的 LLM 分數範圍為 1 至 5;預設閾值為 3。 |
引用 |
基於計數的引用檢查;預設閾值為 1。 |
完全匹配 |
布林值精確字串比對。 |
PartialMatch |
字串相似度範圍為 0.0 至 1.0;預設閾值為 0.5。 |
將ToolCallAccuracy視為撰寫時的舊版/私有功能。除非當前的公開 CLI/架構文件明確重新引入此功能,否則請勿將其加入生成的資料集。
常用指令
# 版本/說明檢查
npx -y --package @microsoft/m365-copilot-eval@latest runevals --version
npx -y --package @microsoft/m365-copilot-eval@latest runevals --help
# 首次設定 / 最終用戶授權協議 (EULA)
npx -y --package @microsoft/m365-copilot-eval@latest runevals accept-eula
npx -y --package @microsoft/m365-copilot-eval@latest runevals --init-only
# 批次執行並明確輸出 JSON 格式
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --output .evals\results.json
# 適合人工審閱的 HTML 或適合試算表使用的 CSV
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --output .evals\results.html
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --output .evals\results.csv
# 快速檢查
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts "你能幫我什麼忙?" --expected "代理會描述其支援的範圍。"
# 非 ATK 或指定環境
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --m365-agent-id --env dev
僅將--concurrency參數設定為 1 至 5 之間的數值。調試時請先從1開始,並僅在設定穩定後才逐步增加。
版本與 PATH 安全性
在診斷代理程式行為之前,請先確認正在執行的可執行檔為何:
Get-Command runevals -All
npm list -g @microsoft/m365-copilot-eval --depth=0
npm view @microsoft/m365-copilot-eval version
npx -y --package @microsoft/m365-copilot-eval@latest runevals --version
npx -y --package @microsoft/m365-copilot-eval@latest 其中 runevals
若僅執行 runevals即顯示「此版本的 M365 Evals CLI 已停止運作且必須更新」,請將其視為過期的 PATH/全域安裝。 請使用上述npx --package ...@latest指令重新執行,然後在執行npm uninstall -g @microsoft/m365-copilot-eval 移除全域 shims 之前,系統會先詢問是否確定。
檔案命名規範
| 路徑 | 用途 |
|---|---|
.env.local |
非機密的 ATK 設定,例如M365_TITLE_ID。 |
.env.local.user或env\.env.local.user |
本機機密資料,例如租戶 ID 和 Azure OpenAI 金鑰。 |
env\.env. |
針對非 ATK 或明確使用--env的工作流程所命名的環境設定。 |
evals\evals.json |
若使用者希望將其提交至版本控制系統,則為受版本控制的 eval 資料集。 |
.evals\ |
本機執行輸出;通常會被 Git 忽略。 |
除非使用者明確要求並確認資料可安全分享,否則絕不輸出或提交機密資訊、包含敏感資料的提示字串、檢索到的內容、除錯日誌或原始結果檔案。
生成指引
將 PRA 作為情境設計框架:
- 感知:檢索、情境錨定與來源覆蓋。
- 推理:指令遵循度、合成能力、模糊性處理及拒絕行為。
- 行動:聲明之能力/行動行為。請使用公開評估器(如
Relevance、Coherence、Similarity、ExactMatch或PartialMatch)進行評分;請勿使用舊版ToolCallAccuracy。
覆寫現有資料集前請先確認。撰寫生成之評估結果時,請先寫入臨時檔案,並於成功後重新命名。
結果分析指引
僅分析實際存在的評分器鍵值。若缺少評分鍵值,通常表示該評分器未針對該項目進行配置,而非表示評分失敗。
若有現有評分鍵,請使用:相關性、連貫性、實證性、相似性、引用、完全匹配及部分匹配。將失敗案例歸類至可能的根本原因:指令問題、實證問題、引用問題、預期答案不符、能力差距、授權/環境問題,或評估品質問題。
除非使用者已提供或核准必要的租戶、代理程式及 Azure OpenAI 設定,否則請勿執行真正的租戶相關評估。
---
name: m365-agent-evaluator
description: Create, run, and analyze evaluation suites for Microsoft 365 Copilot declarative agents using the @microsoft/m365-copilot-eval CLI.
---
# M365 Agent Evaluator
Use this skill to help users evaluate Microsoft 365 Copilot declarative agents with `@microsoft/m365-copilot-eval`. The skill designs schema-compatible eval datasets, runs the public preview CLI, analyzes results, and recommends targeted fixes.
Default to Microsoft 365 Agents Toolkit (ATK) projects when detected, but do not hard-stop solely because the current directory is not ATK. The CLI can also evaluate deployed agents with an explicit `M365_AGENT_ID` or `--m365-agent-id`.
## Always use this CLI invocation
```powershell
npx -y --package @microsoft/m365-copilot-eval@latest runevals
```
Do not recommend the old private `aka.ms` installer, global installs, bare `runevals`, bare `npx runevals`, `--input`, or `--html`.
## Activation workflow
1. Identify the user goal: setup, dataset authoring, running evals, analyzing results, or updating an existing eval suite.
2. Load only the reference needed for the current goal:
- `references/workflow.md` for the end-to-end operator workflow and CLI commands.
- `references/azure-setup.md` for prerequisites, env files, and secret handling.
- `references/eval-templates.md` when creating or editing eval datasets.
- `references/pra-framework.md` when deciding what scenarios to generate.
- `references/result-analysis.md` after JSON/CSV/HTML results exist.
- `references/guardrails.md` before writing files, handling secrets, clearing cache, signing out, or troubleshooting.
3. Detect project shape:
- ATK: `.env.local`, `.env.local.user`, `env\.env.local.user`, `m365agents.yml`, or `appPackage\declarativeAgent.json`.
- Non-ATK: an eval dataset plus `M365_AGENT_ID`, `--m365-agent-id`, or a named environment file such as `env\.env.dev`.
4. Verify prerequisites without exposing values:
- Node.js 24.12.0 or newer.
- Microsoft 365 Copilot license and a deployed M365 Copilot agent.
- Tenant admin consent for the WorkIQ Client App.
- `TENANT_ID`, Azure OpenAI in Foundry Models endpoint/key, and recommended/default `gpt-4o-mini` deployment.
5. Choose the workflow:
- No dataset: create `evals\evals.json`.
- Existing dataset: run, analyze prior results, or propose changes.
- Quick check: use inline prompts.
- Exploration: use interactive mode.
## Current dataset contract
Generate schema version `1.2.0` documents with a root `items` array. Do not generate the old `PromptsObject` or root `prompts` format.
Minimum shape:
```json
{
"schemaVersion": "1.2.0",
"metadata": {
"name": "Agent evaluation suite",
"tags": ["starter"]
},
"default_evaluators": {
"Relevance": {},
"Coherence": {}
},
"items": [
{
"prompt": "What can this agent help me with?",
"expected_response": "The agent explains its supported scope without inventing unsupported capabilities."
}
]
}
```
Use `references\prompts-schema.json` as the local schema source and `references\eval-templates.md` for copyable single-turn, multi-turn, evaluator, and threshold examples.
## Public evaluator names
Evaluator names are case-sensitive. Use only the public configurable evaluator names unless a newer authoritative source proves otherwise.
| Evaluator | Semantics |
|---|---|
| `Relevance` | LLM score from 1-5; default threshold 3. |
| `Coherence` | LLM score from 1-5; default threshold 3. |
| `Groundedness` | LLM score from 1-5 against `context`/expected evidence; default threshold 3. |
| `Similarity` | LLM score from 1-5 against `expected_response`; default threshold 3. |
| `Citations` | Count-based citation check; default threshold 1. |
| `ExactMatch` | Boolean exact string match. |
| `PartialMatch` | String similarity from 0.0-1.0; default threshold 0.5. |
Treat `ToolCallAccuracy` as legacy/private for authoring. Do not add it to generated datasets unless current public CLI/schema documentation explicitly reintroduces it.
## Common commands
```powershell
# Version/help checks
npx -y --package @microsoft/m365-copilot-eval@latest runevals --version
npx -y --package @microsoft/m365-copilot-eval@latest runevals --help
# First-time setup / EULA
npx -y --package @microsoft/m365-copilot-eval@latest runevals accept-eula
npx -y --package @microsoft/m365-copilot-eval@latest runevals --init-only
# Batch run with explicit JSON output
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --output .evals\results.json
# Human-review HTML or spreadsheet-friendly CSV
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --output .evals\results.html
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --output .evals\results.csv
# Quick checks
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts "What can you help me with?" --expected "The agent describes its supported scope."
# Non-ATK or named environment
npx -y --package @microsoft/m365-copilot-eval@latest runevals --prompts-file evals\evals.json --m365-agent-id <agent-id> --env dev
```
Use `--concurrency` only with values 1-5. Start with `1` for debugging and increase only after setup is stable.
## Version and PATH safety
Before diagnosing agent behavior, confirm which executable is running:
```powershell
Get-Command runevals -All
npm list -g @microsoft/m365-copilot-eval --depth=0
npm view @microsoft/m365-copilot-eval version
npx -y --package @microsoft/m365-copilot-eval@latest runevals --version
npx -y --package @microsoft/m365-copilot-eval@latest where runevals
```
If bare `runevals` prints `This version of the M365 Evals CLI has stopped working and must be updated`, treat it as a stale PATH/global install. Re-run with the `npx --package ...@latest` command above, then ask before removing global shims with `npm uninstall -g @microsoft/m365-copilot-eval`.
## File conventions
| Path | Purpose |
|---|---|
| `.env.local` | Non-secret ATK config such as `M365_TITLE_ID`. |
| `.env.local.user` or `env\.env.local.user` | Local secrets such as tenant ID and Azure OpenAI key. |
| `env\.env.<environment>` | Named environment config for non-ATK or explicit `--env` workflows. |
| `evals\evals.json` | Source-controlled eval dataset if the user wants it committed. |
| `.evals\` | Local run outputs; usually gitignored. |
Never print or commit secrets, prompts containing sensitive data, retrieved content, debug logs, or raw result files unless the user explicitly asks and confirms the data is safe to share.
## Generation guidance
Use PRA as a scenario-design framework:
- Perceive: retrieval, grounding, and source coverage.
- Reason: instruction adherence, synthesis, ambiguity handling, and refusal behavior.
- Act: declared capability/action behavior. Score with public evaluators such as `Relevance`, `Coherence`, `Similarity`, `ExactMatch`, or `PartialMatch`; do not use legacy `ToolCallAccuracy`.
Ask before overwriting an existing dataset. When writing generated evals, write to a temporary file first and rename on success.
## Result analysis guidance
Analyze only evaluator keys that are present. Missing score keys usually mean the evaluator was not configured for that item, not that it failed.
Use current score keys when present: `relevance`, `coherence`, `groundedness`, `similarity`, `citations`, `exactMatch`, and `partialMatch`. Group failures into likely root causes: instruction issue, grounding issue, citation issue, expected-answer mismatch, capability gap, auth/environment issue, or eval-quality issue.
Do not run real tenant-dependent evals unless the user has provided or approved the necessary tenant, agent, and Azure OpenAI configuration.
所有檔案
17 個檔案安裝 m365-agent-evaluator
請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。
下載 ZIP複製儲存庫並將技能檔案複製到您的專案中。
git clone https://github.com/microsoft/skills/tree/main/.github/plugins/microsoft-365-agents-toolkit/skills/m365-agent-evaluator # Copy SKILL.md to your .claude/skills/ directory
複製





首頁
