@salesforce/afv-skills 1.68.0 → 1.69.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.
Files changed (188) hide show
  1. package/package.json +1 -1
  2. package/skills/afcc-setup-coordinate/SKILL.md +348 -0
  3. package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
  4. package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
  5. package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
  6. package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
  7. package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
  8. package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
  9. package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
  10. package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
  11. package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
  12. package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
  13. package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
  14. package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
  15. package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
  16. package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
  17. package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
  18. package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
  19. package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
  20. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
  21. package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
  22. package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
  23. package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
  24. package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
  25. package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
  26. package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
  27. package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
  28. package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
  29. package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
  30. package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
  31. package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
  32. package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
  33. package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
  34. package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
  35. package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
  36. package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
  37. package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
  38. package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
  39. package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
  40. package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
  41. package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
  42. package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
  43. package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
  44. package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
  45. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
  46. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
  47. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
  48. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
  49. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
  50. package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
  51. package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
  52. package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
  53. package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
  54. package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
  55. package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
  56. package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
  57. package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
  58. package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
  59. package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
  60. package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
  61. package/skills/commerce-react-storefront-create/SKILL.md +54 -21
  62. package/skills/dx-lifecycle-center/SKILL.md +24 -18
  63. package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
  64. package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
  65. package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
  66. package/skills/dx-lifecycle-center/references/deploy.md +3 -3
  67. package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
  68. package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
  69. package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
  70. package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
  71. package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
  72. package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
  73. package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
  74. package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
  75. package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
  76. package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
  77. package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
  78. package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
  79. package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
  80. package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
  81. package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
  82. package/skills/experience-afv-analytics-query/SKILL.md +239 -0
  83. package/skills/experience-afv-analytics-query/references/references.md +176 -0
  84. package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
  85. package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
  86. package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
  87. package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
  88. package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
  89. package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
  90. package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
  91. package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
  92. package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
  93. package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
  94. package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
  95. package/skills/experience-app-mcp-generate/SKILL.md +174 -0
  96. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
  97. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
  98. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
  99. package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
  100. package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
  101. package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
  102. package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
  103. package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
  104. package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
  105. package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
  106. package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
  107. package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
  108. package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
  109. package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
  110. package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
  111. package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
  112. package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
  113. package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
  114. package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
  115. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
  116. package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
  117. package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
  118. package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
  119. package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
  120. package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
  121. package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
  122. package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
  123. package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
  124. package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
  125. package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
  126. package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
  127. package/skills/platform-custom-field-generate/SKILL.md +24 -16
  128. package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
  129. package/skills/platform-custom-setting-generate/SKILL.md +1 -0
  130. package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
  131. package/skills/platform-flexipage-generate/SKILL.md +7 -10
  132. package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
  133. package/skills/platform-policy-rule-generate/SKILL.md +9 -7
  134. package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
  135. package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
  136. package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
  137. package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
  138. package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
  139. package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
  140. package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
  141. package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
  142. package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
  143. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
  144. package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
  145. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  146. package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
  147. package/skills/platform-report-generate/SKILL.md +20 -1
  148. package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
  149. package/skills/platform-report-generate/references/verification-checklist.md +12 -0
  150. package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
  151. package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
  152. package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
  153. package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
  154. package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
  155. package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
  156. package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
  157. package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
  158. package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
  159. package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
  160. package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
  161. package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
  162. package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
  163. package/skills/service-e911-configure/SKILL.md +242 -0
  164. package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
  165. package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
  166. package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
  167. package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
  168. package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
  169. package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
  170. package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
  171. package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
  172. package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
  173. package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
  174. package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
  175. package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
  176. package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
  177. package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
  178. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
  179. package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
  180. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
  181. package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
  182. package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
  183. package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
  184. package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
  185. package/skills/experience-content-media-image-generate/SKILL.md +0 -83
  186. package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
  187. package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
  188. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
