Create Scenario Eval
Guide the user through creating eval test cases for a Copilot Studio plugin scenario. Evals test end-to-end scenarios with natural prompts — the request routes through sub-agents (e.g., Author agent) which invoke skills internally.
How the eval system works
The eval harness (evals/evaluate.py) works by:
- Copying a fixture agent into a temp workspace
- Running
claude -p "<prompt>" with a PreToolUse hook that traces skill invocations inside sub-agents
- Checking routing (which agents and skills were invoked), output files, and response text against deterministic checks
- Producing a JSON results file and HTML report
What can be tested right now
Authoring scenarios that produce YAML files (topics, agents, knowledge sources, etc.) are the best candidates. The harness supports these check types:
| Check |
What it validates |
Use for |
agent_invoked |
Expected sub-agent was dispatched (e.g., Author agent) |
Routing verification |
agent_not_invoked |
Unwanted sub-agents were NOT dispatched |
Routing verification |
skill_invoked |
Expected skill was invoked (traced inside sub-agents via hook) |
Skill routing |
skill_not_invoked |
Unwanted skills were NOT invoked |
Skill routing |
files_created |
Expected files were created/modified (glob pattern) |
All authoring scenarios |
schema_validate |
Full Copilot Studio schema validation (kind, required fields, IDs, Power Fx, scopes) |
All YAML-producing scenarios |
yaml_structure |
Specific YAML path has expected value, min array length, or contains string |
Structural assertions |
content_contains |
Keywords from prompt appear in output files |
Domain relevance |
no_placeholders |
No _REPLACE, TODO, or FIXME markers left |
Template completion |
stdout_contains |
CLI response text contains expected strings |
Reference/info scenarios |
stdout_not_contains |
CLI response does NOT contain error strings |
Error absence |
exit_code |
CLI exited with expected code |
All scenarios |
yaml_unchanged |
Specific file or YAML path was NOT modified |
Preservation testing |
Note: no_placeholders runs automatically when any .mcs.yml file is changed, unless explicitly set to false.
Not yet testable: Integration scenarios that call external APIs (chat-directline, manage-agent) — these need script mocking which isn't implemented yet.
Available fixtures
Fixtures are pre-built agent directories in evals/fixtures/:
- basic-agent — Minimal agent with
GenerativeActionsEnabled: false, one Greeting topic. Use for most authoring evals.
- agent-with-mcp-action — Same as basic-agent plus two MCP action files. Use for action-editing evals.
- empty-workspace — No agent files. Use for negative-path testing.
If the scenario needs a richer agent (e.g., existing topics to modify, knowledge sources, actions), note that the fixture would need to be created first.
Instructions
Identify the target scenario. If $ARGUMENTS is provided, use it as the scenario name. Otherwise ask the user what scenario they want to test (e.g., "topic creation", "agent settings", "knowledge sources").
Read relevant skill SKILL.md files to understand what the scenario covers:
Glob: skills/*/SKILL.md
Understand: What skills are involved? What YAML kinds? What files get created/modified?
Check if evals already exist:
Glob: evals/scenarios/<scenario-name>.json
If yes, read them and offer to add more test cases. Note the highest existing eval ID.
Guide the user through creating test cases. For each eval, gather:
- name: Short descriptive title (e.g., "IT support topic with OnRecognizedIntent trigger")
- prompt: A natural language prompt — what a real user would say. Do NOT prefix with "Use the X skill to...".
- fixture: Which fixture agent to use (default:
basic-agent)
- checks: What to validate about the routing and output
Help the user define checks. Based on the scenario type:
For topic-creation scenarios:
{
"agent_invoked": "copilot-studio:Copilot Studio Author",
"skill_invoked": "copilot-studio:new-topic",
"files_created": [{"pattern": "topics/*.topic.mcs.yml", "min_count": 1}],
"schema_validate": true,
"yaml_structure": [
{"path": "kind", "equals": "AdaptiveDialog"},
{"path": "beginDialog.kind", "equals": "<trigger-type>"}
],
"content_contains": ["<domain keywords>"],
"no_placeholders": true
}
For agent-settings scenarios:
{
"agent_invoked": "copilot-studio:Copilot Studio Author",
"skill_invoked": "copilot-studio:edit-agent",
"files_created": [{"pattern": "agent.mcs.yml", "min_count": 1}],
"schema_validate": true,
"yaml_structure": [
{"path": "kind", "equals": "GptComponentMetadata"}
],
"content_contains": ["<expected content>"],
"no_placeholders": true
}
For knowledge-source scenarios:
{
"agent_invoked": "copilot-studio:Copilot Studio Author",
"skill_invoked": "copilot-studio:add-knowledge",
"files_created": [{"pattern": "knowledge/*.knowledge.mcs.yml", "min_count": 1}],
"schema_validate": true,
"no_placeholders": true
}
For reference/query scenarios:
{
"stdout_contains": ["<expected content in response>"],
"exit_code": 0
}
Recommend at least 3 test cases that cover different possibilities within the scenario. For example, for topic-creation:
- Different trigger types (OnRecognizedIntent, OnConversationStart, OnUnknownIntent)
- Different complexity levels (simple message, multi-step with questions, branching)
- Edge cases (empty workspace refusal)
Write the scenario JSON file:
Write: evals/scenarios/<scenario-name>.json
Format:
{
"scenario_name": "<scenario-name>",
"evals": [
{
"id": 1,
"name": "<short descriptive title>",
"prompt": "<natural language request — what a user would say>",
"fixture": "basic-agent",
"mock_scripts": [],
"checks": { ... }
}
]
}
Tell the user how to run the evals:
python3 evals/evaluate.py --scenario <scenario-name> --verbose
Or for all scenarios: node evals/run.js
To generate the HTML report: python3 evals/report.py evals/results/<timestamp>/
Important guidelines
- Prompts must be natural language — write what a real user would say, not "Use the X skill to..."
- Include
agent_invoked and skill_invoked checks to verify correct routing
- Keep prompts specific enough that checks can be deterministic (mention exact names, values, counts)
- Use
schema_validate: true for ALL scenarios that produce YAML — it's the most powerful check
content_contains keywords should come directly from the prompt to verify domain relevance
- Don't create evals for deprecated skills (chat-with-agent, directline-chat)
- Eval IDs must be unique integers within a scenario's JSON
1---2name: create-eval3description: Create plugin development eval scenarios (JSON files with natural prompts and deterministic checks for testing plugin skills). NOT for Copilot Studio in-product evaluation — use /copilot-studio:create-eval-set for that.4---56# Create Scenario Eval78Guide the user through creating eval test cases for a Copilot Studio plugin scenario. Evals test end-to-end scenarios with natural prompts — the request routes through sub-agents (e.g., Author agent) which invoke skills internally.910## How the eval system works1112The eval harness (`evals/evaluate.py`) works by:131. Copying a **fixture agent** into a temp workspace142. Running `claude -p "<prompt>"` with a PreToolUse hook that traces skill invocations inside sub-agents153. Checking **routing** (which agents and skills were invoked), **output files**, and **response text** against deterministic checks164. Producing a JSON results file and HTML report1718## What can be tested right now1920**Authoring scenarios** that produce YAML files (topics, agents, knowledge sources, etc.) are the best candidates. The harness supports these check types:2122| Check | What it validates | Use for |23|-------|------------------|---------|24| `agent_invoked` | Expected sub-agent was dispatched (e.g., Author agent) | Routing verification |25| `agent_not_invoked` | Unwanted sub-agents were NOT dispatched | Routing verification |26| `skill_invoked` | Expected skill was invoked (traced inside sub-agents via hook) | Skill routing |27| `skill_not_invoked` | Unwanted skills were NOT invoked | Skill routing |28| `files_created` | Expected files were created/modified (glob pattern) | All authoring scenarios |29| `schema_validate` | Full Copilot Studio schema validation (kind, required fields, IDs, Power Fx, scopes) | All YAML-producing scenarios |30| `yaml_structure` | Specific YAML path has expected value, min array length, or contains string | Structural assertions |31| `content_contains` | Keywords from prompt appear in output files | Domain relevance |32| `no_placeholders` | No `_REPLACE`, `TODO`, or `FIXME` markers left | Template completion |33| `stdout_contains` | CLI response text contains expected strings | Reference/info scenarios |34| `stdout_not_contains` | CLI response does NOT contain error strings | Error absence |35| `exit_code` | CLI exited with expected code | All scenarios |36| `yaml_unchanged` | Specific file or YAML path was NOT modified | Preservation testing |3738Note: `no_placeholders` runs automatically when any `.mcs.yml` file is changed, unless explicitly set to `false`.3940**Not yet testable**: Integration scenarios that call external APIs (chat-directline, manage-agent) — these need script mocking which isn't implemented yet.4142## Available fixtures4344Fixtures are pre-built agent directories in `evals/fixtures/`:4546- **basic-agent** — Minimal agent with `GenerativeActionsEnabled: false`, one Greeting topic. Use for most authoring evals.47- **agent-with-mcp-action** — Same as basic-agent plus two MCP action files. Use for action-editing evals.48- **empty-workspace** — No agent files. Use for negative-path testing.4950If the scenario needs a richer agent (e.g., existing topics to modify, knowledge sources, actions), note that the fixture would need to be created first.5152## Instructions53541. **Identify the target scenario.** If `$ARGUMENTS` is provided, use it as the scenario name. Otherwise ask the user what scenario they want to test (e.g., "topic creation", "agent settings", "knowledge sources").55562. **Read relevant skill SKILL.md files** to understand what the scenario covers:57 ```58 Glob: skills/*/SKILL.md59 ```60 Understand: What skills are involved? What YAML kinds? What files get created/modified?61623. **Check if evals already exist:**63 ```64 Glob: evals/scenarios/<scenario-name>.json65 ```66 If yes, read them and offer to add more test cases. Note the highest existing eval ID.67684. **Guide the user through creating test cases.** For each eval, gather:6970 - **name**: Short descriptive title (e.g., "IT support topic with OnRecognizedIntent trigger")71 - **prompt**: A natural language prompt — what a real user would say. Do NOT prefix with "Use the X skill to...".72 - **fixture**: Which fixture agent to use (default: `basic-agent`)73 - **checks**: What to validate about the routing and output74755. **Help the user define checks.** Based on the scenario type:7677 For **topic-creation scenarios**:78 ```json79 {80 "agent_invoked": "copilot-studio:Copilot Studio Author",81 "skill_invoked": "copilot-studio:new-topic",82 "files_created": [{"pattern": "topics/*.topic.mcs.yml", "min_count": 1}],83 "schema_validate": true,84 "yaml_structure": [85 {"path": "kind", "equals": "AdaptiveDialog"},86 {"path": "beginDialog.kind", "equals": "<trigger-type>"}87 ],88 "content_contains": ["<domain keywords>"],89 "no_placeholders": true90 }91 ```9293 For **agent-settings scenarios**:94 ```json95 {96 "agent_invoked": "copilot-studio:Copilot Studio Author",97 "skill_invoked": "copilot-studio:edit-agent",98 "files_created": [{"pattern": "agent.mcs.yml", "min_count": 1}],99 "schema_validate": true,100 "yaml_structure": [101 {"path": "kind", "equals": "GptComponentMetadata"}102 ],103 "content_contains": ["<expected content>"],104 "no_placeholders": true105 }106 ```107108 For **knowledge-source scenarios**:109 ```json110 {111 "agent_invoked": "copilot-studio:Copilot Studio Author",112 "skill_invoked": "copilot-studio:add-knowledge",113 "files_created": [{"pattern": "knowledge/*.knowledge.mcs.yml", "min_count": 1}],114 "schema_validate": true,115 "no_placeholders": true116 }117 ```118119 For **reference/query scenarios**:120 ```json121 {122 "stdout_contains": ["<expected content in response>"],123 "exit_code": 0124 }125 ```1261276. **Recommend at least 3 test cases** that cover different possibilities within the scenario. For example, for topic-creation:128 - Different trigger types (OnRecognizedIntent, OnConversationStart, OnUnknownIntent)129 - Different complexity levels (simple message, multi-step with questions, branching)130 - Edge cases (empty workspace refusal)1311327. **Write the scenario JSON file:**133 ```134 Write: evals/scenarios/<scenario-name>.json135 ```136137 Format:138 ```json139 {140 "scenario_name": "<scenario-name>",141 "evals": [142 {143 "id": 1,144 "name": "<short descriptive title>",145 "prompt": "<natural language request — what a user would say>",146 "fixture": "basic-agent",147 "mock_scripts": [],148 "checks": { ... }149 }150 ]151 }152 ```1531548. **Tell the user how to run the evals:**155 ```156 python3 evals/evaluate.py --scenario <scenario-name> --verbose157 ```158 Or for all scenarios: `node evals/run.js`159160 To generate the HTML report: `python3 evals/report.py evals/results/<timestamp>/`161162## Important guidelines163164- Prompts must be **natural language** — write what a real user would say, not "Use the X skill to..."165- Include `agent_invoked` and `skill_invoked` checks to verify correct routing166- Keep prompts specific enough that checks can be deterministic (mention exact names, values, counts)167- Use `schema_validate: true` for ALL scenarios that produce YAML — it's the most powerful check168- `content_contains` keywords should come directly from the prompt to verify domain relevance169- Don't create evals for deprecated skills (chat-with-agent, directline-chat)170- Eval IDs must be unique integers within a scenario's JSON