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:用于决定要生成哪些场景。references/result-analysis.md:用于处理生成的 JSON/CSV/HTML 结果。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 客户端应用的同意。
TENANT_ID、Foundry Models 中的 Azure OpenAI 端点/密钥,以及推荐/默认的gpt-4o-mini部署。
- 选择工作流:
- 无数据集:创建
evals\evals.json。 - 已有数据集:运行、分析先前结果或提出修改建议。
- 快速检查:使用内联提示词。
- 探索:使用交互模式。
- 无数据集:创建
当前数据集契约
生成包含根项数组的1.2.0版本模式文档。不要生成旧版PromptsObject或根提示格式。
最小结构:
{
"schemaVersion": "1.2.0",
"metadata": {
"name": "智能体评估套件",
"tags": ["starter"]
},
"default_evaluators": {
"Relevance": {},
"Coherence": {}
},
"items": [
{
"prompt": "这个智能代理能帮我做什么?",
"expected_response": "智能代理应说明其支持的范围,且不虚构不支持的功能。"
}
]
}
请使用references\prompts-schema.json作为本地模式源,并参考references\eval-templates.md获取可复用的单轮、多轮对话、评估器及阈值示例。
公开的评估器名称
评估器名称区分大小写。除非有更新的权威来源证明否则,否则仅使用公开的可配置评估器名称。
| 评估器 | 语义 |
|---|---|
相关性 |
LLM评分范围为1-5;默认阈值为3。 |
连贯性 |
LLM评分范围为1-5;默认阈值为3。 |
依据性 |
LLM评分范围为1-5,基于上下文/预期证据;默认阈值为3。 |
相似度 |
与预期响应相比的LLM评分(1-5分);默认阈值为3。 |
引用 |
基于计数的引用检查;默认阈值为1。 |
ExactMatch |
布尔精确字符串匹配。 |
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
# 首次设置 / 最终用户许可协议
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 where runevals
如果仅运行 runevals时显示“此版本的 M365 Evals CLI 已停止工作,必须进行更新”,则将其视为过时的 PATH/全局安装。 请使用上述npx --package ...@latest命令重新运行,随后在通过npm uninstall -g @microsoft/m365-copilot-eval 移除全局 shim 之前,系统会进行确认。
文件命名规范
| 路径 | 用途 |
|---|---|
.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用作场景设计框架:
- 感知:检索、关联及来源覆盖。
- 推理:指令遵循、综合生成、歧义处理和拒绝行为。
- 行动:声明的能力/动作行为。使用
相关性、连贯性、相似度、精确匹配或部分匹配等公开评估器进行评分;请勿使用旧版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
复制





首页
