1
---
2
name: copilot-studio-agent-documenter
3
description: Generate comprehensive documentation for Microsoft Copilot Studio agents from exported Dataverse solutions using the Power Platform CLI. Use when asked, to analyse the solution with the agents file and create documentation from the contents.
4
---
5
6
# Copilot Studio Agent Documentor
7
8
To generate documentation in a single file, follow this process, using the sections below to analyse and structure the agents within the /Agents/ folder in this repo.
9
10
## When to Use This Skill
11
12
- User requests documentation for an agent in `Agents/<AgentName>/`
13
- Analyzing agent capabilities, topics, and integrations
14
- Creating markdown documentation output in `Docs/Agents/` folder
15
16
## Step-by-Step Workflows
17
18
### 1. Identify Agent Structure
19
```bash
20
# Locate the agent solution
21
ls Agents/<AgentName>/src/bots/
22
23
# List all bot components
24
ls Agents/<AgentName>/src/botcomponents/
25
```
26
27
### 2. Extract Agent Metadata
28
Read key files in this order:
29
1. `Agents/<AgentName>/src/Other/Solution.xml` - Publisher, version, solution name
30
2. `Agents/<AgentName>/src/bots/<prefix>_<agentname>/bot.xml` - Agent metadata
31
3. `Agents/<AgentName>/src/bots/<prefix>_<agentname>/configuration.json` - Agent configuration
32
33
### 3. Document Agent Components
34
35
#### Topics (Conversation Flows)
36
- Pattern: `botcomponents/<prefix>_<agent>.topic.<TopicName>/`
37
- Read `botcomponent.xml` for topic name and state
38
- Check `data` file for conversation logic (if present)
39
- Document standard topics: ConversationStart, Greeting, Fallback, Escalate, OnError
40
- Highlight custom topics (non-standard names)
41
42
#### GPT Instructions
43
- Pattern: `botcomponents/<prefix>_<agent>.gpt.default/`
44
- Extract AI instructions from `data` file
45
- Document the agent's generative capabilities and system prompt
46
47
#### Connector Actions
48
- Pattern: `botcomponents/<prefix>_<agent>.action.<Connector-Operation>/`
49
- Example: `.action.ServiceNow-GetRecord`, `.action.ServiceNow-Orderitem`
50
- List all external actions the agent can perform
51
- Cross-reference with `Assets/botcomponent_connectionreferenceset.xml`
52
53
#### Multi-Agent Orchestration
54
- Pattern: `botcomponents/<prefix>_<agent>.InvokeConnectedAgentTaskAction.<ChildAgent>/`
55
- Document agent-to-agent handoffs
56
- Map parent agents to their specialized sub-agents
57
- Orchestration uses `InvokeConnectedAgentTaskAction` components to route conversations.
58
59
#### Test Phrases (Evaluation Sets)
60
- Pattern: `botcomponents/mspva_<GUID>/botcomponent.xml` with `<category>Testing</category>`
61
- Component type: `<componenttype>19</componenttype>`
62
- Extract test phrases from `<description>` or `<name>` elements
63
- These are sample questions/prompts used to evaluate agent responses
64
- Group test phrases by parent agent (`<parentbotid>`)
65
- Document which agent or topic each test phrase targets
66
67
### 4. Document Components and External Integrations
68
69
### File Structure (per component)
70
```
71
botcomponents/<componentschema>/
72
├── botcomponent.xml # Metadata (name, parent, state)
73
└── data # Optional binary/additional data
74
```
75
76
### Solution Metadata
77
- `Other/Solution.xml` - Publisher, version, localization settings
78
- `Assets/botcomponent_*.xml` - Cross-cutting configuration sets
79
- Schema name → physical folder name mapping is 1:1
80
81
#### Connection References
82
Read `Agents/<AgentName>/src/Other/Customizations.xml`:
83
- Extract `<connectionreference>` elements
84
- Document `connectorid` (e.g., `/providers/Microsoft.PowerApps/apis/shared_service-now`)
85
- Note connection display names
86
87
#### Knowledge Sources
88
Read `Agents/<AgentName>/src/unstructuredfilesearchentities/*.meta.xml`:
89
- Extract `<sourceurl>` values (external API endpoints)
90
- Document knowledge source types (`<knowledgesource>` codes)
91
92
#### Dataverse Tables and Entities
93
Agents may include Dataverse table search capabilities for querying business data. These are found in:
94
- `Agents/<AgentName>/src/dvtablesearchs/` - Search configurations
95
- `Agents/<AgentName>/src/dvtablesearchentities/` - Entity/table mappings
96
97
98
99
**Relationship Structure:**
100
1. Each `dvtablesearch.xml` defines a search configuration with a unique `<dvtablesearchid>`
101
2. Each `dvtablesearchentity.xml` links to a search via `<dvtablesearchid>` and specifies the `<entitylogicalname>` (table)
102
3. Multiple entities can be associated with a single search configuration
103
104
**Analysis Process:**
105
106
To find Dataverse table searches:
107
108
```bash
109
# Find all Dataverse table searches
110
ls Agents/<AgentName>/src/dvtablesearchs/
111
112
# Find all entity mappings
113
ls Agents/<AgentName>/src/dvtablesearchentities/
114
```
115
116
For each dvtablesearch:
117
1. Read `dvtablesearchs/<guid>/dvtablesearch.xml` - Extract search name and ID
118
2. Find related entities by searching for the `dvtablesearchid` in dvtablesearchentities
119
3. Read each `dvtablesearchentities/<guid>/dvtablesearchentity.xml` - Extract entity logical name and display name
120
121
**Generate ERD Diagram:**
122
Create a Mermaid entity-relationship diagram showing:
123
- Tables/entities involved in the search
124
- Relationships between search configurations and entities
125
- Entity attributes when available
126
127
```mermaid
128
erDiagram
129
DvTableSearch ||--o{ DvTableSearchEntity : "configures"
130
DvTableSearchEntity ||--|| DataverseTable : "queries"
131
132
DvTableSearch {
133
guid dvtablesearchid PK
134
string name
135
int searchtype
136
}
137
138
DvTableSearchEntity {
139
guid dvtablesearchentityid PK
140
guid dvtablesearchid FK
141
string entitylogicalname
142
string name
143
}
144
145
DataverseTable {
146
string entitylogicalname PK
147
string displayname
148
}
149
```
150
151
**Example Mapping:**
152
- Search: `PeopleonAccount_Account_sKtInwp9Jyd91zLl63PSV` (ID: c5010e77-c900-4bf1-898d-c4c0ab9eed30)
153
- Entity: `account` (Account table)
154
155
### 5. Extract Test Phrases for Evaluation
156
157
Search for bot components with `<category>Testing</category>`:
158
```bash
159
grep -r "<category>Testing</category>" Agents/<AgentName>/src/botcomponents/ -l
160
```
161
162
For each testing component:
163
1. Read `botcomponents/<guid>/botcomponent.xml`
164
2. Extract `<description>` and `<name>` fields - these contain the test phrases
165
3. Note the `<parentbotid>` to identify which agent the test is for
166
4. Group test phrases by agent for documentation
167
168
Test phrases are used for:
169
- Evaluating agent responses to common queries
170
- Regression testing after agent updates
171
- Demonstrating agent capabilities with sample questions
172
173
### 6. Generate Documentation Output
174
175
Create markdown file in `Docs/<AgentName>.md` with sections:
176
177
```markdown
178
# <Agent Display Name>
179
180
**Solution Name:** <from Solution.xml>
181
**Version:** <from Solution.xml>
182
**Publisher:** <from Solution.xml>
183
184
## Overview
185
<Brief description of agent purpose>
186
187
## Agent Architecture
188
<Multi-agent diagram if applicable>
189
190
## Topics
191
### Standard Topics
192
- List ConversationStart, Greeting, Fallback, etc.
193
194
### Custom Topics
195
- Document business-specific conversation flows
196
197
## GPT Instructions
198
<System prompt summary>
199
200
## External Integrations
201
### Connectors
202
- **ServiceNow**: <list actions>
203
- **<OtherConnector>**: <list actions>
204
205
### Knowledge Sources
206
- URL: <sourceurl>
207
- Type: <description>
208
209
### Dataverse Tables
210
<If dvtablesearch components exist>
211
212
The agent has access to the following Dataverse tables for data queries:
213
214
#### Entity Relationship Diagram
215
```mermaid
216
erDiagram
217
<SearchName> ||--o{ <EntityName> : "searches"
218
<EntityName> {
219
string entitylogicalname
220
string displayname
221
}
222
```
223
224
#### Configured Searches
225
| Search Name | Search ID | Entity | Description |
226
|-------------|-----------|--------|-------------|
227
| <name> | <dvtablesearchid> | <entitylogicalname> | <purpose> |
228
229
## Component Inventory
230
- Total Topics: <count>
231
- Total Actions: <count>
232
- Child Agents: <list if orchestrator>
233
- Dataverse Table Searches: <count>
234
- Dataverse Entities: <count>
235
236
## Test Phrases & Evaluation Sets
237
<Group test phrases by agent>
238
239
### <Agent Name>
240
- "<test phrase 1>"
241
- "<test phrase 2>"
242
- "<test phrase 3>"
243
244
### <Another Agent Name>
245
- "<test phrase 1>"
246
- "<test phrase 2>"
247
```
248
249
### Naming Conventions to Recognize
250
251
#### Component Schema Names
252
- Format: `<customizationprefix>_<logicalname>.<componenttype>.<descriptor>`
253
- Example: `cr667_primaryPortalAgent.InvokeConnectedAgentTaskAction.ClientExplorer`
254
- The prefix (e.g., `cr667`, `pkb`) comes from the Dataverse publisher
255
256
#### Topic Naming Patterns
257
- Standard: `.topic.Greeting`, `.topic.Fallback`, `.topic.OnError`
258
- Custom: `.topic.<Intent>_<GUID>` or `.topic.<FriendlyName>`
259
260
#### Action Naming Pattern
261
- Format: `.action.<ConnectorName>-<OperationName>`
262
- Example: `.action.ServiceNow-Getcatalogitems`
263
264
### Common Analysis Commands
265
266
```bash
267
# Count topics for an agent
268
ls Agents/<AgentName>/src/botcomponents/ | grep "\.topic\." | wc -l
269
270
# Find all connector actions
271
ls Agents/<AgentName>/src/botcomponents/ | grep "\.action\."
272
273
# Check for multi-agent orchestration
274
ls Agents/<AgentName>/src/botcomponents/ | grep "InvokeConnectedAgentTaskAction"
275
276
# Find external service URLs
277
grep -r "sourceurl\|connectorid" Agents/<AgentName>/src/
278
279
# List all agents in solution
280
ls Agents/<AgentName>/src/bots/
281
282
# Find all test phrases/evaluation sets
283
grep -r "<category>Testing</category>" Agents/<AgentName>/src/botcomponents/ -A 3
284
285
# Check for Dataverse table searches
286
ls Agents/<AgentName>/src/dvtablesearchs/ 2>/dev/null || echo "No Dataverse searches"
287
288
# List Dataverse entities
289
ls Agents/<AgentName>/src/dvtablesearchentities/ 2>/dev/null || echo "No Dataverse entities"
290
291
# Find entity-to-search mappings
292
grep -r "dvtablesearchid" Agents/<AgentName>/src/dvtablesearchentities/
293
```
294
295
### Output Best Practices
296
297
1. **Always output to `Docs/`** - Never create documentation in other folders
298
2. **Use agent name as filename** - `Docs/<AgentName>.md`
299
3. **Include file references** - Link back to source files when describing components
300
4. **Configuration** - List out in a table the configuration of each othe bots.
301
5. **Document multi-agent relationships** - Show parent-child agent hierarchies in a mermaid diagram. Group all the documentation by the agent, showing documentation topics underneath each group.
302
6. **Highlight integrations** - External APIs and connectors are critical for understanding agent capabilities
303
7. **Count components** - Provide metrics (# topics, # actions, # child agents)
304
8. **Include test phrases** - Document evaluation test phrases grouped by agent to demonstrate capabilities and provide testing examples
305
9. **Other documentation** - Remove references to other documentation in the repository. This file should be standalone.
306
10. **Technical depth** - Include some explainations of components, assuming that the audience less technical and may not know what these components mean - unless the request asks for highly technical output.
307
308
### Example: multiagentdemo Analysis
309
310
The `multiagentdemo` solution contains 5 agents:
311
- **primaryPortalAgent** (orchestrator)
312
- **getSkillName** (People Skills Finder)
313
- **myServices** (ServiceNow integration with 3 actions)
314
- **serviceNowKnowledgeAgent** (knowledge base queries)
315
- **whoWhat** (account lookups)
316
317
ServiceNow integration found:
318
- Connector: `shared_service-now`
319
- Actions: GetRecord, Getcatalogitems, Orderitem
320
- Knowledge URL: `https://<instance-name>.service-now.com/`
321
322
### Key Files Reference
323
324
- `Solution.xml` - Version, publisher, solution metadata
325
- `Customizations.xml` - Connection references to external services
326
- `botcomponent_connectionreferenceset.xml` - Bot-to-connector mappings
327
- `unstructuredfilesearchentities/*.meta.xml` - Knowledge source URLs
328
- `botcomponents/*/botcomponent.xml` - Individual component metadata
329
- `botcomponents/*/data` - Individual component data files
330
- `bots/*/bot.xml` - Top-level bot definitions
331
- `bots/*/configuration.json` - Bot configuration settings
332
- `dvtablesearchs/*/dvtablesearch.xml` - Dataverse table search configurations
333
- `dvtablesearchentities/*/dvtablesearchentity.xml` - Dataverse entity/table mappings
334
335
336
When you are building references to files, navigate from the repo root, as the generated document can existing under a subfolder when generated.