@salesforce/afv-skills 1.6.9 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/developing-agentforce/README.md +112 -0
- package/skills/{agentforce-development → developing-agentforce}/SKILL.md +109 -16
- package/skills/{agentforce-development → developing-agentforce}/assets/agents/README.md +2 -2
- package/skills/developing-agentforce/assets/agents/order-service.agent +272 -0
- package/skills/developing-agentforce/assets/agents/verification-gate.agent +280 -0
- package/skills/{agentforce-development → developing-agentforce}/assets/bundle-meta.xml +1 -1
- package/skills/{agentforce-development → developing-agentforce}/references/actions-reference.md +20 -0
- package/skills/{agentforce-development → developing-agentforce}/references/agent-design-and-spec-creation.md +1 -1
- package/skills/{agentforce-development → developing-agentforce}/references/agent-metadata-and-lifecycle.md +3 -3
- package/skills/{agentforce-development → developing-agentforce}/references/agent-script-core-language.md +40 -3
- package/skills/{agentforce-development → developing-agentforce}/references/agent-user-setup.md +60 -57
- package/skills/{agentforce-development → developing-agentforce}/references/agent-validation-and-debugging.md +22 -20
- package/skills/developing-agentforce/references/architecture-patterns.md +158 -0
- package/skills/developing-agentforce/references/complex-data-types.md +57 -0
- package/skills/developing-agentforce/references/deploy-reference.md +134 -0
- package/skills/developing-agentforce/references/discover-reference.md +102 -0
- package/skills/developing-agentforce/references/examples.md +350 -0
- package/skills/developing-agentforce/references/feature-validity.md +43 -0
- package/skills/developing-agentforce/references/instruction-resolution.md +545 -0
- package/skills/{agentforce-development → developing-agentforce}/references/known-issues.md +18 -18
- package/skills/{agentforce-development → developing-agentforce}/references/production-gotchas.md +24 -3
- package/skills/developing-agentforce/references/safety-review-reference.md +145 -0
- package/skills/{agentforce-development → developing-agentforce}/references/salesforce-cli-for-agents.md +9 -7
- package/skills/developing-agentforce/references/scaffold-reference.md +153 -0
- package/skills/developing-agentforce/references/scoring-rubric.md +24 -0
- package/skills/{agentforce-development → developing-agentforce}/references/version-history.md +2 -2
- package/skills/observing-agentforce/SKILL.md +368 -0
- package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls +1262 -0
- package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls-meta.xml +5 -0
- package/skills/observing-agentforce/references/improve-reference.md +359 -0
- package/skills/observing-agentforce/references/issue-classification.md +220 -0
- package/skills/observing-agentforce/references/reproduce-reference.md +131 -0
- package/skills/observing-agentforce/references/stdm-queries.md +381 -0
- package/skills/observing-agentforce/references/stdm-schema.md +189 -0
- package/skills/testing-agentforce/SKILL.md +335 -0
- package/skills/testing-agentforce/assets/basic-test-spec.yaml +59 -0
- package/skills/testing-agentforce/assets/guardrail-test-spec.yaml +101 -0
- package/skills/testing-agentforce/assets/standard-test-spec.yaml +123 -0
- package/skills/testing-agentforce/references/action-execution.md +241 -0
- package/skills/testing-agentforce/references/batch-testing.md +274 -0
- package/skills/testing-agentforce/references/preview-testing.md +353 -0
- package/skills/testing-agentforce/references/test-report-format.md +160 -0
- package/skills/testing-agentforce/references/troubleshooting.md +73 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/README-legacy.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agent-spec-template.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/hello-world.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/multi-topic.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/production-faq.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/production-faq.bundle-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/agents/simple-qa.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/apex/models-api-queueable.cls +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/apex-action.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/error-handling.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/escalation-setup.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/flow-action.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/n-ary-conditions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/components/topic-with-actions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/deterministic-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/escalation-pattern.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/flow-action-lookup.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/hub-and-spoke.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/invocable-apex-template.cls +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/local-info-agent-annotated.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/basic-prompt-template.promptTemplate-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-function-apex.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-function-flow.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-plugin.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/http-callout-flow.flow-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/record-grounded-prompt.promptTemplate-meta.xml +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/minimal-starter.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/README.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/action-callbacks.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/advanced-input-bindings.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/bidirectional-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/critical-input-collection.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/delegation-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/lifecycle-events.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/llm-controlled-actions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/multi-step-workflow.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/open-gate-routing.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/procedural-instructions.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/prompt-template-action.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/system-instruction-overrides.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/prompt-rag-search.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/template-multi-topic.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/template-single-topic.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/assets/verification-gate.agent +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/action-prompt-templates.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/agent-access-guide.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/agent-topic-map-diagrams.md +0 -0
- /package/skills/{agentforce-development → developing-agentforce}/references/minimal-examples.md +0 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# Verification Gate Architecture Template
|
|
2
|
+
# ========================================
|
|
3
|
+
#
|
|
4
|
+
# Users must pass identity verification before accessing protected topics.
|
|
5
|
+
#
|
|
6
|
+
# Pattern: Security gate before protected functionality.
|
|
7
|
+
# Use when: Handling sensitive data, payments, PII access.
|
|
8
|
+
#
|
|
9
|
+
# Key features:
|
|
10
|
+
# - Deterministic verification (code-enforced, not LLM suggestions)
|
|
11
|
+
# - available when guards make actions invisible until verified
|
|
12
|
+
# - Post-action checks at TOP of instructions: ->
|
|
13
|
+
# - Automatic escalation after 3 failed attempts
|
|
14
|
+
|
|
15
|
+
system:
|
|
16
|
+
instructions: |
|
|
17
|
+
You are an AI secure customer service agent.
|
|
18
|
+
Always verify identity before sensitive operations.
|
|
19
|
+
Do not fabricate data — always use action results.
|
|
20
|
+
messages:
|
|
21
|
+
welcome: "Welcome! I'll need to verify your identity before we proceed."
|
|
22
|
+
error: "I apologize, something went wrong. Let me try again."
|
|
23
|
+
|
|
24
|
+
config:
|
|
25
|
+
developer_name: "SecureAgent"
|
|
26
|
+
agent_label: "Secure Customer Agent"
|
|
27
|
+
description: "Agent with verification gate for sensitive operations"
|
|
28
|
+
default_agent_user: "einsteinagent@00dxx000001234.ext"
|
|
29
|
+
|
|
30
|
+
variables:
|
|
31
|
+
EndUserId: linked string
|
|
32
|
+
source: @MessagingSession.MessagingEndUserId
|
|
33
|
+
description: "Messaging End User ID"
|
|
34
|
+
visibility: "External"
|
|
35
|
+
RoutableId: linked string
|
|
36
|
+
source: @MessagingSession.Id
|
|
37
|
+
description: "Messaging Session ID"
|
|
38
|
+
visibility: "External"
|
|
39
|
+
ContactId: linked string
|
|
40
|
+
source: @MessagingEndUser.ContactId
|
|
41
|
+
description: "Contact ID"
|
|
42
|
+
visibility: "External"
|
|
43
|
+
customer_verified: mutable boolean = False
|
|
44
|
+
description: "Has customer passed identity verification"
|
|
45
|
+
failed_attempts: mutable number = 0
|
|
46
|
+
description: "Number of failed verification attempts"
|
|
47
|
+
customer_email: mutable string = ""
|
|
48
|
+
description: "Customer email for verification"
|
|
49
|
+
refund_status: mutable string = ""
|
|
50
|
+
description: "Status of refund operation"
|
|
51
|
+
refund_amount: mutable number = 0
|
|
52
|
+
description: "Refund amount to process"
|
|
53
|
+
churn_risk_score: mutable number = 0
|
|
54
|
+
description: "Customer churn risk from Data Cloud"
|
|
55
|
+
|
|
56
|
+
language:
|
|
57
|
+
default_locale: "en_US"
|
|
58
|
+
additional_locales: ""
|
|
59
|
+
all_additional_locales: False
|
|
60
|
+
|
|
61
|
+
start_agent topic_selector:
|
|
62
|
+
description: "Route through identity verification"
|
|
63
|
+
reasoning:
|
|
64
|
+
instructions: |
|
|
65
|
+
You are a router only. Do NOT answer questions or provide help directly.
|
|
66
|
+
Route all users to identity verification first.
|
|
67
|
+
If already verified, route to the appropriate topic:
|
|
68
|
+
- Account questions -> use to_account
|
|
69
|
+
- Refund requests -> use to_refund
|
|
70
|
+
actions:
|
|
71
|
+
to_verify: @utils.transition to @topic.identity_verification
|
|
72
|
+
description: "Begin identity verification"
|
|
73
|
+
to_account: @utils.transition to @topic.account_management
|
|
74
|
+
description: "Access account settings"
|
|
75
|
+
available when @variables.customer_verified == True
|
|
76
|
+
to_refund: @utils.transition to @topic.refund_processor
|
|
77
|
+
description: "Process a refund request"
|
|
78
|
+
available when @variables.customer_verified == True
|
|
79
|
+
|
|
80
|
+
topic identity_verification:
|
|
81
|
+
label: "Identity Verification"
|
|
82
|
+
description: "Verify customer identity before proceeding"
|
|
83
|
+
|
|
84
|
+
actions:
|
|
85
|
+
verify_email:
|
|
86
|
+
description: "Verify customer email against records"
|
|
87
|
+
target: "flow://Verify_Customer_Email"
|
|
88
|
+
inputs:
|
|
89
|
+
email: string
|
|
90
|
+
description: "Customer email to verify"
|
|
91
|
+
outputs:
|
|
92
|
+
verified: boolean
|
|
93
|
+
description: "Whether verification succeeded"
|
|
94
|
+
|
|
95
|
+
reasoning:
|
|
96
|
+
instructions: ->
|
|
97
|
+
if @variables.failed_attempts >= 3:
|
|
98
|
+
| Too many failed attempts. Transferring to a human agent.
|
|
99
|
+
transition to @topic.escalation
|
|
100
|
+
|
|
101
|
+
if @variables.customer_verified == True:
|
|
102
|
+
| Identity verified! How can I help you today?
|
|
103
|
+
|
|
104
|
+
if @variables.customer_verified == False:
|
|
105
|
+
| Please verify your identity by confirming your email address.
|
|
106
|
+
|
|
107
|
+
actions:
|
|
108
|
+
check_email: @actions.verify_email
|
|
109
|
+
description: "Verify customer email"
|
|
110
|
+
with email = ...
|
|
111
|
+
set @variables.customer_verified = @outputs.verified
|
|
112
|
+
|
|
113
|
+
go_to_account: @utils.transition to @topic.account_management
|
|
114
|
+
description: "Access account settings"
|
|
115
|
+
available when @variables.customer_verified == True
|
|
116
|
+
|
|
117
|
+
go_to_refund: @utils.transition to @topic.refund_processor
|
|
118
|
+
description: "Process a refund request"
|
|
119
|
+
available when @variables.customer_verified == True
|
|
120
|
+
|
|
121
|
+
escalate_now: @utils.escalate
|
|
122
|
+
description: "Transfer to human agent"
|
|
123
|
+
|
|
124
|
+
topic account_management:
|
|
125
|
+
label: "Account Management"
|
|
126
|
+
description: "Manage customer account settings (requires verification)"
|
|
127
|
+
|
|
128
|
+
actions:
|
|
129
|
+
update_email:
|
|
130
|
+
description: "Update customer email address"
|
|
131
|
+
target: "apex://UpdateCustomerEmail"
|
|
132
|
+
inputs:
|
|
133
|
+
new_email: string
|
|
134
|
+
description: "New email address"
|
|
135
|
+
outputs:
|
|
136
|
+
success: boolean
|
|
137
|
+
description: "Whether update succeeded"
|
|
138
|
+
|
|
139
|
+
update_preferences:
|
|
140
|
+
description: "Update communication preferences"
|
|
141
|
+
target: "apex://UpdatePreferences"
|
|
142
|
+
inputs:
|
|
143
|
+
pref_type: string
|
|
144
|
+
description: "Preference type to update"
|
|
145
|
+
pref_value: string
|
|
146
|
+
description: "New preference value"
|
|
147
|
+
outputs:
|
|
148
|
+
success: boolean
|
|
149
|
+
description: "Whether update succeeded"
|
|
150
|
+
|
|
151
|
+
reasoning:
|
|
152
|
+
instructions: ->
|
|
153
|
+
if @variables.customer_verified == False:
|
|
154
|
+
transition to @topic.identity_verification
|
|
155
|
+
|
|
156
|
+
| Welcome to account management.
|
|
157
|
+
| What would you like to do with your account?
|
|
158
|
+
| Use the update actions to make changes.
|
|
159
|
+
|
|
160
|
+
actions:
|
|
161
|
+
change_email: @actions.update_email
|
|
162
|
+
description: "Update email address"
|
|
163
|
+
with new_email = ...
|
|
164
|
+
available when @variables.customer_verified == True
|
|
165
|
+
|
|
166
|
+
change_prefs: @actions.update_preferences
|
|
167
|
+
description: "Update communication preferences"
|
|
168
|
+
with pref_type = ...
|
|
169
|
+
with pref_value = ...
|
|
170
|
+
available when @variables.customer_verified == True
|
|
171
|
+
|
|
172
|
+
back: @utils.transition to @topic.topic_selector
|
|
173
|
+
description: "Return to main menu"
|
|
174
|
+
|
|
175
|
+
topic refund_processor:
|
|
176
|
+
label: "Refund Processor"
|
|
177
|
+
description: "Process refund requests (requires verification)"
|
|
178
|
+
|
|
179
|
+
actions:
|
|
180
|
+
check_churn_risk:
|
|
181
|
+
description: "Check customer churn risk score"
|
|
182
|
+
target: "apex://CheckChurnRisk"
|
|
183
|
+
inputs:
|
|
184
|
+
customer_id: string
|
|
185
|
+
description: "Customer ID"
|
|
186
|
+
outputs:
|
|
187
|
+
score: object
|
|
188
|
+
description: "Churn risk score 0-100"
|
|
189
|
+
complex_data_type_name: "lightning__numberType"
|
|
190
|
+
|
|
191
|
+
process_refund:
|
|
192
|
+
description: "Process a full cash refund"
|
|
193
|
+
target: "flow://Process_Refund"
|
|
194
|
+
inputs:
|
|
195
|
+
refund_type: string
|
|
196
|
+
description: "Type of refund (full or partial)"
|
|
197
|
+
outputs:
|
|
198
|
+
status: string
|
|
199
|
+
description: "Refund status"
|
|
200
|
+
|
|
201
|
+
issue_credit:
|
|
202
|
+
description: "Issue store credit"
|
|
203
|
+
target: "flow://Issue_Store_Credit"
|
|
204
|
+
inputs:
|
|
205
|
+
amount: object
|
|
206
|
+
description: "Credit amount"
|
|
207
|
+
complex_data_type_name: "lightning__numberType"
|
|
208
|
+
outputs:
|
|
209
|
+
status: string
|
|
210
|
+
description: "Credit status"
|
|
211
|
+
|
|
212
|
+
create_crm_case:
|
|
213
|
+
description: "Create a CRM case for the refund"
|
|
214
|
+
target: "flow://Create_CRM_Case"
|
|
215
|
+
inputs:
|
|
216
|
+
customer_id: string
|
|
217
|
+
description: "Customer ID"
|
|
218
|
+
refund_amount: object
|
|
219
|
+
description: "Refund amount"
|
|
220
|
+
complex_data_type_name: "lightning__numberType"
|
|
221
|
+
outputs:
|
|
222
|
+
case_id: string
|
|
223
|
+
description: "Created case ID"
|
|
224
|
+
|
|
225
|
+
reasoning:
|
|
226
|
+
instructions: ->
|
|
227
|
+
if @variables.customer_verified == False:
|
|
228
|
+
transition to @topic.identity_verification
|
|
229
|
+
|
|
230
|
+
if @variables.refund_status == "Approved":
|
|
231
|
+
run @actions.create_crm_case
|
|
232
|
+
with customer_id = @variables.ContactId
|
|
233
|
+
with refund_amount = @variables.refund_amount
|
|
234
|
+
transition to @topic.success_confirmation
|
|
235
|
+
|
|
236
|
+
run @actions.check_churn_risk
|
|
237
|
+
with customer_id = @variables.ContactId
|
|
238
|
+
set @variables.churn_risk_score = @outputs.score
|
|
239
|
+
|
|
240
|
+
| Customer risk score: {!@variables.churn_risk_score}
|
|
241
|
+
|
|
242
|
+
if @variables.churn_risk_score >= 80:
|
|
243
|
+
| HIGH RISK - Offer a full cash refund to retain this customer.
|
|
244
|
+
else:
|
|
245
|
+
| STANDARD - Offer a $10 store credit as goodwill.
|
|
246
|
+
|
|
247
|
+
actions:
|
|
248
|
+
approve_full_refund: @actions.process_refund
|
|
249
|
+
description: "Approve full cash refund"
|
|
250
|
+
available when @variables.churn_risk_score >= 80
|
|
251
|
+
with refund_type = "full"
|
|
252
|
+
set @variables.refund_status = @outputs.status
|
|
253
|
+
|
|
254
|
+
offer_credit: @actions.issue_credit
|
|
255
|
+
description: "Offer store credit"
|
|
256
|
+
available when @variables.churn_risk_score < 80
|
|
257
|
+
with amount = 10
|
|
258
|
+
set @variables.refund_status = @outputs.status
|
|
259
|
+
|
|
260
|
+
topic success_confirmation:
|
|
261
|
+
label: "Success Confirmation"
|
|
262
|
+
description: "Confirm successful operation"
|
|
263
|
+
reasoning:
|
|
264
|
+
instructions: |
|
|
265
|
+
Great news! Your request has been processed successfully.
|
|
266
|
+
Is there anything else I can help you with?
|
|
267
|
+
actions:
|
|
268
|
+
new_request: @utils.transition to @topic.topic_selector
|
|
269
|
+
description: "Start a new request"
|
|
270
|
+
|
|
271
|
+
topic escalation:
|
|
272
|
+
label: "Escalation"
|
|
273
|
+
description: "Escalate to human agent"
|
|
274
|
+
reasoning:
|
|
275
|
+
instructions: |
|
|
276
|
+
I'm transferring you to a human agent who can better assist you.
|
|
277
|
+
Please hold while I connect you.
|
|
278
|
+
actions:
|
|
279
|
+
handoff: @utils.escalate
|
|
280
|
+
description: "Transfer to human agent"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
└── MyAgent.bundle-meta.xml <- This file (rename to match agent)
|
|
15
15
|
|
|
16
16
|
DEPLOYMENT COMMAND:
|
|
17
|
-
sf agent publish authoring-bundle --api-name MyAgent --target-org TARGET_ORG
|
|
17
|
+
sf agent publish authoring-bundle --json --api-name MyAgent --target-org TARGET_ORG
|
|
18
18
|
|
|
19
19
|
DO NOT USE: sf project deploy start (will fail with "Required fields are missing: [BundleType]")
|
|
20
20
|
-->
|
package/skills/{agentforce-development → developing-agentforce}/references/actions-reference.md
RENAMED
|
@@ -43,6 +43,24 @@ All actions in Agent Script support these properties:
|
|
|
43
43
|
| `filter_from_agent` | Boolean | `True` = exclude output from agent context; defaults to `False` |
|
|
44
44
|
| `is_used_by_planner` | Boolean | `True` = LLM can reason about this value for routing decisions; defaults to `False` |
|
|
45
45
|
| `complex_data_type_name` | String | Lightning data type mapping (required for complex types) |
|
|
46
|
+
| `is_displayable` | Boolean | `False` = hide from user display (compile-valid alias for `filter_from_agent: True`) |
|
|
47
|
+
|
|
48
|
+
> **Note**: `filter_from_agent: True` is the GA standard. `is_displayable: False` is a compile-valid alias with the same effect.
|
|
49
|
+
|
|
50
|
+
> **Safety**: For service agents (customer-facing), internal business metrics (risk scores, retention tiers, churn probability, internal classification codes) should be `filter_from_agent: True` so the LLM can use them for reasoning but they don't appear in customer-facing responses.
|
|
51
|
+
|
|
52
|
+
### Zero-Hallucination Intent Classification Pattern
|
|
53
|
+
|
|
54
|
+
Use `filter_from_agent: True` + `is_used_by_planner: True` to let the LLM route based on action outputs without being able to show them to the user:
|
|
55
|
+
|
|
56
|
+
```agentscript
|
|
57
|
+
outputs:
|
|
58
|
+
intent_classification: string
|
|
59
|
+
filter_from_agent: True # LLM cannot show this to user
|
|
60
|
+
is_used_by_planner: True # LLM can use for routing decisions
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This prevents the LLM from fabricating classification results — it must invoke the action to get the value, then can only use it for routing decisions.
|
|
46
64
|
|
|
47
65
|
### Example with All Properties
|
|
48
66
|
|
|
@@ -476,6 +494,8 @@ public class WrappedAction {
|
|
|
476
494
|
|
|
477
495
|
The `connection` block enables escalation to human agents via Omni-Channel. Always use `connection messaging:` (singular).
|
|
478
496
|
|
|
497
|
+
> **Service agents only.** The `connection messaging:` block and `@utils.escalate` are only valid for `AgentforceServiceAgent`. Employee agents (`AgentforceEmployeeAgent`) MUST NOT include a `connection` block or `@utils.escalate` actions — including them causes silent failures or "unknown error" at publish time. For employee agents, use `@utils.transition` to a help topic or an action that creates a support case instead.
|
|
498
|
+
|
|
479
499
|
### Basic Syntax
|
|
480
500
|
|
|
481
501
|
```agentscript
|
|
@@ -565,7 +565,7 @@ Second, find the default package directory by reading `sfdx-project.json` at the
|
|
|
565
565
|
Third, generate an empty Apex class using the following command:
|
|
566
566
|
|
|
567
567
|
```bash
|
|
568
|
-
sf template generate apex class --name InvoiceFetcher --output-dir <PACKAGE_DIR>/main/default/classes
|
|
568
|
+
sf template generate apex class --json --name InvoiceFetcher --output-dir <PACKAGE_DIR>/main/default/classes
|
|
569
569
|
```
|
|
570
570
|
|
|
571
571
|
This creates both the `.cls` and `.cls-meta.xml` files. Do not create test classes for stubs.
|
|
@@ -58,7 +58,7 @@ Authoring bundles are stored in `<packageDirectory>/main/default/aiAuthoringBund
|
|
|
58
58
|
|
|
59
59
|
Publishing creates the runtime entities that make an agent usable in the org.
|
|
60
60
|
|
|
61
|
-
**Bot** — Top-level container (one per agent). Links to all published versions.
|
|
61
|
+
**Bot** — Top-level container (one per agent). Links to all published versions. Query `BotDefinition` when the ID of a published agent is required. See [CLI for Agents](salesforce-cli-for-agents.md) for query syntax.
|
|
62
62
|
|
|
63
63
|
**BotVersion** — One per published version (e.g., `v1`, `v2`, `v3`). Only one version can be active at a time.
|
|
64
64
|
|
|
@@ -519,12 +519,12 @@ Agent testing requires a test spec (YAML), which gets compiled into `AiEvaluatio
|
|
|
519
519
|
|
|
520
520
|
**Create a test spec from the skill template:**
|
|
521
521
|
|
|
522
|
-
Copy the test spec template from the **agentforce
|
|
522
|
+
Copy the test spec template from the **testing-agentforce** skill to `specs/<Agent_API_Name>-testSpec.yaml` in the user's SFDX project. Update `name`, `description`, `subjectName`, and `testCases` to match the agent being tested.
|
|
523
523
|
|
|
524
524
|
Do NOT use `sf agent generate test-spec` to create a new test spec. This command requires interactive input and cannot be used programmatically. It can reverse-engineer a test spec from an existing `AiEvaluationDefinition` when supplied with the `--from-definition` flag:
|
|
525
525
|
|
|
526
526
|
```bash
|
|
527
|
-
sf agent generate test-spec --from-definition force-app/main/default/aiEvaluationDefinitions/Local_Info_Agent_Test.aiEvaluationDefinition-meta.xml --output-file specs/Local_Info_Agent-testSpec.yaml
|
|
527
|
+
sf agent generate test-spec --json --from-definition force-app/main/default/aiEvaluationDefinitions/Local_Info_Agent_Test.aiEvaluationDefinition-meta.xml --output-file specs/Local_Info_Agent-testSpec.yaml
|
|
528
528
|
```
|
|
529
529
|
|
|
530
530
|
**Create the test in the org:**
|
|
@@ -192,8 +192,8 @@ The expression inside `{! ... }` is evaluated by the runtime during deterministi
|
|
|
192
192
|
- `@topic.<name>` — reference a topic by name
|
|
193
193
|
- `@variables.<name>` — reference a variable (use in logic)
|
|
194
194
|
- `{!@variables.<name>}` — reference a variable in prompt text (template injection)
|
|
195
|
-
- `@outputs.<name>` —
|
|
196
|
-
- `@inputs.<name>` —
|
|
195
|
+
- `@outputs.<name>` — action output (only in `set`/`if` immediately after the action — unavailable elsewhere)
|
|
196
|
+
- `@inputs.<name>` — action input (only in `with` during invocation — NOT in `set` or post-execution)
|
|
197
197
|
- `@utils.<function>` — reference a utility (escalate, transition to, setVariables)
|
|
198
198
|
|
|
199
199
|
**Do NOT use `<>` as inequality operator.** Use `!=` instead.
|
|
@@ -243,6 +243,26 @@ config:
|
|
|
243
243
|
- `default_agent_user`
|
|
244
244
|
- MessagingSession linked variables (`EndUserId`, `RoutableId`, `ContactId`, `EndUserLanguage`)
|
|
245
245
|
- Escalation topic with `@utils.escalate`
|
|
246
|
+
- `connection messaging:` block
|
|
247
|
+
|
|
248
|
+
**Common mistake — service-agent constructs on employee agent:**
|
|
249
|
+
|
|
250
|
+
```agentscript
|
|
251
|
+
# WRONG — employee agent with service-agent constructs
|
|
252
|
+
config:
|
|
253
|
+
agent_type: "AgentforceEmployeeAgent"
|
|
254
|
+
default_agent_user: "agent@org.ext" # PROHIBITED — causes "Internal Error"
|
|
255
|
+
variables:
|
|
256
|
+
EndUserId: linked string # SERVICE ONLY — no messaging session
|
|
257
|
+
source: @MessagingSession.MessagingEndUserId
|
|
258
|
+
connection messaging: # SERVICE ONLY — no messaging channel
|
|
259
|
+
escalation_message: "Transferring..."
|
|
260
|
+
|
|
261
|
+
# RIGHT — clean employee agent config
|
|
262
|
+
config:
|
|
263
|
+
agent_type: "AgentforceEmployeeAgent"
|
|
264
|
+
# No default_agent_user, no MessagingSession vars, no connection block
|
|
265
|
+
```
|
|
246
266
|
|
|
247
267
|
**Conditionally required fields:**
|
|
248
268
|
- `default_agent_user` — **required for `AgentforceServiceAgent`, prohibited 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.
|
|
@@ -528,6 +548,23 @@ run @actions.process_order
|
|
|
528
548
|
|
|
529
549
|
After an action completes, you can check outputs and transition.
|
|
530
550
|
|
|
551
|
+
**Scope lifecycle — `@inputs` and `@outputs` are ephemeral:**
|
|
552
|
+
- `@inputs`: only in `with` directives during invocation. NOT in `set`/`if` after execution.
|
|
553
|
+
- `@outputs`: only in `set`/`if` immediately after invocation. NOT in instructions or later actions.
|
|
554
|
+
- To reuse an input value post-execution, capture it in `@variables` BEFORE the action call.
|
|
555
|
+
|
|
556
|
+
```agentscript
|
|
557
|
+
# WRONG — silent failure, @inputs out of scope in set
|
|
558
|
+
run @actions.get_station_status
|
|
559
|
+
with station_name = ...
|
|
560
|
+
set @variables.station = @inputs.station_name # FAILS SILENTLY
|
|
561
|
+
|
|
562
|
+
# RIGHT — use @outputs (if action echoes value) or capture input beforehand
|
|
563
|
+
run @actions.get_station_status
|
|
564
|
+
with station_name = ...
|
|
565
|
+
set @variables.station = @outputs.station_name
|
|
566
|
+
```
|
|
567
|
+
|
|
531
568
|
**How pipe sections become the LLM prompt**:
|
|
532
569
|
|
|
533
570
|
All logic is resolved first; only matching `|` pipe lines are included in the prompt:
|
|
@@ -852,7 +889,7 @@ reasoning:
|
|
|
852
889
|
|
|
853
890
|
Transition discards the current topic's prompt and starts fresh with the target topic.
|
|
854
891
|
|
|
855
|
-
**`@utils.escalate`** — route to a human agent:
|
|
892
|
+
**`@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):
|
|
856
893
|
|
|
857
894
|
```agentscript
|
|
858
895
|
reasoning:
|