@@ -0,0 +1,341 @@
1
+ # Agent Subagent 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
+ - [Subagent Map Patterns](#subagent-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 Subagent Map diagram is a Mermaid flowchart that visualizes an agent's
18
+ subagent graph structure. Use the smallest graph that represents the design.
19
+ For a multi-subagent agent, it displays:
20
+
21
+ - The `start_agent agent_router` entry point when multiple genuine domains need
22
+ intent classification
23
+ - All subagents in the agent
24
+ - Subagent transitions and routing logic
25
+ - Action calls within subagents (with backing type: Apex, Prompt Template, Flow)
26
+ - Gating conditions (`available when` expressions), when required
27
+ - Variable state changes that have a trusted writer and named consumer
28
+ - Escalation, off-topic handling, and conditional instructions when the
29
+ intended use cases require them
30
+
31
+ Subagent Map diagrams are the primary visual deliverable in an Agent Spec (design document) and serve both specification and comprehension purposes.
32
+
33
+ ---
34
+
35
+ ## Fundamental Structure Rules
36
+
37
+ ### Graph Orientation
38
+
39
+ - Prefer `graph TD` (top-down) for the provided templates
40
+ - Put the `start_agent` entry point at the top
41
+ - For a router-first design, subagents flow downward from the router
42
+ - Use another orientation when it makes the actual design materially clearer
43
+
44
+ ### Node Identification
45
+
46
+ - Use sequential capital letters (A, B, C, ...) for node IDs
47
+ - Start with `A` for start_agent
48
+ - Increment sequentially through subagents and decisions
49
+ - Use descriptive labels within brackets
50
+
51
+ ### Flow Direction
52
+
53
+ - Primary flow moves top-to-bottom
54
+ - Use `-->` for standard transitions
55
+ - Label decision branches with `|Label|` syntax
56
+ - Separate paths for different subagents
57
+
58
+ ---
59
+
60
+ ## Node Types and Agent Script Elements
61
+
62
+ ### Start Agent Subagent Router Node
63
+
64
+ Format: `[start_agent<br/>agent_router]`
65
+
66
+ Represents the entry point where user input is evaluated and routed to appropriate subagents.
67
+
68
+ ```mermaid
69
+ %%{init: {'theme':'neutral'}}%%
70
+ graph TD
71
+ A[start_agent<br/>agent_router]
72
+ ```
73
+
74
+ ### Subagent Nodes
75
+
76
+ Format: `[subagent_name<br/>Subagent]`
77
+
78
+ Represents a subagent within the agent.
79
+
80
+ ```mermaid
81
+ %%{init: {'theme':'neutral'}}%%
82
+ graph TD
83
+ A[start_agent<br/>agent_router]
84
+ B[order_status<br/>Subagent]
85
+ C[billing<br/>Subagent]
86
+ ```
87
+
88
+ ### Action Call Nodes
89
+
90
+ Format: `[Call action_name<br/>backing: Type]`
91
+
92
+ Backing types: Apex, Prompt Template, Flow
93
+
94
+ Example: `[Call check_weather<br/>backing: Apex]`
95
+
96
+ ```mermaid
97
+ %%{init: {'theme':'neutral'}}%%
98
+ graph TD
99
+ A[local_weather<br/>Subagent] --> B[Call check_weather<br/>backing: Apex]
100
+ ```
101
+
102
+ ### Decision/Gating Nodes
103
+
104
+ Curly braces `{}` create a Mermaid decision diamond. Use a decision node when
105
+ the design actually branches. Label it according to who owns the decision:
106
+
107
+ - Machine-enforced authorization gate: `{customer_verified == true?}`
108
+ - Machine-enforced external outcome gate: `{verification_success == true?}`
109
+ - Model-interpreted transition: `{User wants account help?}`
110
+
111
+ `Check:` is optional display text, not AgentScript syntax. Do not make a
112
+ semantic model decision look like a machine-enforced predicate, and do not
113
+ invent a deterministic gate merely to satisfy the diagram format.
114
+
115
+ ```mermaid
116
+ %%{init: {'theme':'neutral'}}%%
117
+ graph TD
118
+ A[account_changes<br/>Subagent] --> B{customer_verified<br/>== true?}
119
+ B -->|Yes| C[Call update_account<br/>backing: Flow]
120
+ B -->|No| D[Call verify_customer<br/>backing: Apex]
121
+ ```
122
+
123
+ ### Variable State Change Nodes
124
+
125
+ Format: `[Set verified_customer_id<br/>= action output]`
126
+
127
+ Show a state modification only when a later runtime gate, transition, or action
128
+ binding consumes it. Ordinary conversational facts belong in conversation
129
+ history and do not need state-change nodes.
130
+
131
+ ```mermaid
132
+ %%{init: {'theme':'neutral'}}%%
133
+ graph TD
134
+ A[Call verify_customer] --> B[Set verified_customer_id<br/>= action output]
135
+ B --> C{verified_customer_id<br/>!= empty?}
136
+ C -->|Yes| D[Protected action available]
137
+ ```
138
+
139
+ ### Utility Call Nodes
140
+
141
+ Format: `[Call @utils.name]`
142
+
143
+ For escalation and system utilities.
144
+
145
+ ```mermaid
146
+ %%{init: {'theme':'neutral'}}%%
147
+ graph TD
148
+ A[escalation<br/>Subagent] --> B[Call @utils.escalate]
149
+ ```
150
+
151
+ ---
152
+
153
+ ## Subagent Map Patterns
154
+
155
+ ### Basic Subagent with Single Action
156
+
157
+ ```mermaid
158
+ %%{init: {'theme':'neutral'}}%%
159
+ graph TD
160
+ A[start_agent<br/>agent_router]
161
+ A -->|route to subagent| B[simple_subagent<br/>Subagent]
162
+ B --> C[Call do_action<br/>backing: Apex]
163
+ C --> D[Continue]
164
+ ```
165
+
166
+ ### Subagent with Gating Condition
167
+
168
+ For model-selected actions, `available when` controls whether the action schema
169
+ is exposed in the current reasoning iteration. Use a trusted predicate to keep
170
+ a protected action unavailable until its preconditions are met; independently
171
+ verify authorization again in the backing implementation when required.
172
+
173
+ ```mermaid
174
+ %%{init: {'theme':'neutral'}}%%
175
+ graph TD
176
+ A[account_changes<br/>Subagent]
177
+ A --> B{verified_customer_id<br/>!= empty?}
178
+ B -->|No| C[Call verify_customer<br/>backing: Apex]
179
+ B -->|Yes| D[Protected account action<br/>backing: Flow]
180
+ C --> E[Set verified_customer_id<br/>= action output]
181
+ E --> A
182
+ ```
183
+
184
+ ### Subagent with Conditional Instructions
185
+
186
+ Trusted action outputs or named invariants may control which instructions apply.
187
+ Do not add a variable solely to create a conditional prompt.
188
+
189
+ ```mermaid
190
+ %%{init: {'theme':'neutral'}}%%
191
+ graph TD
192
+ A[Call verify_customer<br/>backing: Apex]
193
+ A --> B[Set verification_success<br/>= action output]
194
+ B --> C{verification_success<br/>== true?}
195
+ C -->|Yes| D[Offer protected operations]
196
+ C -->|No| E[Explain verification failure]
197
+ ```
198
+
199
+ ### Subagent Transitions
200
+
201
+ When logic determines a new subagent should be active.
202
+
203
+ ```mermaid
204
+ %%{init: {'theme':'neutral'}}%%
205
+ graph TD
206
+ A[current_subagent<br/>Subagent]
207
+ A --> B{Transition<br/>condition?}
208
+ B -->|Yes| C[Transition to<br/>next_subagent]
209
+ C --> D[next_subagent<br/>Subagent]
210
+ B -->|No| E[Continue in<br/>current_subagent]
211
+ ```
212
+
213
+ ### Off-Topic and Escalation Routing
214
+
215
+ How the agent handles out-of-scope requests.
216
+
217
+ ```mermaid
218
+ %%{init: {'theme':'neutral'}}%%
219
+ graph TD
220
+ A[start_agent<br/>agent_router]
221
+ A -->|out of scope| B[off_topic<br/>Subagent]
222
+ A -->|needs help| C[escalation<br/>Subagent]
223
+ B --> D[Instruction: redirect user]
224
+ C --> E[Call @utils.escalate]
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Complete Example: Local_Info_Agent
230
+
231
+ This example demonstrates a complete Subagent Map for a guest information
232
+ agent. It needs no mutable state: surviving conversation history carries
233
+ follow-up context, and each action can slot-fill its input from the conversation.
234
+
235
+ ```mermaid
236
+ %%{init: {'theme':'neutral'}}%%
237
+ graph TD
238
+ A[start_agent<br/>agent_router]
239
+
240
+ A -->|weather query| B[local_weather<br/>Subagent]
241
+ A -->|events query| C[local_events<br/>Subagent]
242
+ A -->|hours query| D[resort_hours<br/>Subagent]
243
+ A -->|unclear intent| E[ambiguous_question<br/>Subagent]
244
+ A -->|out of scope| F[off_topic<br/>Subagent]
245
+ A -->|needs escalation| G[escalation<br/>Subagent]
246
+
247
+ B --> B1[Call check_weather<br/>backing: Apex]
248
+ B1 --> B2[Continue]
249
+
250
+ C --> C1[Call check_events<br/>backing: Prompt Template]
251
+ C1 --> C2[Continue]
252
+
253
+ D --> D1[Call get_resort_hours<br/>backing: Flow]
254
+ D1 --> D2[Continue]
255
+
256
+ E --> E1[Instruction: ask for clarification]
257
+ E1 --> E2[Await user input]
258
+ E2 --> A
259
+
260
+ F --> F1[Instruction: explain available subagents]
261
+ F1 --> F2[Continue]
262
+
263
+ G --> G1[Call @utils.escalate]
264
+ G1 --> G2[Continue]
265
+ ```
266
+
267
+ ### Subagent Descriptions
268
+
269
+ **local_weather**: Provides weather information via Apex-backed action. No preconditions.
270
+
271
+ **local_events**: Uses the Prompt Template-backed action when the user asks for
272
+ events. Its conversational input is slot-filled from the current turn and
273
+ surviving history.
274
+
275
+ **resort_hours**: Calls a Flow-backed action and presents its returned hours.
276
+
277
+ **ambiguous_question**: No actions. Requests clarification and routes back to start_agent.
278
+
279
+ **off_topic**: No actions. Explains available subagents and continues conversation.
280
+
281
+ **escalation**: Calls @utils.escalate utility to route to human agent.
282
+
283
+ **start_agent agent_router**: Routes incoming user input to appropriate subagents based on intent.
284
+
285
+ ---
286
+
287
+ ## Validation Checklist
288
+
289
+ Before finalizing a Subagent Map diagram:
290
+
291
+ - [ ] Uses `graph TD` syntax
292
+ - [ ] Starts with `%%{init: {'theme':'neutral'}}%%`
293
+ - [ ] `start_agent` is node A at top; use `agent_router` only for a
294
+ router-first multi-domain design
295
+ - [ ] Nodes use sequential capital letter IDs
296
+ - [ ] All subagents labeled with `[subagent_name<br/>Subagent]` format
297
+ - [ ] Action calls include backing type (Apex, Prompt Template, Flow)
298
+ - [ ] Machine-enforced gates that materially affect the map are shown as
299
+ decision nodes and labeled with their actual predicate
300
+ - [ ] Semantic model decisions are labeled in natural language rather than as
301
+ machine checks
302
+ - [ ] Every shown variable has a trusted writer and named runtime consumer
303
+ - [ ] Variable state changes that affect logic are labeled with `[Set variable = value]`
304
+ - [ ] Escalation uses `[Call @utils.escalate]` format
305
+ - [ ] All transition branches are labeled
306
+ - [ ] Diagram remains readable; split or summarize it when detail obscures the
307
+ architecture
308
+ - [ ] Subagent routing from start_agent is clear
309
+ - [ ] Required off-topic, escalation, and conditional paths are visible
310
+
311
+ ---
312
+
313
+ ## Anti-patterns
314
+
315
+ ### Don't
316
+
317
+ - Place `start_agent` anywhere except top (node A)
318
+ - Label actions without backing type information
319
+ - Use ambiguous decision node labels (avoid `{Process?}`)
320
+ - Hide gating conditions in node descriptions instead of showing as decisions
321
+ - Omit variable state changes that affect downstream behavior
322
+ - Add variables for facts already available in surviving conversation history
323
+ - Show a state node without its trusted writer and named consumer
324
+ - Create subagent routing without labels on the decision logic
325
+ - Mix subagent nodes with action nodes at same level without clear containment
326
+ - Use custom color styling (breaks in dark mode)
327
+ - Omit off-topic or escalation paths that the intended use cases require
328
+
329
+ ### Do
330
+
331
+ - Keep the selected `start_agent` at the top
332
+ - Show all subagents reachable from start_agent
333
+ - Include backing type for every action call
334
+ - Make material machine-enforced gates explicit as decision nodes
335
+ - Show justified variable updates as separate nodes when they affect logic flow
336
+ - Label all transition branches
337
+ - Include off-topic and escalation subagents when the design calls for them
338
+ - Show material conditional branches without implying that every model
339
+ judgment is a runtime predicate
340
+ - Use `%%{init: {'theme':'neutral'}}%%` for light/dark mode compatibility
341
+ - Focus diagram on subagent structure, not detailed action logic