@salesforce/afv-skills 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/skills/accessing-webapp-data/SKILL.md +178 -0
- package/skills/agentforce-development/SKILL.md +427 -0
- package/skills/agentforce-development/assets/README-legacy.md +89 -0
- package/skills/agentforce-development/assets/agent-spec-template.md +90 -0
- package/skills/agentforce-development/assets/agents/README.md +45 -0
- package/skills/agentforce-development/assets/agents/hello-world.agent +60 -0
- package/skills/agentforce-development/assets/agents/multi-topic.agent +105 -0
- package/skills/agentforce-development/assets/agents/production-faq.agent +101 -0
- package/skills/agentforce-development/assets/agents/production-faq.bundle-meta.xml +4 -0
- package/skills/agentforce-development/assets/agents/simple-qa.agent +72 -0
- package/skills/agentforce-development/assets/apex/models-api-queueable.cls +225 -0
- package/skills/agentforce-development/assets/bundle-meta.xml +23 -0
- package/skills/agentforce-development/assets/components/apex-action.agent +52 -0
- package/skills/agentforce-development/assets/components/error-handling.agent +58 -0
- package/skills/agentforce-development/assets/components/escalation-setup.agent +169 -0
- package/skills/agentforce-development/assets/components/flow-action.agent +66 -0
- package/skills/agentforce-development/assets/components/n-ary-conditions.agent +110 -0
- package/skills/agentforce-development/assets/components/topic-with-actions.agent +40 -0
- package/skills/agentforce-development/assets/deterministic-routing.agent +166 -0
- package/skills/agentforce-development/assets/escalation-pattern.agent +209 -0
- package/skills/agentforce-development/assets/flow-action-lookup.agent +115 -0
- package/skills/agentforce-development/assets/hub-and-spoke.agent +104 -0
- package/skills/agentforce-development/assets/invocable-apex-template.cls +187 -0
- package/skills/agentforce-development/assets/local-info-agent-annotated.agent +355 -0
- package/skills/agentforce-development/assets/metadata/basic-prompt-template.promptTemplate-meta.xml +109 -0
- package/skills/agentforce-development/assets/metadata/genai-function-apex.xml +92 -0
- package/skills/agentforce-development/assets/metadata/genai-function-flow.xml +57 -0
- package/skills/agentforce-development/assets/metadata/genai-plugin.xml +72 -0
- package/skills/agentforce-development/assets/metadata/http-callout-flow.flow-meta.xml +348 -0
- package/skills/agentforce-development/assets/metadata/record-grounded-prompt.promptTemplate-meta.xml +136 -0
- package/skills/agentforce-development/assets/minimal-starter.agent +42 -0
- package/skills/agentforce-development/assets/patterns/README.md +254 -0
- package/skills/agentforce-development/assets/patterns/action-callbacks.agent +178 -0
- package/skills/agentforce-development/assets/patterns/advanced-input-bindings.agent +141 -0
- package/skills/agentforce-development/assets/patterns/bidirectional-routing.agent +156 -0
- package/skills/agentforce-development/assets/patterns/critical-input-collection.agent +244 -0
- package/skills/agentforce-development/assets/patterns/delegation-routing.agent +89 -0
- package/skills/agentforce-development/assets/patterns/lifecycle-events.agent +127 -0
- package/skills/agentforce-development/assets/patterns/llm-controlled-actions.agent +184 -0
- package/skills/agentforce-development/assets/patterns/multi-step-workflow.agent +282 -0
- package/skills/agentforce-development/assets/patterns/open-gate-routing.agent +286 -0
- package/skills/agentforce-development/assets/patterns/procedural-instructions.agent +273 -0
- package/skills/agentforce-development/assets/patterns/prompt-template-action.agent +188 -0
- package/skills/agentforce-development/assets/patterns/system-instruction-overrides.agent +293 -0
- package/skills/agentforce-development/assets/prompt-rag-search.agent +131 -0
- package/skills/agentforce-development/assets/template-multi-topic.agent +160 -0
- package/skills/agentforce-development/assets/template-single-topic.agent +81 -0
- package/skills/agentforce-development/assets/verification-gate.agent +208 -0
- package/skills/agentforce-development/references/action-prompt-templates.md +164 -0
- package/skills/agentforce-development/references/actions-reference.md +592 -0
- package/skills/agentforce-development/references/agent-access-guide.md +72 -0
- package/skills/agentforce-development/references/agent-design-and-spec-creation.md +1010 -0
- package/skills/agentforce-development/references/agent-metadata-and-lifecycle.md +575 -0
- package/skills/agentforce-development/references/agent-script-core-language.md +1218 -0
- package/skills/agentforce-development/references/agent-topic-map-diagrams.md +323 -0
- package/skills/agentforce-development/references/agent-user-setup.md +526 -0
- package/skills/agentforce-development/references/agent-validation-and-debugging.md +803 -0
- package/skills/agentforce-development/references/known-issues.md +353 -0
- package/skills/agentforce-development/references/minimal-examples.md +67 -0
- package/skills/agentforce-development/references/production-gotchas.md +279 -0
- package/skills/agentforce-development/references/salesforce-cli-for-agents.md +393 -0
- package/skills/agentforce-development/references/version-history.md +23 -0
- package/skills/building-webapp-data-visualization/SKILL.md +72 -0
- package/skills/building-webapp-data-visualization/implementation/bar-line-chart.md +316 -0
- package/skills/building-webapp-data-visualization/implementation/dashboard-layout.md +189 -0
- package/skills/building-webapp-data-visualization/implementation/donut-chart.md +181 -0
- package/skills/building-webapp-data-visualization/implementation/stat-card.md +150 -0
- package/skills/building-webapp-react-components/SKILL.md +96 -0
- package/skills/building-webapp-react-components/implementation/component.md +78 -0
- package/skills/building-webapp-react-components/implementation/header-footer.md +132 -0
- package/skills/building-webapp-react-components/implementation/page.md +93 -0
- package/skills/configuring-webapp-csp-trusted-sites/SKILL.md +90 -0
- package/skills/configuring-webapp-csp-trusted-sites/implementation/metadata-format.md +281 -0
- package/skills/configuring-webapp-metadata/SKILL.md +158 -0
- package/skills/creating-webapp/SKILL.md +141 -0
- package/skills/deploying-webapp-to-salesforce/SKILL.md +229 -0
- package/skills/exploring-webapp-graphql-schema/SKILL.md +149 -0
- package/skills/fetching-webapp-rest-api/SKILL.md +167 -0
- package/skills/{salesforce-custom-application → generating-custom-application}/SKILL.md +2 -4
- package/skills/{salesforce-custom-field → generating-custom-field}/SKILL.md +1 -5
- package/skills/{salesforce-custom-lightning-type → generating-custom-lightning-type}/SKILL.md +36 -2
- package/skills/{salesforce-custom-object → generating-custom-object}/SKILL.md +1 -1
- package/skills/generating-custom-tab/SKILL.md +154 -0
- package/skills/generating-experience-lwr-site/SKILL.md +196 -0
- package/skills/generating-experience-lwr-site/docs/bootstrap-template-byo-lwr.md +224 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-brandingSet.md +131 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-route.md +232 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-themeLayout.md +141 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-view.md +233 -0
- package/skills/generating-experience-lwr-site/docs/configure-guest-sharing-rules.md +42 -0
- package/skills/generating-experience-lwr-site/docs/handle-component-and-region-ids.md +27 -0
- package/skills/generating-experience-lwr-site/docs/handle-ui-components.md +215 -0
- package/skills/generating-experience-react-site/SKILL.md +67 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-custom-site.md +41 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience-bundle.md +17 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience-config.md +21 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience.md +38 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-network.md +72 -0
- package/skills/{salesforce-flexipage → generating-flexipage}/SKILL.md +86 -9
- package/skills/{salesforce-flow → generating-flow}/SKILL.md +3 -3
- package/skills/generating-fragment/SKILL.md +117 -0
- package/skills/generating-lightning-app/SKILL.md +423 -0
- package/skills/{salesforce-list-view → generating-list-view}/SKILL.md +1 -1
- package/skills/generating-permission-set/SKILL.md +174 -0
- package/skills/{salesforce-validation-rule → generating-validation-rule}/SKILL.md +1 -1
- package/skills/generating-webapp-graphql-mutation-query/SKILL.md +258 -0
- package/skills/generating-webapp-graphql-read-query/SKILL.md +253 -0
- package/skills/implementing-webapp-file-upload/SKILL.md +396 -0
- package/skills/installing-webapp-features/SKILL.md +210 -0
- package/skills/managing-webapp-agentforce-conversation-client/SKILL.md +186 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/constraints.md +134 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/examples.md +132 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/style-tokens.md +101 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/troubleshooting.md +57 -0
- package/skills/switching-org/SKILL.md +28 -0
- package/skills/using-webapp-graphql/SKILL.md +324 -0
- package/skills/using-webapp-graphql/shared-schema.graphqls +1150 -0
- package/skills/apex-class/SKILL.md +0 -253
- package/skills/apex-class/examples/AccountDeduplicationBatch.cls +0 -148
- package/skills/apex-class/examples/AccountSelector.cls +0 -193
- package/skills/apex-class/examples/AccountService.cls +0 -201
- package/skills/apex-class/templates/abstract.cls +0 -128
- package/skills/apex-class/templates/batch.cls +0 -125
- package/skills/apex-class/templates/domain.cls +0 -102
- package/skills/apex-class/templates/dto.cls +0 -108
- package/skills/apex-class/templates/exception.cls +0 -51
- package/skills/apex-class/templates/interface.cls +0 -25
- package/skills/apex-class/templates/queueable.cls +0 -92
- package/skills/apex-class/templates/schedulable.cls +0 -75
- package/skills/apex-class/templates/selector.cls +0 -92
- package/skills/apex-class/templates/service.cls +0 -69
- package/skills/apex-class/templates/utility.cls +0 -97
- package/skills/apex-test-class/SKILL.md +0 -101
- package/skills/apex-test-class/references/assertion-patterns.md +0 -209
- package/skills/apex-test-class/references/async-testing.md +0 -276
- package/skills/apex-test-class/references/mocking-patterns.md +0 -219
- package/skills/apex-test-class/references/test-data-factory.md +0 -176
- package/skills/deployment-readiness-check/SKILL.md +0 -257
- package/skills/deployment-readiness-check/assets/deployment_checklist.md +0 -286
- package/skills/deployment-readiness-check/references/rollback_procedures.md +0 -308
- package/skills/deployment-readiness-check/scripts/check_metadata.sh +0 -207
- package/skills/salesforce-custom-tab/SKILL.md +0 -78
- package/skills/salesforce-experience-site/SKILL.md +0 -178
- package/skills/salesforce-fragment/SKILL.md +0 -42
- package/skills/salesforce-lightning-app-build/SKILL.md +0 -254
- package/skills/salesforce-web-app-creating-records/SKILL.md +0 -84
- package/skills/salesforce-web-app-feature/SKILL.md +0 -70
- package/skills/salesforce-web-app-list-and-create-records/SKILL.md +0 -36
- package/skills/salesforce-web-application/SKILL.md +0 -34
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
# Agent Topic Map Diagrams Reference
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Purpose and Context](#purpose-and-context)
|
|
6
|
+
- [Fundamental Structure Rules](#fundamental-structure-rules)
|
|
7
|
+
- [Node Types and Agent Script Elements](#node-types-and-agent-script-elements)
|
|
8
|
+
- [Topic Map Patterns](#topic-map-patterns)
|
|
9
|
+
- [Complete Example: Local_Info_Agent](#complete-example-local_info_agent)
|
|
10
|
+
- [Validation Checklist](#validation-checklist)
|
|
11
|
+
- [Anti-patterns](#anti-patterns)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Purpose and Context
|
|
16
|
+
|
|
17
|
+
A Topic Map diagram is a Mermaid flowchart that visualizes an agent's topic graph structure. It shows the architecture of an agent before implementation, displaying:
|
|
18
|
+
|
|
19
|
+
- The start_agent topic_selector entry point
|
|
20
|
+
- All topics in the agent
|
|
21
|
+
- Topic transitions and routing logic
|
|
22
|
+
- Action calls within topics (with backing type: Apex, Prompt Template, Flow)
|
|
23
|
+
- Gating conditions (available_when expressions)
|
|
24
|
+
- Variable state changes
|
|
25
|
+
- Escalation and off-topic handling
|
|
26
|
+
- Conditional instructions based on variable values
|
|
27
|
+
|
|
28
|
+
Topic Map diagrams are the primary visual deliverable in an Agent Spec (design document) and serve both specification and comprehension purposes.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Fundamental Structure Rules
|
|
33
|
+
|
|
34
|
+
### Graph Orientation
|
|
35
|
+
|
|
36
|
+
- ALWAYS use `graph TD` (Top-Down orientation)
|
|
37
|
+
- Start with start_agent topic_selector at the top
|
|
38
|
+
- Topics flow downward from the selector
|
|
39
|
+
- Never use other orientations
|
|
40
|
+
|
|
41
|
+
### Node Identification
|
|
42
|
+
|
|
43
|
+
- Use sequential capital letters (A, B, C, ...) for node IDs
|
|
44
|
+
- Start with `A` for start_agent
|
|
45
|
+
- Increment sequentially through topics and decisions
|
|
46
|
+
- Use descriptive labels within brackets
|
|
47
|
+
|
|
48
|
+
### Flow Direction
|
|
49
|
+
|
|
50
|
+
- Primary flow moves top-to-bottom
|
|
51
|
+
- Use `-->` for standard transitions
|
|
52
|
+
- Label decision branches with `|Label|` syntax
|
|
53
|
+
- Separate paths for different topics
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Node Types and Agent Script Elements
|
|
58
|
+
|
|
59
|
+
### Start Agent Topic Selector Node
|
|
60
|
+
|
|
61
|
+
Format: `[start_agent<br/>topic_selector]`
|
|
62
|
+
|
|
63
|
+
Represents the entry point where user input is evaluated and routed to appropriate topics.
|
|
64
|
+
|
|
65
|
+
```mermaid
|
|
66
|
+
%%{init: {'theme':'neutral'}}%%
|
|
67
|
+
graph TD
|
|
68
|
+
A[start_agent<br/>topic_selector]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Topic Nodes
|
|
72
|
+
|
|
73
|
+
Format: `[topic_name<br/>Topic]`
|
|
74
|
+
|
|
75
|
+
Represents a topic within the agent.
|
|
76
|
+
|
|
77
|
+
```mermaid
|
|
78
|
+
%%{init: {'theme':'neutral'}}%%
|
|
79
|
+
graph TD
|
|
80
|
+
A[start_agent<br/>topic_selector]
|
|
81
|
+
B[order_status<br/>Topic]
|
|
82
|
+
C[billing<br/>Topic]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Action Call Nodes
|
|
86
|
+
|
|
87
|
+
Format: `[Call action_name<br/>backing: Type]`
|
|
88
|
+
|
|
89
|
+
Backing types: Apex, Prompt Template, Flow
|
|
90
|
+
|
|
91
|
+
Example: `[Call check_weather<br/>backing: Apex]`
|
|
92
|
+
|
|
93
|
+
```mermaid
|
|
94
|
+
%%{init: {'theme':'neutral'}}%%
|
|
95
|
+
graph TD
|
|
96
|
+
A[local_weather<br/>Topic] --> B[Call check_weather<br/>backing: Apex]
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Decision/Gating Nodes
|
|
100
|
+
|
|
101
|
+
Use curly braces `{}` for conditions. Common formats:
|
|
102
|
+
|
|
103
|
+
- Variable availability gates: `{Check: variable_name != empty?}`
|
|
104
|
+
- Conditional instructions: `{variable_name == value?}`
|
|
105
|
+
- Topic transition logic: `{user_intent matches?}`
|
|
106
|
+
|
|
107
|
+
```mermaid
|
|
108
|
+
%%{init: {'theme':'neutral'}}%%
|
|
109
|
+
graph TD
|
|
110
|
+
A[topic<br/>Topic] --> B{Check: guest_interests<br/>!= empty?}
|
|
111
|
+
B -->|Yes| C[Call collect_events<br/>backing: Prompt Template]
|
|
112
|
+
B -->|No| D[Ask for clarification]
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Variable State Change Nodes
|
|
116
|
+
|
|
117
|
+
Format: `[Set variable_name = value]`
|
|
118
|
+
|
|
119
|
+
Shows state modifications that affect downstream behavior.
|
|
120
|
+
|
|
121
|
+
```mermaid
|
|
122
|
+
%%{init: {'theme':'neutral'}}%%
|
|
123
|
+
graph TD
|
|
124
|
+
A[Call action] --> B[Set reservation_required<br/>= true]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Utility Call Nodes
|
|
128
|
+
|
|
129
|
+
Format: `[Call @utils.name]`
|
|
130
|
+
|
|
131
|
+
For escalation and system utilities.
|
|
132
|
+
|
|
133
|
+
```mermaid
|
|
134
|
+
%%{init: {'theme':'neutral'}}%%
|
|
135
|
+
graph TD
|
|
136
|
+
A[escalation<br/>Topic] --> B[Call @utils.escalate]
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Topic Map Patterns
|
|
142
|
+
|
|
143
|
+
### Basic Topic with Single Action
|
|
144
|
+
|
|
145
|
+
```mermaid
|
|
146
|
+
%%{init: {'theme':'neutral'}}%%
|
|
147
|
+
graph TD
|
|
148
|
+
A[start_agent<br/>topic_selector]
|
|
149
|
+
A -->|route to topic| B[simple_topic<br/>Topic]
|
|
150
|
+
B --> C[Call do_action<br/>backing: Apex]
|
|
151
|
+
C --> D[Continue]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Topic with Gating Condition
|
|
155
|
+
|
|
156
|
+
Available_when expressions prevent action execution until conditions are met.
|
|
157
|
+
|
|
158
|
+
```mermaid
|
|
159
|
+
%%{init: {'theme':'neutral'}}%%
|
|
160
|
+
graph TD
|
|
161
|
+
A[topic_with_gate<br/>Topic]
|
|
162
|
+
A --> B{Check: required_var<br/>!= empty?}
|
|
163
|
+
B -->|No| C[Instruction: collect info first]
|
|
164
|
+
B -->|Yes| D[Call action<br/>backing: Prompt Template]
|
|
165
|
+
C --> E[Wait for input]
|
|
166
|
+
E --> A
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Topic with Conditional Instructions
|
|
170
|
+
|
|
171
|
+
Variable values control which instructions apply to a topic.
|
|
172
|
+
|
|
173
|
+
```mermaid
|
|
174
|
+
%%{init: {'theme':'neutral'}}%%
|
|
175
|
+
graph TD
|
|
176
|
+
A[Call process_request<br/>backing: Flow]
|
|
177
|
+
A --> B[Set status_flag = complete]
|
|
178
|
+
B --> C{Check: status_flag<br/>== complete?}
|
|
179
|
+
C -->|Yes| D[Apply conditional<br/>instructions]
|
|
180
|
+
D --> E[Continue]
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Topic Transitions
|
|
184
|
+
|
|
185
|
+
When logic determines a new topic should be active.
|
|
186
|
+
|
|
187
|
+
```mermaid
|
|
188
|
+
%%{init: {'theme':'neutral'}}%%
|
|
189
|
+
graph TD
|
|
190
|
+
A[current_topic<br/>Topic]
|
|
191
|
+
A --> B{Transition<br/>condition?}
|
|
192
|
+
B -->|Yes| C[Transition to<br/>next_topic]
|
|
193
|
+
C --> D[next_topic<br/>Topic]
|
|
194
|
+
B -->|No| E[Continue in<br/>current_topic]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Off-Topic and Escalation Routing
|
|
198
|
+
|
|
199
|
+
How the agent handles out-of-scope requests.
|
|
200
|
+
|
|
201
|
+
```mermaid
|
|
202
|
+
%%{init: {'theme':'neutral'}}%%
|
|
203
|
+
graph TD
|
|
204
|
+
A[start_agent<br/>topic_selector]
|
|
205
|
+
A -->|out of scope| B[off_topic<br/>Topic]
|
|
206
|
+
A -->|needs help| C[escalation<br/>Topic]
|
|
207
|
+
B --> D[Instruction: redirect user]
|
|
208
|
+
C --> E[Call @utils.escalate]
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Complete Example: Local_Info_Agent
|
|
214
|
+
|
|
215
|
+
This example demonstrates a complete Topic Map for a guest information agent with multiple topics, gating conditions, variable state, and escalation handling.
|
|
216
|
+
|
|
217
|
+
```mermaid
|
|
218
|
+
%%{init: {'theme':'neutral'}}%%
|
|
219
|
+
graph TD
|
|
220
|
+
A[start_agent<br/>topic_selector]
|
|
221
|
+
|
|
222
|
+
A -->|weather query| B[local_weather<br/>Topic]
|
|
223
|
+
A -->|events query| C[local_events<br/>Topic]
|
|
224
|
+
A -->|hours query| D[resort_hours<br/>Topic]
|
|
225
|
+
A -->|unclear intent| E[ambiguous_question<br/>Topic]
|
|
226
|
+
A -->|out of scope| F[off_topic<br/>Topic]
|
|
227
|
+
A -->|needs escalation| G[escalation<br/>Topic]
|
|
228
|
+
|
|
229
|
+
B --> B1[Call check_weather<br/>backing: Apex]
|
|
230
|
+
B1 --> B2[Continue]
|
|
231
|
+
|
|
232
|
+
C --> C1{Check: guest_interests<br/>!= empty?}
|
|
233
|
+
C1 -->|No| C2[Instruction: collect guest interests]
|
|
234
|
+
C1 -->|Yes| C3[Call check_events<br/>backing: Prompt Template]
|
|
235
|
+
C2 --> C4[Pause for input]
|
|
236
|
+
C4 --> C
|
|
237
|
+
C3 --> C5[Continue]
|
|
238
|
+
|
|
239
|
+
D --> D1[Call get_resort_hours<br/>backing: Flow]
|
|
240
|
+
D1 --> D2[Set reservation_required<br/>= true]
|
|
241
|
+
D2 --> D3{Check: reservation_required<br/>== true?}
|
|
242
|
+
D3 -->|Yes| D4[Apply booking instructions]
|
|
243
|
+
D3 -->|No| D5[Apply standard instructions]
|
|
244
|
+
D4 --> D6[Continue]
|
|
245
|
+
D5 --> D6
|
|
246
|
+
|
|
247
|
+
E --> E1[Instruction: ask for clarification]
|
|
248
|
+
E1 --> E2[Await user input]
|
|
249
|
+
E2 --> A
|
|
250
|
+
|
|
251
|
+
F --> F1[Instruction: explain available topics]
|
|
252
|
+
F1 --> F2[Continue]
|
|
253
|
+
|
|
254
|
+
G --> G1[Call @utils.escalate]
|
|
255
|
+
G1 --> G2[Continue]
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### Topic Descriptions
|
|
259
|
+
|
|
260
|
+
**local_weather**: Provides weather information via Apex-backed action. No preconditions.
|
|
261
|
+
|
|
262
|
+
**local_events**: Requires guest_interests variable to be populated (gating: `available_when guest_interests != ""`). Calls Prompt Template-backed action only when gate is satisfied.
|
|
263
|
+
|
|
264
|
+
**resort_hours**: Calls Flow-backed action that sets reservation_required variable. Conditional instructions applied based on variable state: booking-specific guidance when true, standard guidance when false.
|
|
265
|
+
|
|
266
|
+
**ambiguous_question**: No actions. Requests clarification and routes back to start_agent.
|
|
267
|
+
|
|
268
|
+
**off_topic**: No actions. Explains available topics and continues conversation.
|
|
269
|
+
|
|
270
|
+
**escalation**: Calls @utils.escalate utility to route to human agent.
|
|
271
|
+
|
|
272
|
+
**start_agent topic_selector**: Routes incoming user input to appropriate topics based on intent.
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Validation Checklist
|
|
277
|
+
|
|
278
|
+
Before finalizing a Topic Map diagram:
|
|
279
|
+
|
|
280
|
+
- [ ] Uses `graph TD` syntax
|
|
281
|
+
- [ ] Starts with `%%{init: {'theme':'neutral'}}%%`
|
|
282
|
+
- [ ] start_agent topic_selector is node A at top
|
|
283
|
+
- [ ] Nodes use sequential capital letter IDs
|
|
284
|
+
- [ ] All topics labeled with `[topic_name<br/>Topic]` format
|
|
285
|
+
- [ ] Action calls include backing type (Apex, Prompt Template, Flow)
|
|
286
|
+
- [ ] Gating conditions shown as decision nodes with `{Check: ...?}` format
|
|
287
|
+
- [ ] Variable state changes explicitly labeled with `[Set variable = value]`
|
|
288
|
+
- [ ] Escalation uses `[Call @utils.escalate]` format
|
|
289
|
+
- [ ] All transition branches are labeled
|
|
290
|
+
- [ ] Diagram fits in 20-30 nodes
|
|
291
|
+
- [ ] Topic routing from start_agent is clear
|
|
292
|
+
- [ ] Off-topic and escalation paths are visible
|
|
293
|
+
- [ ] Conditional instruction logic is shown
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Anti-patterns
|
|
298
|
+
|
|
299
|
+
### Don't
|
|
300
|
+
|
|
301
|
+
- Use `graph LR` or other orientations instead of `graph TD`
|
|
302
|
+
- Place start_agent anywhere except top (node A)
|
|
303
|
+
- Label actions without backing type information
|
|
304
|
+
- Use ambiguous decision node labels (avoid `{Process?}`)
|
|
305
|
+
- Hide gating conditions in node descriptions instead of showing as decisions
|
|
306
|
+
- Omit variable state changes that affect downstream behavior
|
|
307
|
+
- Create topic routing without labels on the decision logic
|
|
308
|
+
- Mix topic nodes with action nodes at same level without clear containment
|
|
309
|
+
- Use custom color styling (breaks in dark mode)
|
|
310
|
+
- Leave off-topic and escalation paths out of diagram
|
|
311
|
+
|
|
312
|
+
### Do
|
|
313
|
+
|
|
314
|
+
- Keep start_agent topic_selector at the top
|
|
315
|
+
- Show all topics reachable from start_agent
|
|
316
|
+
- Include backing type for every action call
|
|
317
|
+
- Make gating conditions explicit as decision nodes
|
|
318
|
+
- Show variable updates as separate nodes when they affect logic flow
|
|
319
|
+
- Label all transition branches
|
|
320
|
+
- Include off-topic and escalation topics
|
|
321
|
+
- Show conditional instructions with decision nodes
|
|
322
|
+
- Use `%%{init: {'theme':'neutral'}}%%` for light/dark mode compatibility
|
|
323
|
+
- Focus diagram on topic structure, not detailed action logic
|