@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,1390 @@
1
+ # Agent Script: Core Language Reference
2
+
3
+ ## Table of Contents
4
+
5
+ 1. How Agent Script Executes
6
+ 2. File Structure and Block Ordering
7
+ 3. Naming and Formatting Rules
8
+ 4. Expressions and Operators
9
+ 5. System and Config Blocks
10
+ 6. Variables
11
+ 7. Subagents
12
+ 8. Reasoning Instructions
13
+ 9. Flow Control
14
+ 10. Actions
15
+ 11. Utility Functions
16
+ 12. Anti-Patterns
17
+
18
+ ---
19
+
20
+ ## 1. How Agent Script Executes
21
+
22
+ Agent Script operates in two phases: deterministic resolution, then LLM reasoning.
23
+
24
+ **Phase 1: Deterministic Resolution.** The runtime executes a subagent's reasoning instructions top to bottom — evaluating `if`/`else` conditions, running actions via `run`, and setting variables via `set`. The LLM is NOT involved yet. The runtime builds a prompt string by accumulating `|` pipe text and resolving conditional logic. If a `transition` command occurs, the current subagent stops resolving and the target subagent begins its lifecycle with shared state and conversation history retained.
25
+
26
+ **Phase 2: LLM Reasoning.** The runtime passes the resolved prompt to the LLM along with any reasoning actions (tools) the subagent exposes. The LLM decides what to do — it can call available actions but cannot modify the prompt text. It only reasons against what Phase 1 resolved.
27
+
28
+ **Worked Example.** Consider this subagent:
29
+
30
+ ```agentscript
31
+ subagent check_order:
32
+ reasoning:
33
+ instructions: ->
34
+ if @variables.order_id != "":
35
+ run @actions.fetch_order
36
+ with id = @variables.order_id
37
+ set @variables.status = @outputs.status
38
+
39
+ | Tell the user the exact order status is {!@variables.status} and
40
+ use {!@actions.update_order} for a requested modification.
41
+
42
+ actions:
43
+ update: @actions.update_order
44
+ with order_id = @variables.order_id
45
+ ```
46
+
47
+ If `@variables.order_id` is `"1001"` and the `fetch_order` action returns `status = "shipped"`, the runtime resolves to this prompt:
48
+
49
+ ```text
50
+ Your order status is shipped.
51
+ You can modify it using the update_order action.
52
+ ```
53
+
54
+ The LLM then receives this prompt plus the `update` tool and decides whether to call it based on what the user asks.
55
+
56
+ This split is critical: **deterministic resolution controls which authored
57
+ prompt text and tools reach the planner; the LLM chooses its text and
58
+ model-selected actions within that resolved context**.
59
+
60
+ ---
61
+
62
+ ## 2. File Structure and Block Ordering
63
+
64
+ An Agent Script file (`.agent` extension) contains eight top-level blocks. The recommended order when generating new agents is:
65
+
66
+ ```agentscript
67
+ system:
68
+ ...
69
+
70
+ config:
71
+ ...
72
+
73
+ variables:
74
+ ...
75
+
76
+ connection:
77
+ ...
78
+
79
+ knowledge:
80
+ ...
81
+
82
+ language:
83
+ ...
84
+
85
+ modality voice:
86
+ ...
87
+
88
+ start_agent agent_router:
89
+ ...
90
+
91
+ subagent my_subagent:
92
+ ...
93
+ ```
94
+
95
+ **Required blocks:** `system`, `config`, `start_agent`, and at least one `subagent`.
96
+
97
+ **Optional blocks:** `variables`, `connections`, `knowledge`, `language`, `modality voice`. Omit them if not needed.
98
+
99
+ **Note:** The compiler does not enforce top-level block ordering. Use the order above when generating new files, but do not reorder existing files that use a different order — they are equally valid.
100
+
101
+ This page is a practical authoring reference, not an exhaustive schema for
102
+ every supported compiler or target version. In repair work, do not delete an
103
+ existing construct merely because an abbreviated list or example on this page
104
+ omits it. Preserve accepted constructs unless the selected compiler, target-org
105
+ validator, or concrete runtime evidence identifies a defect.
106
+
107
+ **Within `start_agent` and `subagent` blocks**, the internal ordering is:
108
+
109
+ 1. `label` (optional human-readable display name)
110
+ 2. `description` (required)
111
+ 3. `system` (optional — subagent-level override of global system instructions)
112
+ 4. `before_reasoning` (optional — runs before reasoning phase)
113
+ 5. `reasoning` (required)
114
+ 6. `after_reasoning` (optional — runs after reasoning phase)
115
+ 7. `actions` (optional — action definitions)
116
+
117
+ ---
118
+
119
+ ## 3. Naming and Formatting Rules
120
+
121
+ **Naming constraints for all identifiers** (developer_name, subagent names, variable names, action names, connection names):
122
+
123
+ - Contain only letters, numbers, and underscores
124
+ - Begin with a letter (never underscore)
125
+ - Cannot end with an underscore
126
+ - Cannot contain two consecutive underscores (`__`)
127
+ - Maximum 80 characters
128
+ - `snake_case` is strongly recommended
129
+
130
+ Example: `check_order_status` is valid. `check_order__status` is invalid (consecutive underscores).
131
+
132
+ **Indentation:** Generate new files with 4 spaces per structural level. Four spaces
133
+ is the formatter default and repository convention, not a grammar minimum: the
134
+ language accepts any deeper space indentation relative to the parent. Spaces are
135
+ the specification's standard; tabs are not portable because their behavior is
136
+ implementation-defined. Never mix structural tabs and spaces in one file. When
137
+ making a surgical edit to a consistently tab-indented legacy file, either preserve
138
+ that style and validate against the target runtime or normalize all structural
139
+ indentation as a separate change. Never partially normalize a file or blanket-
140
+ replace tabs inside template content. Lines at the same nesting level must use the
141
+ same indentation width.
142
+
143
+ Each nesting level adds one indent. The hierarchy follows the block structure — subagent → reasoning → instructions → logic/prompt:
144
+
145
+ ```agentscript
146
+ subagent process_order:
147
+ description: "Handle order processing"
148
+ reasoning:
149
+ instructions: ->
150
+ | Welcome
151
+ ```
152
+
153
+ **Comments:** Use `#` for single-line comments. The parser ignores everything after `#` on that line.
154
+
155
+ Comments can appear on their own line or inline after code. Both forms are valid:
156
+
157
+ ```agentscript
158
+ # This is a standalone comment
159
+ variables:
160
+ order_id: mutable string = "" # This is an inline comment
161
+ ```
162
+
163
+ ---
164
+
165
+ ## 4. Expressions and Operators
166
+
167
+ **Comparison operators**:
168
+
169
+ - `==` (equal): `@variables.status == "complete"`
170
+ - `!=` (not equal): `@variables.count != 0`
171
+ - `<` (less than): `@variables.price < 100`
172
+ - `<=` (less than or equal): `@variables.age <= 18`
173
+ - `>` (greater than): `@variables.amount > 50`
174
+ - `>=` (greater than or equal): `@variables.balance >= 0`
175
+ - `is` (identity check — use for None): `@variables.value is None`
176
+ - `is not` (negated identity check): `@variables.data is not None`
177
+
178
+ **Logical operators**:
179
+
180
+ - `and`: Both conditions must be true. `@variables.verified == True and @variables.age >= 18`
181
+ - `or`: Either condition can be true. `@variables.status == "pending" or @variables.status == "review"`
182
+ - `not`: Negates a condition. `not @variables.is_guest == True` (though `@variables.is_guest == False` is more readable)
183
+
184
+ **Arithmetic operators** (limited support):
185
+
186
+ - `+` (addition): `@variables.count + 1`
187
+ - `-` (subtraction): `@variables.total - @variables.discount`
188
+
189
+ Do NOT use `*`, `/`, `%` — they are not supported.
190
+
191
+ **Access operators**:
192
+
193
+ - `.` (property access): `@object.property`
194
+ - `[]` (index access): `@variables.items[0]`
195
+
196
+ **Conditional expressions**:
197
+
198
+ - `x if condition else y`: `"premium" if @variables.is_premium == True else "standard"`
199
+
200
+ **Template injection in strings** (within `|` multiline text):
201
+
202
+ Use `{!expression}` to inject variable values or expressions into prompt text:
203
+
204
+ ```agentscript
205
+ instructions: |
206
+ Your total is {!@variables.total}.
207
+ Your status: {!@variables.status if @variables.status else "pending"}.
208
+ ```
209
+
210
+ The expression inside `{! ... }` is evaluated by the runtime during deterministic resolution and the result replaces the entire `{! ... }` block in the prompt.
211
+
212
+ **Resource references**:
213
+
214
+ - `@actions.<name>` — reference an action defined in the subagent's `actions` block
215
+ - `@subagent.<name>` — reference a subagent by name
216
+ - `@variables.<name>` — reference a variable (use in logic)
217
+ - `{!@variables.<name>}` — reference a variable in prompt text (template injection)
218
+ - `@outputs.<name>` — action output (only in `set`/`if` immediately after the action — unavailable elsewhere)
219
+ - `@inputs.<name>` — action input (only in `with` during invocation — NOT in `set` or post-execution)
220
+ - `@utils.<function>` — reference a utility (escalate, transition to, setVariables)
221
+
222
+ **Do NOT use `<>` as inequality operator.** Use `!=` instead.
223
+
224
+ ```agentscript
225
+ # WRONG
226
+ if @variables.status <> "pending":
227
+
228
+ # CORRECT
229
+ if @variables.status != "pending":
230
+ ```
231
+
232
+ ---
233
+
234
+ ## 5. System and Config Blocks
235
+
236
+ **System block** provides global instructions and messages:
237
+
238
+ ```agentscript
239
+ system:
240
+ instructions: "You are a helpful assistant. Be professional and concise."
241
+ messages:
242
+ welcome: "Hello! How can I help?"
243
+ error: "Sorry, something went wrong. Please try again."
244
+ ```
245
+
246
+ The selected global or subagent `system.instructions` value is rendered on
247
+ each reasoning iteration and may contain merge fields such as
248
+ `{!@variables.account_status}`. It is declarative prompt text, not a procedure:
249
+ do not use `instructions: ->`, `run`, `set`, `if`, or `transition` inside a
250
+ system block. Put deterministic procedures in the supported lifecycle or
251
+ reasoning procedure blocks. Interpolation exposes a current value to the
252
+ model; it does not make the model's use of that value deterministic.
253
+
254
+ The `instructions` field is required and contains text directives sent to the LLM in every reasoning phase. Subagent-level system blocks can override this.
255
+
256
+ The `messages` block is optional. When a target or use case requires custom
257
+ welcome or error copy, define the relevant messages and validate them against
258
+ that target. Do not add messages, rewrite an existing instruction scalar, or
259
+ change tone during a bounded repair without an accepted finding tied to an
260
+ affected use case.
261
+
262
+ **Access and config blocks** contain runtime identity and agent metadata:
263
+
264
+ ```agentscript
265
+ access:
266
+ default_agent_user: "agent@example.com"
267
+
268
+ config:
269
+ developer_name: "Customer_Service_Agent"
270
+ agent_label: "Customer Service"
271
+ description: "Handles customer inquiries"
272
+ agent_type: "AgentforceServiceAgent"
273
+ ```
274
+
275
+ The `access:` form is covered by the compiler workflow in
276
+ [AgentScript Compiler Setup](agentscript-toolchain.md). Public npm packages,
277
+ public source, and target-org compilers can differ; record the local provider
278
+ and validate against the deployment org before release.
279
+
280
+ **Required fields:**
281
+ - `developer_name` (NOT `agent_name`) — unique identifier following naming rules. Must exactly match the AiAuthoringBundle directory name (e.g., if the directory is `aiAuthoringBundles/Travel_Advisor/`, then `developer_name` must be `"Travel_Advisor"`). A mismatch causes deploy failures.
282
+
283
+ **Recommended explicit field for newly authored bundles:**
284
+ - `agent_type` — `"AgentforceServiceAgent"` or `"AgentforceEmployeeAgent"`. Determines deployment context and whether `default_agent_user` is required:
285
+ - `"AgentforceServiceAgent"` — customer-facing, deployed via messaging channels. **Requires `default_agent_user`** with Einstein Agent license.
286
+ - `"AgentforceEmployeeAgent"` — internal employee-facing. Agent Script files with this agent type MUST NOT include:
287
+ - `access.default_agent_user`
288
+ - MessagingSession linked variables (`EndUserId`, `RoutableId`, `ContactId`, `EndUserLanguage`)
289
+ - Escalation subagent with `@utils.escalate`
290
+ - `connection messaging:` block
291
+
292
+ Existing bundles and compiler versions can accept an omitted `agent_type`;
293
+ some environments apply a default. Do not add or change it during a bounded
294
+ repair merely to complete the schema. Require a target diagnostic or a
295
+ user-declared deployment context, and do not infer employee versus service
296
+ type from wording or from the absence of channel-specific constructs alone.
297
+ When creating a new bundle, set it explicitly and validate the related
298
+ access and connection contracts against the target org.
299
+
300
+ **Common mistake — service-agent constructs on employee agent:**
301
+
302
+ ```agentscript
303
+ # WRONG — employee agent with service-agent constructs
304
+ access:
305
+ default_agent_user: "agent@org.ext" # PROHIBITED — causes "Internal Error"
306
+ config:
307
+ agent_type: "AgentforceEmployeeAgent"
308
+ variables:
309
+ EndUserId: linked string # SERVICE ONLY — no messaging session
310
+ source: @MessagingSession.MessagingEndUserId
311
+ connection messaging: # SERVICE ONLY — no messaging channel
312
+ escalation_message: "Transferring..."
313
+
314
+ # RIGHT — clean employee agent config
315
+ config:
316
+ agent_type: "AgentforceEmployeeAgent"
317
+ # No access block, MessagingSession vars, or connection block
318
+ ```
319
+
320
+ **Conditionally required fields:**
321
+ - `access.default_agent_user` — **required for `AgentforceServiceAgent`, normally omitted for `AgentforceEmployeeAgent`**. This is the Salesforce username of the Einstein Agent User that runs agent actions on behalf of the customer. The user must exist in the target org, be active, and have the Einstein Agent license assigned.
322
+
323
+ **⚠️ CRITICAL: Setting `default_agent_user` on an `AgentforceEmployeeAgent` causes publish and preview to fail with an unhelpful "unknown error" or "Internal Error, try again later" message.** The error gives no indication that `default_agent_user` is the cause. If you encounter this error on an employee agent, check whether `default_agent_user` is set and remove it.
324
+
325
+ To find a valid Einstein Agent User in the org:
326
+ ```bash
327
+ sf data query --json -q "SELECT Username FROM User WHERE Profile.UserLicense.Name = 'Einstein Agent' AND IsActive = true LIMIT 5"
328
+ ```
329
+
330
+ If no results are returned, the org does not have an Einstein Agent User configured. Read `references/salesforce-cli-for-agents.md` for steps to create one.
331
+
332
+ This field can be changed after publish, but only while no published version is activated. Deactivate the agent before changing `default_agent_user`.
333
+
334
+ **Optional fields:**
335
+ - `agent_label` — human-readable display name. Defaults to normalized `developer_name` if omitted
336
+ - `description` — what the agent does
337
+
338
+ ---
339
+
340
+ ## 6. Variables
341
+
342
+ **Two types of variables**:
343
+
344
+ **Mutable variables** — the agent can read AND write. MUST have a default value:
345
+
346
+ ```agentscript
347
+ variables:
348
+ customer_name: mutable string = ""
349
+ description: "The customer's full name"
350
+ order_count: mutable number = 0
351
+ is_premium: mutable boolean = False
352
+ preferences: mutable object = {}
353
+ items: mutable list[string] = []
354
+ ```
355
+
356
+ The `description` field is optional. Include it when the LLM needs context for slot-filling via `@utils.setVariables`.
357
+
358
+ **Linked variables** — read-only from external context. MUST have a `source`, MUST NOT have a default value:
359
+
360
+ ```agentscript
361
+ variables:
362
+ session_id: linked string
363
+ description: "The current session ID"
364
+ source: @session.sessionID
365
+ user_id: linked string
366
+ source: @MessagingSession.MessagingEndUserId
367
+ ```
368
+
369
+ The `source` field points to the external context. At runtime, the platform provides the value.
370
+
371
+ **Type constraints by context**:
372
+
373
+ - Mutable variable types: `string`, `number`, `boolean`, `object`, `date`, `id`, `list[T]`
374
+ - Linked variable types: `string`, `number`, `boolean`, `date`, `id` (no `list`)
375
+ - Action parameter types: `string`, `number`, `boolean`, `object`, `date`, `timestamp`, `currency`, `id`, `list[T]`, `datetime`, `time`, `integer`, `long`
376
+
377
+ > ⚠️ `timestamp` and `currency` compile as variable types but are absent from official GA documentation and should NOT be used. Prefer `date` for date/time variables and `number` for currency values.
378
+
379
+ **Some types are ONLY valid for action parameters**:
380
+ `integer`, `long`, `datetime`, and `time` are action-parameter-only types. They are NOT valid for mutable or linked variables:
381
+
382
+ ```agentscript
383
+ # WRONG — integer is not valid for mutable variables
384
+ low_count: mutable integer = 0
385
+
386
+ # RIGHT — use number for mutable variables
387
+ low_count: mutable number = 0
388
+ ```
389
+
390
+ **`complex_data_type_name` for action parameters**: The simple types listed above (`date`, `integer`, `datetime`, `long`) work directly for Apex-backed action parameters — no special mapping needed. The `object` + `complex_data_type_name` pattern is only required for SObject references, Apex inner classes, custom Lightning types, and typed collections. Read `references/agent-design-and-spec-creation.md` for the full Apex ↔ Agent Script type mapping table.
391
+
392
+ **Boolean capitalization**:
393
+
394
+ ALWAYS use `True` or `False` (capitalized). NEVER use `true` or `false`:
395
+
396
+ ```agentscript
397
+ # WRONG
398
+ enabled: mutable boolean = true
399
+ verified: linked boolean = false
400
+
401
+ # CORRECT
402
+ enabled: mutable boolean = True
403
+ is_verified: mutable boolean = False
404
+ ```
405
+
406
+ **Template injection for variables** in prompt text:
407
+
408
+ Use `{!@variables.X}` to interpolate a variable's value into prompt text:
409
+
410
+ ```agentscript
411
+ instructions: |
412
+ Hello, {!@variables.customer_name}!
413
+ Your balance: {!@variables.balance}
414
+ ```
415
+
416
+ In prompt text (inside `|` pipe sections), always use `{!@variables.X}` with braces — the braces trigger template evaluation. Bare `@variables.X` without braces is valid in logic contexts (e.g., `if @variables.X == True:`) but will not interpolate in prompt text.
417
+
418
+ ---
419
+
420
+ ## 7. Subagents
421
+
422
+ **Subagent structure** — a named scope for reasoning, actions, and flow control:
423
+
424
+ ```agentscript
425
+ subagent order_lookup:
426
+ label: "Order Lookup"
427
+ description: "Handle customer order inquiries"
428
+
429
+ reasoning:
430
+ instructions: ->
431
+ | Help the customer find their order.
432
+ actions:
433
+ search: @actions.find_order
434
+ with order_id = ...
435
+
436
+ actions:
437
+ find_order:
438
+ description: "Search for an order by ID"
439
+ target: "flow://SearchOrder"
440
+ inputs:
441
+ order_id: string
442
+ outputs:
443
+ status: string
444
+ ```
445
+
446
+ **Description is required** — the LLM uses this to understand when the subagent is relevant.
447
+
448
+ **Label is optional** — use `label` on `start_agent` or `subagent` when a
449
+ human-readable display name is useful. It is distinct from top-level
450
+ `config.agent_label`. Preserve an existing `label` during repair unless the
451
+ selected compiler or deployment target rejects it.
452
+
453
+ **Subagent-level system override** (optional) — replaces global system
454
+ instructions for this subagent and does not merge with them. Omit the override
455
+ when global instructions should remain intact. If an override is necessary,
456
+ repeat every durable identity, safety, and scope invariant the subagent must
457
+ retain:
458
+
459
+ ```agentscript
460
+ subagent product_specialist:
461
+ description: "Answer product questions"
462
+ system:
463
+ instructions: "You are a product expert. Be technical and detailed."
464
+ reasoning:
465
+ instructions: ->
466
+ | Help with product specs.
467
+ ```
468
+
469
+ **Internal block ordering within a subagent**:
470
+
471
+ 1. `label` (optional display name)
472
+ 2. `description`
473
+ 3. `system` (optional override)
474
+ 4. `before_reasoning` (optional)
475
+ 5. `reasoning` (required)
476
+ 6. `after_reasoning` (optional)
477
+ 7. `actions` (optional definitions)
478
+
479
+ **Before/after reasoning directive blocks**:
480
+
481
+ `before_reasoning` and `after_reasoning` contain deterministic logic that runs outside the reasoning phase:
482
+
483
+ ```agentscript
484
+ before_reasoning:
485
+ if @variables.session_expired:
486
+ transition to @subagent.login
487
+
488
+ reasoning:
489
+ instructions: ->
490
+ | Main subagent logic
491
+
492
+ after_reasoning:
493
+ if @variables.transaction_complete:
494
+ transition to @subagent.confirmation
495
+ ```
496
+
497
+ Directive blocks use the arrow syntax (`->`) for logic but no LLM reasoning. They run deterministically.
498
+
499
+ ---
500
+
501
+ ## 8. Reasoning Instructions
502
+
503
+ Reasoning instructions combine deterministic logic and prompt text. The runtime resolves deterministic parts first, then sends the resulting prompt to the LLM for reasoning.
504
+
505
+ The resolved prompt is rebuilt for every reasoning iteration. A completed tool
506
+ batch normally leads to another iteration unless execution hands off, pauses,
507
+ is cancelled, or reaches a limit. Keep the prompt short and task-local: current
508
+ objective, relevant state, action guidance, exclusions, and stop conditions. Keep persona,
509
+ tone, disclosure, safety, and broad scope rules in the effective system layer.
510
+ Treat effective system and reasoning text as cumulative unless the target
511
+ runtime's public, versioned contract guarantees different precedence, so the
512
+ two surfaces must agree. In particular, do not combine an unconditional global
513
+ instruction to answer or help with instructions that require routing,
514
+ verification, refusal, or escalation without answering. Do not rely on
515
+ structured active-subagent identity or direct variable-store access unless the
516
+ runtime explicitly provides it; state the concrete operating task. See
517
+ [Instruction Resolution](instruction-resolution.md#scope-response-duties-by-branch).
518
+
519
+ **Arrow syntax (`->`) for logic blocks**:
520
+
521
+ ```agentscript
522
+ reasoning:
523
+ instructions: ->
524
+ if @variables.user_verified:
525
+ run @actions.get_account
526
+ with user_id = @variables.user_id
527
+ set @variables.account_info = @outputs.account
528
+
529
+ | Now tell the user their account balance.
530
+ ```
531
+
532
+ The `->` prefix indicates "start with logic, then switch to prompt". The runtime evaluates the `if` condition and `run` command, then appends the pipe-delimited text to the prompt.
533
+
534
+ **Multiline strings with `|`** — two forms:
535
+
536
+ For static text with no logic, use `|` directly after the property:
537
+
538
+ ```agentscript
539
+ instructions: |
540
+ Welcome to our service!
541
+ Please provide details about your request.
542
+ I'll help you with whatever you need.
543
+ ```
544
+
545
+ Static `|` instructions can coexist with a sibling `actions:` block under `reasoning:`:
546
+
547
+ ```agentscript
548
+ reasoning:
549
+ instructions: |
550
+ Help the customer find a venue.
551
+ After receiving results from {!@actions.search_venues}, present them clearly.
552
+ Do NOT call the action again unless the customer asks for a new search.
553
+
554
+ actions:
555
+ find_venue: @actions.search_venues
556
+ description: "Search for available venues"
557
+ with location = ...
558
+ with date = ...
559
+ ```
560
+
561
+ For text mixed with logic, use `->` to enter a logic block, then `|` to switch to prompt text:
562
+
563
+ ```agentscript
564
+ instructions: ->
565
+ if @variables.needs_help:
566
+ | Ask the user what they need help with.
567
+ else:
568
+ | Suggest self-service options.
569
+ ```
570
+
571
+ Within `->` blocks, a line without `|` continues the current prompt fragment.
572
+ Use one `|` per contiguous block and align continuation lines beneath its
573
+ content:
574
+
575
+ ```agentscript
576
+ instructions: ->
577
+ | This is a long instruction that
578
+ continues on the next physical line.
579
+ This remains part of the same prompt block.
580
+ ```
581
+
582
+ Start another `|` after a runtime statement or conditional boundary when a new
583
+ prompt fragment is structurally required. Repeating `|` on every adjacent
584
+ sentence is valid syntax, but it does not create steps or control flow.
585
+
586
+ ### Conditional Control Flow Syntax
587
+
588
+ When authoring a new two-way branch whose alternatives are exclusive, prefer
589
+ `if / else`:
590
+
591
+ ```agentscript
592
+ if @variables.count < 5:
593
+ run @actions.small
594
+ else:
595
+ run @actions.large
596
+ ```
597
+
598
+ For three or more alternatives where exactly one branch should run, use an
599
+ `if / else if / else` chain. The first matching branch wins:
600
+
601
+ ```agentscript
602
+ if @variables.count < 5:
603
+ run @actions.small
604
+ else if @variables.count < 10:
605
+ run @actions.medium
606
+ else:
607
+ run @actions.large
608
+ ```
609
+
610
+ Spell the clause `else if`; Python-style `elif` is not valid AgentScript. Do not
611
+ place a separate `if` inside a conditional body: true user-written nested
612
+ conditionals are unsupported. Combine predicates with `and` or `or`, or use an
613
+ `else if` chain.
614
+
615
+ Sequential top-level `if` statements execute independently. Use them when more
616
+ than one branch may need to run, or when their predicates are intentionally and
617
+ provably mutually exclusive. For new alternative branches, an `else if` chain
618
+ usually expresses first-match priority more clearly. In a bounded repair, do
619
+ not rewrite equivalent, mutually exclusive conditions solely to normalize
620
+ style; require a diagnostic, overlap, gap, priority error, or affected use case.
621
+
622
+ A direct post-action `if` in a `run @actions.*` body is also supported:
623
+
624
+ ```agentscript
625
+ run @actions.process_order
626
+ with order_id = @variables.order_id
627
+ set @variables.result = @outputs.status
628
+ if @outputs.success == True:
629
+ transition to @subagent.confirmation
630
+ else:
631
+ transition to @subagent.error_handling
632
+ ```
633
+
634
+ **Inline action invocation (`run @actions.X`)**:
635
+
636
+ ```agentscript
637
+ run @actions.check_inventory
638
+ with product_id = @variables.selected_product
639
+ set @variables.stock_level = @outputs.available_quantity
640
+ ```
641
+
642
+ The `run` command executes the action deterministically — the runtime runs it before the LLM reasons. Use `with` to pass inputs (bound to variables or literal values). Use `set` to capture outputs into variables.
643
+
644
+ **Post-action directives** work only for `@actions`, not `@utils`. After an
645
+ action completes, you can check outputs and transition as shown in the
646
+ conditional syntax section above.
647
+
648
+ **Scope lifecycle — `@inputs` and `@outputs` are ephemeral:**
649
+ - `@inputs`: only in `with` directives during invocation. NOT in `set`/`if` after execution.
650
+ - `@outputs`: only in `set`/`if` immediately after invocation. NOT in instructions or later actions.
651
+ - To reuse an input value post-execution, capture it in `@variables` BEFORE the action call.
652
+
653
+ ```agentscript
654
+ # WRONG — silent failure, @inputs out of scope in set
655
+ run @actions.get_station_status
656
+ with station_name = ...
657
+ set @variables.station = @inputs.station_name # FAILS SILENTLY
658
+
659
+ # RIGHT — use @outputs (if action echoes value) or capture input beforehand
660
+ run @actions.get_station_status
661
+ with station_name = ...
662
+ set @variables.station = @outputs.station_name
663
+ ```
664
+
665
+ **How pipe sections become the LLM prompt**:
666
+
667
+ All logic is resolved first; only matching `|` pipe lines are included in the prompt:
668
+
669
+ ```agentscript
670
+ instructions: ->
671
+ | Welcome the user.
672
+ if @variables.is_returning:
673
+ | Acknowledge that they are returning.
674
+ else:
675
+ | Greet them as a new user.
676
+ | Ask how you can help.
677
+
678
+ # If is_returning == False, the prompt becomes:
679
+ # "Welcome the user. Greet them as a new user. Ask how you can help."
680
+ ```
681
+
682
+ Indentation and step numbering inside the emitted pipe text affect only the
683
+ text shown to the model. They do not create nested executable scope. Likewise,
684
+ words such as `Show`, `Ask`, `Call`, `Set`, `STOP`, and `Continue` inside pipe
685
+ text are natural-language instructions, not AgentScript directives.
686
+
687
+ Action availability is resolved independently from prompt layout. Mentioning an
688
+ action beneath one conditional pipe block does not hide that action when the
689
+ condition is false. Use `available when` when an action must exist only for a
690
+ machine-known branch.
691
+
692
+ For a review checklist and paired examples, see
693
+ [Common Control-Flow Pitfalls](common-control-flow-pitfalls.md).
694
+
695
+ ---
696
+
697
+ ## 9. Flow Control
698
+
699
+ Flow control determines how execution moves between subagents and responds to conditions.
700
+
701
+ **Start agent subagent** — the mandatory entry point:
702
+
703
+ Every conversation begins at `start_agent`. The LLM classifies the user's intent and routes to the appropriate subagent:
704
+
705
+ ```agentscript
706
+ start_agent agent_router:
707
+ description: "Route to appropriate subagent"
708
+ reasoning:
709
+ instructions: ->
710
+ | Welcome. I can help with orders, accounts, or billing.
711
+ actions:
712
+ go_orders: @utils.transition to @subagent.order_info
713
+ description: "For order inquiries"
714
+ go_accounts: @utils.transition to @subagent.account_help
715
+ description: "For account questions"
716
+ ```
717
+
718
+ **LLM-chosen transitions in reasoning actions**:
719
+
720
+ Expose the transition as a reasoning action when the LLM should judge the right moment:
721
+
722
+ ```agentscript
723
+ reasoning:
724
+ actions:
725
+ go_next: @utils.transition to @subagent.next_subagent
726
+ description: "Move to the next subagent"
727
+ available when @variables.ready == True
728
+ ```
729
+
730
+ **Deterministic transitions in directive blocks**:
731
+
732
+ Use bare `transition to` in `before_reasoning` and `after_reasoning` for state-based transitions:
733
+
734
+ ```agentscript
735
+ before_reasoning:
736
+ if @variables.not_authenticated:
737
+ transition to @subagent.login
738
+
739
+ after_reasoning:
740
+ if @variables.session_complete:
741
+ transition to @subagent.summary
742
+ ```
743
+
744
+ The runtime evaluates the condition and transitions immediately. Do NOT use `@utils.transition to` in directive blocks — it causes compilation errors.
745
+
746
+ **Delegation with return**:
747
+
748
+ When a subagent needs another subagent's expertise but still has work to do afterward, use `@subagent.X` to delegate. The target subagent runs its reasoning, then returns control to the caller:
749
+
750
+ ```agentscript
751
+ reasoning:
752
+ actions:
753
+ ask_expert: @subagent.expert_consultation
754
+ description: "Consult the expert subagent"
755
+ ```
756
+
757
+ This is different from `@utils.transition to`, which is one-way — the calling subagent does not resume.
758
+
759
+ **Conditional branching within subagents**:
760
+
761
+ Conditions in reasoning instructions control which prompt text the LLM ultimately receives. The runtime evaluates `if`/`else` branches and includes only the matching `|` pipe sections in the resolved prompt:
762
+
763
+ ```agentscript
764
+ reasoning:
765
+ instructions: ->
766
+ if @variables.order_id != "":
767
+ | Show order details for {!@variables.order_id}.
768
+ else:
769
+ | Ask the user for the order ID needed to continue.
770
+ ```
771
+
772
+ ---
773
+
774
+ ## 10. Actions
775
+
776
+ Actions invoke Flows, Apex classes, Prompt Templates, or other target types. They can run deterministically (the runtime always executes them) or be exposed as tools for the LLM to choose at reasoning time.
777
+
778
+ **Action definition** — each action is defined in the subagent's `actions` block with required and optional properties:
779
+
780
+ ```agentscript
781
+ actions:
782
+ get_customer:
783
+ # Required properties
784
+ target: "flow://GetCustomerInfo"
785
+ description: "Fetches customer information"
786
+ # Optional UI/UX properties
787
+ label: "Get Customer"
788
+ require_user_confirmation: False
789
+ include_in_progress_indicator: True
790
+ progress_indicator_message: "Looking up customer..."
791
+ inputs:
792
+ customer_id: string
793
+ description: "The customer's unique ID"
794
+ label: "Customer ID"
795
+ is_required: True
796
+ outputs:
797
+ name: string
798
+ description: "Customer's name"
799
+ is_displayable: True
800
+ customer_info: object
801
+ complex_data_type_name: "lightning__recordInfoType"
802
+ description: "Full customer record"
803
+ filter_from_agent: True
804
+ ```
805
+
806
+ **Action properties**:
807
+
808
+ - `target` (required) — reference to the executable, in the format `"type://DeveloperName"`
809
+ - `description` (optional) — the LLM uses this to decide when to call the action
810
+ - `label` (optional) — display name shown to the customer; auto-generated from action name if omitted
811
+ - `require_user_confirmation` (optional boolean) — when `True`, the customer must confirm before the action runs
812
+ - `include_in_progress_indicator` (optional boolean) — when `True`, shows a progress indicator during execution
813
+ - `progress_indicator_message` (optional string) — text shown during execution (e.g., `"Looking up customer..."`)
814
+
815
+ **Input properties**:
816
+
817
+ - `description` — metadata about the input parameter
818
+ - `label` — display name shown in UI; auto-generated from parameter name if omitted
819
+ - `is_required` (boolean) — when `True`, the input must be provided
820
+
821
+ **Output properties**:
822
+
823
+ - `description` — metadata about the output parameter
824
+ - `label` — display name shown in UI; auto-generated from parameter name if omitted
825
+ - `filter_from_agent` (boolean) — when `True`, hides the output from the LLM's context
826
+ - `is_displayable` (boolean) — controls whether output is shown to the customer
827
+ - `complex_data_type_name` — required for complex data types like SObject references (e.g., `"lightning__recordInfoType"`), Apex inner classes, and custom Lightning types. Not needed for simple types like `date`, `integer`, or `datetime` — use the simple type directly.
828
+
829
+ **Parameter names must exactly match the action implementation interface — including case.** Read the target class before writing the action definition.
830
+
831
+ Given this Apex class:
832
+
833
+ ```java
834
+ public class CheckVenueAvailability {
835
+ public class Request {
836
+ @InvocableVariable public String venueName;
837
+ @InvocableVariable public Date requestedDate;
838
+ }
839
+ }
840
+ ```
841
+
842
+ ```agentscript
843
+ # WRONG — snake_case does not match @InvocableVariable field names
844
+ inputs:
845
+ venue_name: string
846
+ requested_date: date
847
+
848
+ # RIGHT — exact match to @InvocableVariable names
849
+ inputs:
850
+ venueName: string
851
+ requestedDate: date
852
+ ```
853
+
854
+ Flow targets: match the Flow's input/output variable API names. Prompt Template targets: see "Prompt Template actions" below.
855
+
856
+ **Target types** — use the format `"type://DeveloperName"`:
857
+
858
+ Common targets:
859
+
860
+ - `flow` — Salesforce Flow (e.g., `"flow://GetCustomerInfo"`)
861
+ - `apex` — Invocable Apex class (e.g., `"apex://CheckWeather"`)
862
+ - `prompt` — Prompt Template (e.g., `"prompt://Get_Event_Info"`; long form: `generatePromptResponse`)
863
+
864
+ Additional targets:
865
+
866
+ - `standardInvocableAction` — built-in Salesforce actions
867
+ - `externalService` — external APIs registered via External Services
868
+ - `quickAction` — Salesforce Quick Actions
869
+ - `api` — REST API endpoints
870
+ - `apexRest` — Apex REST services
871
+ - `serviceCatalog` — Service Catalog items
872
+ - `integrationProcedureAction` — OmniStudio Integration Procedures
873
+ - `expressionSet` — Business Rules Engine expression sets
874
+ - `cdpMlPrediction` — Data Cloud ML predictions
875
+ - `externalConnector` — external system connectors
876
+ - `slack` — Slack integrations
877
+ - `namedQuery` — named SOQL queries
878
+ - `auraEnabled` — Aura-enabled Apex methods
879
+ - `mcpTool` — Model Context Protocol tools
880
+ - `retriever` — knowledge retrieval sources
881
+
882
+ **Prompt Template actions** differ from Apex and Flow actions:
883
+
884
+ 1. Input names use a quoted `"Input:"` prefix: `"Input:fieldApiName"`.
885
+ 2. Output is always `promptResponse: string`.
886
+ 3. Target protocol is `generatePromptResponse://` (long form) or `prompt://` (short form).
887
+
888
+ ```agentscript
889
+ # WRONG — bare input names and custom output (Apex/Flow pattern)
890
+ actions:
891
+ Generate_Schedule:
892
+ inputs:
893
+ email: string
894
+ outputs:
895
+ schedule_text: string
896
+ target: "prompt://Generate_Personalized_Schedule"
897
+
898
+ # RIGHT — quoted "Input:" prefix, promptResponse output
899
+ actions:
900
+ Generate_Schedule:
901
+ inputs:
902
+ "Input:email": string
903
+ description: "User's email address"
904
+ is_required: True
905
+ outputs:
906
+ promptResponse: string
907
+ description: "Generated schedule"
908
+ is_displayable: True
909
+ target: "generatePromptResponse://Generate_Personalized_Schedule"
910
+ ```
911
+
912
+ Invocation — quote the input name:
913
+
914
+ ```agentscript
915
+ reasoning:
916
+ actions:
917
+ generate: @actions.Generate_Schedule
918
+ with "Input:email" = @variables.user_email
919
+ set @variables.schedule = @outputs.promptResponse
920
+ ```
921
+
922
+ **Deterministic invocation** — when the action must always run, use `run` in the reasoning instructions. The runtime executes it before the LLM reasons:
923
+
924
+ ```agentscript
925
+ reasoning:
926
+ instructions: ->
927
+ run @actions.get_customer
928
+ with customer_id = @variables.customer_id
929
+ set @variables.customer_name = @outputs.name
930
+ set @variables.customer_email = @outputs.email
931
+ ```
932
+
933
+ **LLM exposure** — when the LLM should decide whether and when to call the action, list it in `reasoning.actions`. The LLM sees the description and chooses based on conversation context:
934
+
935
+ ```agentscript
936
+ reasoning:
937
+ actions:
938
+ lookup: @actions.get_customer
939
+ description: "Look up customer information"
940
+ with customer_id = @variables.selected_customer
941
+ set @variables.customer_name = @outputs.name
942
+ ```
943
+
944
+ **Input binding** — three patterns for providing values to action inputs:
945
+
946
+ ```agentscript
947
+ reasoning:
948
+ actions:
949
+ search: @actions.search_products
950
+ # LLM slot-fills: extracts value from conversation
951
+ with query = ...
952
+ with category = ...
953
+
954
+ lookup: @actions.get_customer
955
+ # Variable binding: prefilled from state
956
+ with customer_id = @variables.selected_customer
957
+ # Literal value: fixed at definition time
958
+ with include_archive = False
959
+ ```
960
+
961
+ **Gating** — `available when` controls which actions the LLM can see based on current state:
962
+
963
+ ```agentscript
964
+ reasoning:
965
+ actions:
966
+ check_status: @actions.order_status
967
+ description: "Check your order status"
968
+ available when @variables.order_id != ""
969
+
970
+ place_order: @actions.create_order
971
+ description: "Place a new order"
972
+ available when @variables.cart_total > 0
973
+ ```
974
+
975
+ **Output capture** — use `set` to store action outputs in variables:
976
+
977
+ ```agentscript
978
+ run @actions.fetch_order
979
+ with id = @variables.order_id
980
+ set @variables.status = @outputs.status
981
+ set @variables.total = @outputs.total
982
+ ```
983
+
984
+ ---
985
+
986
+ ## 11. Utility Functions
987
+
988
+ Utility functions control flow and state. They do not call external systems.
989
+
990
+ **`@utils.transition to`** — non-returning handoff to another subagent (there
991
+ is no automatic return to the source):
992
+
993
+ ```agentscript
994
+ reasoning:
995
+ actions:
996
+ go_checkout: @utils.transition to @subagent.checkout
997
+ description: "Proceed to checkout"
998
+ available when @variables.cart_has_items == True
999
+ ```
1000
+
1001
+ Transition stops the current subagent before another planner call and starts
1002
+ the target subagent's lifecycle and prompt resolution. Shared state and
1003
+ conversation history persist, and the target may later transition elsewhere,
1004
+ including back to the source when the design allows it.
1005
+
1006
+ **`@utils.escalate`** — route to a human agent (**service agents only** — requires a `connection messaging:` block, which is only valid for `AgentforceServiceAgent`; do not use in employee agents):
1007
+
1008
+ ```agentscript
1009
+ reasoning:
1010
+ actions:
1011
+ get_help: @utils.escalate
1012
+ description: "Connect with a live agent"
1013
+ available when @variables.needs_human == True
1014
+ ```
1015
+
1016
+ Escalation ends the current agent turn and hands control to the escalation path
1017
+ defined by the connection block. What the downstream human-support session
1018
+ does next is outside the AgentScript utility's authoring contract.
1019
+
1020
+ **`@utils.setVariables`** — LLM-driven variable capture (slot-filling):
1021
+
1022
+ ```agentscript
1023
+ reasoning:
1024
+ actions:
1025
+ collect_info: @utils.setVariables
1026
+ description: "Collect customer preferences"
1027
+ with preferred_color = ...
1028
+ with budget = ...
1029
+ ```
1030
+
1031
+ The LLM extracts values from the conversation and populates the specified
1032
+ variables through a model-selected tool call. The call updates state but does
1033
+ not itself define a turn boundary. Any later reasoning or response follows the
1034
+ runtime's normal tool-loop behavior; do not use `setVariables` to force either
1035
+ an end or another reasoning iteration.
1036
+
1037
+ Do not confuse an instruction to call `setVariables` with the call itself.
1038
+ During prompt construction, deterministic `run`, `set`, and `if` statements
1039
+ resolve and all `|` text is assembled before the model runs. A `|` instruction
1040
+ therefore cannot pause deterministic resolution while the model captures a
1041
+ value. For inseparable "capture X, then act on X" behavior, use planner
1042
+ slot-fill directly on the real action, deterministic chaining, or one
1043
+ purpose-built implementation that owns the complete sequence.
1044
+
1045
+ **`@subagent.X`** — delegation to another subagent with return:
1046
+
1047
+ ```agentscript
1048
+ reasoning:
1049
+ actions:
1050
+ consult_expert: @subagent.expert_subagent
1051
+ description: "Get expert guidance"
1052
+ available when @variables.needs_expert_help == True
1053
+ ```
1054
+
1055
+ Calling a subagent as a tool runs that subagent's reasoning, then returns control to the calling subagent.
1056
+
1057
+ **Utility actions do not expose `@outputs`**:
1058
+
1059
+ ```agentscript
1060
+ # WRONG — escalation has no output to bind
1061
+ escalate: @utils.escalate
1062
+ set @variables.result = @outputs.status
1063
+
1064
+ # CORRECT — backing action output can be captured
1065
+ process: @actions.process_order
1066
+ set @variables.result = @outputs.status
1067
+
1068
+ # SPECIAL CASE — setVariables supports direct state assignments
1069
+ mark_ready: @utils.setVariables
1070
+ set @variables.status = "ready"
1071
+ ```
1072
+
1073
+ Utilities do not provide action outputs, so output-based post-action directives
1074
+ are invalid. `@utils.setVariables` is the state-update utility: it supports
1075
+ `with` clauses and direct `set @variables...` clauses. It does not support
1076
+ follow-up `run` statements or transitions.
1077
+
1078
+ ---
1079
+
1080
+ ## 12. Anti-Patterns
1081
+
1082
+ **WRONG: Using `transition to` in `reasoning.actions`**
1083
+
1084
+ ```agentscript
1085
+ # WRONG — this doesn't compile
1086
+ reasoning:
1087
+ actions:
1088
+ go_next: transition to @subagent.next
1089
+ description: "Go to next"
1090
+ ```
1091
+
1092
+ **Why it fails:** `reasoning.actions` expose tools to the LLM at reasoning time. The LLM needs an action reference, not a bare command. The runtime rejects bare `transition to` syntax in this context.
1093
+
1094
+ **CORRECT:**
1095
+
1096
+ ```agentscript
1097
+ reasoning:
1098
+ actions:
1099
+ go_next: @utils.transition to @subagent.next
1100
+ description: "Go to next"
1101
+ ```
1102
+
1103
+ The `@utils.transition to` syntax creates a callable tool.
1104
+
1105
+ ---
1106
+
1107
+ **WRONG: Using `@utils.transition to` in directive blocks**
1108
+
1109
+ ```agentscript
1110
+ # WRONG — compile error
1111
+ after_reasoning:
1112
+ @utils.transition to @subagent.next
1113
+ ```
1114
+
1115
+ **Why it fails:** Directive blocks (`before_reasoning`, `after_reasoning`) execute deterministically — the runtime handles them, not the LLM. They use bare `transition to` syntax.
1116
+
1117
+ **CORRECT:**
1118
+
1119
+ ```agentscript
1120
+ after_reasoning:
1121
+ transition to @subagent.next
1122
+ ```
1123
+
1124
+ Bare `transition to` is deterministic — the runtime executes it directly.
1125
+
1126
+ ---
1127
+
1128
+ **WRONG: Using lowercase booleans**
1129
+
1130
+ ```agentscript
1131
+ # WRONG
1132
+ enabled: mutable boolean = true
1133
+ verified: mutable boolean = false
1134
+ is_premium: linked boolean
1135
+
1136
+ if @variables.is_premium == false:
1137
+ run @actions.show_basic_features
1138
+ ```
1139
+
1140
+ **Why it fails:** Agent Script requires `True` and `False` (capitalized first letter). The parser rejects lowercase `true`/`false`.
1141
+
1142
+ **CORRECT:**
1143
+
1144
+ ```agentscript
1145
+ enabled: mutable boolean = True
1146
+ verified: mutable boolean = False
1147
+ is_premium: linked boolean
1148
+
1149
+ if @variables.is_premium == False:
1150
+ run @actions.show_basic_features
1151
+ ```
1152
+
1153
+ Always use capitalized boolean values.
1154
+
1155
+ ---
1156
+
1157
+ **WRONG: Mutable variable without default**
1158
+
1159
+ ```agentscript
1160
+ # WRONG — missing default
1161
+ variables:
1162
+ customer_name: mutable string
1163
+ ```
1164
+
1165
+ **Why it fails:** During deterministic resolution, the runtime needs an initial value. Mutable variables must have defaults.
1166
+
1167
+ **CORRECT:**
1168
+
1169
+ ```agentscript
1170
+ variables:
1171
+ customer_name: mutable string = ""
1172
+ ```
1173
+
1174
+ Provide a default value.
1175
+
1176
+ ---
1177
+
1178
+ **WRONG: Linked variable with default**
1179
+
1180
+ ```agentscript
1181
+ # WRONG — linked variables get value from source
1182
+ variables:
1183
+ session_id: linked string = "default_session"
1184
+ source: @session.sessionID
1185
+ ```
1186
+
1187
+ **Why it fails:** Linked variables are populated by external context at runtime. Providing a default is contradictory.
1188
+
1189
+ **CORRECT:**
1190
+
1191
+ ```agentscript
1192
+ variables:
1193
+ session_id: linked string
1194
+ source: @session.sessionID
1195
+ ```
1196
+
1197
+ Omit the default.
1198
+
1199
+ ---
1200
+
1201
+ **WRONG: Linked variable without source**
1202
+
1203
+ ```agentscript
1204
+ # WRONG — missing source
1205
+ variables:
1206
+ user_role: linked string
1207
+ ```
1208
+
1209
+ **Why it fails:** The runtime cannot populate a linked variable without knowing where to get the value.
1210
+
1211
+ **CORRECT:**
1212
+
1213
+ ```agentscript
1214
+ variables:
1215
+ user_role: linked string
1216
+ source: @context.userRole
1217
+ ```
1218
+
1219
+ Specify a source.
1220
+
1221
+ ---
1222
+
1223
+ **WRONG: Vague post-action instructions that don't name output fields**
1224
+
1225
+ ```agentscript
1226
+ # WRONG — generic "present the results" lets platform tools hijack the response
1227
+ reasoning:
1228
+ instructions: ->
1229
+ | Use the {!@actions.get_station_status} action to retrieve station information.
1230
+ After receiving the results, present the station information to the user
1231
+ in a clear, organized way.
1232
+ actions:
1233
+ get_station_status: @actions.get_station_status
1234
+ with stationName = ...
1235
+ ```
1236
+
1237
+ **Why it fails:** When instructions say "present the results" without specifying *how*, the LLM often calls `show_command` instead of composing a text response — producing a generic "Here are the results:" wrapper with raw structured data. This can corrupt session state, causing subsequent turns to fail with "unexpected error."
1238
+
1239
+ **CORRECT:**
1240
+
1241
+ ```agentscript
1242
+ reasoning:
1243
+ instructions: ->
1244
+ | Use the {!@actions.get_station_status} action to retrieve station information.
1245
+ After receiving the results, write the data directly in your text response.
1246
+ For each station, include the stationName, projectStatus, crewMembers, and
1247
+ shieldStatus values from the action output. Use the exact values returned
1248
+ by the action — do NOT paraphrase or round.
1249
+ Do NOT use the show_command tool. Always compose your response as direct text.
1250
+ actions:
1251
+ get_station_status: @actions.get_station_status
1252
+ with stationName = ...
1253
+ ```
1254
+
1255
+ Three things make this work: (1) naming the specific output fields the LLM must include, (2) directing it to write a text response rather than calling a platform tool, (3) blocking `show_command` by name.
1256
+
1257
+ ---
1258
+
1259
+ **WRONG: Post-action directive on utility**
1260
+
1261
+ ```agentscript
1262
+ # WRONG — utilities have no outputs
1263
+ reasoning:
1264
+ actions:
1265
+ go_next: @utils.transition to @subagent.next
1266
+ set @variables.transitioned = True
1267
+ ```
1268
+
1269
+ **Why it fails:** Utilities like `@utils.transition to` do not return outputs. The `set` directive only works with `@actions`.
1270
+
1271
+ **CORRECT:**
1272
+
1273
+ ```agentscript
1274
+ # If you need to record state, set before transitioning
1275
+ before_reasoning:
1276
+ set @variables.last_subagent = "current_subagent"
1277
+ transition to @subagent.next
1278
+ ```
1279
+
1280
+ ---
1281
+
1282
+ **WRONG: Action loop (action remains available after execution)**
1283
+
1284
+ ```agentscript
1285
+ # WRONG — no gating, no post-action guidance, variable-bound input
1286
+ reasoning:
1287
+ instructions: ->
1288
+ | Place an order using the {!@actions.create_order} action.
1289
+ actions:
1290
+ create_order: @actions.create_order
1291
+ with items = @variables.cart_items
1292
+ ```
1293
+
1294
+ **Why it fails:** Each reasoning cycle, the LLM sees all available actions and decides which to call. This action has no `available when` gate, so it is always available. The variable-bound input (`with items = @variables.cart_items`) means the action is "ready to go" every cycle with no slot-filling decision required. The instructions don't tell the LLM what to do after the action completes, so the LLM may call it repeatedly.
1295
+
1296
+ **CORRECT:**
1297
+
1298
+ ```agentscript
1299
+ reasoning:
1300
+ instructions: ->
1301
+ | Place an order using the {!@actions.create_order} action.
1302
+ After the order is created, confirm the order number.
1303
+ Do NOT call the action again — you have the result.
1304
+ actions:
1305
+ create_order: @actions.create_order
1306
+ with items = @variables.cart_items
1307
+ available when @variables.cart_total > 0
1308
+ ```
1309
+
1310
+ Three mitigations applied: (1) explicit post-action instructions telling the LLM to stop, (2) an `available when` gate so the action is only available when relevant, (3) clear instructions about what to do with the result.
1311
+
1312
+ ---
1313
+
1314
+ **WRONG: Expecting LLM to reason without deterministic context**
1315
+
1316
+ ```agentscript
1317
+ # WRONG — no instructions prepare the LLM
1318
+ subagent check_status:
1319
+ reasoning:
1320
+ actions:
1321
+ lookup: @actions.fetch_status
1322
+ ```
1323
+
1324
+ **Why it fails:** The LLM needs instructions about when and how to use the action. Without prompt text from the reasoning instructions guiding the LLM, it may not call the action even when relevant.
1325
+
1326
+ **CORRECT:**
1327
+
1328
+ ```agentscript
1329
+ subagent check_status:
1330
+ reasoning:
1331
+ instructions: ->
1332
+ | If the customer asks about their order status, use the {!@actions.fetch_status} action.
1333
+ actions:
1334
+ lookup: @actions.fetch_status
1335
+ with order_id = @variables.order_id
1336
+ ```
1337
+
1338
+ Always pair actions with guiding instructions in the reasoning block.
1339
+
1340
+ ---
1341
+
1342
+ **WRONG: Gate subagent transitions to router via `after_reasoning` without defensive instructions**
1343
+
1344
+ ```agentscript
1345
+ # WRONG — the router processes the gate's triggering message in the same turn
1346
+ subagent collect_username:
1347
+ reasoning:
1348
+ instructions: ->
1349
+ | Ask the customer for their username.
1350
+ after_reasoning:
1351
+ if @variables.username != "":
1352
+ transition to @subagent.agent_router
1353
+
1354
+ subagent agent_router:
1355
+ reasoning:
1356
+ instructions: ->
1357
+ | Route the customer's message:
1358
+ - Events → @subagent.event_lookup
1359
+ - Venues → @subagent.venue_booking
1360
+ - Weather → @subagent.weather_forecast
1361
+ - Anything else → @subagent.off_topic
1362
+ ```
1363
+
1364
+ **Why it fails:** When `collect_username` captures the username and `after_reasoning` transitions to `agent_router`, both subagents process in the same user turn. The router's reasoning fires against the user's original message (e.g., "My username is vivek.chawla"), not a fresh utterance. Since that message doesn't match any domain subagent, the router sends it to `off_topic`.
1365
+
1366
+ **CORRECT:**
1367
+
1368
+ ```agentscript
1369
+ subagent collect_username:
1370
+ reasoning:
1371
+ instructions: ->
1372
+ | Ask the customer for their username.
1373
+ after_reasoning:
1374
+ if @variables.username != "":
1375
+ transition to @subagent.agent_router
1376
+
1377
+ subagent agent_router:
1378
+ reasoning:
1379
+ instructions: ->
1380
+ | Route the customer's message to the right subagent.
1381
+ If the customer just arrived from the username collection
1382
+ step, greet them and ask how you can help — do NOT route
1383
+ their previous message.
1384
+ - Events → @subagent.event_lookup
1385
+ - Venues → @subagent.venue_booking
1386
+ - Weather → @subagent.weather_forecast
1387
+ - Anything else → @subagent.off_topic
1388
+ ```
1389
+
1390
+ This pattern applies whenever a gate subagent transitions into a routing subagent via `after_reasoning`.