@salesforce/afv-skills 1.6.9 → 1.7.1
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/README.md +28 -23
- 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/generating-flow/SKILL.md +3 -1
- 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,272 @@
|
|
|
1
|
+
# Order Service Agent
|
|
2
|
+
# ========================
|
|
3
|
+
#
|
|
4
|
+
# A complex real-world agent for e-commerce customer service featuring:
|
|
5
|
+
# - Verification gate before order access
|
|
6
|
+
# - Multiple specialized topics (order status, tracking, returns)
|
|
7
|
+
# - Two-level action system with Flow targets
|
|
8
|
+
# - after_reasoning for post-action routing
|
|
9
|
+
# - available when guards for conditional action visibility
|
|
10
|
+
|
|
11
|
+
system:
|
|
12
|
+
instructions: |
|
|
13
|
+
You are an AI Customer Service Assistant helping customers with their orders.
|
|
14
|
+
Be helpful, empathetic, and efficient in resolving order-related issues.
|
|
15
|
+
Always verify customer identity before sharing order details.
|
|
16
|
+
Do not fabricate data — always use action results.
|
|
17
|
+
messages:
|
|
18
|
+
welcome: "Hello! I'm here to help you with your orders. How can I assist you today?"
|
|
19
|
+
error: "I apologize for the inconvenience. Let me try a different approach."
|
|
20
|
+
|
|
21
|
+
config:
|
|
22
|
+
developer_name: "OrderServiceAgent"
|
|
23
|
+
agent_label: "Order Service Assistant"
|
|
24
|
+
description: "Helps customers check order status, process returns, and track shipments"
|
|
25
|
+
default_agent_user: "einsteinagent@00dxx000001234.ext"
|
|
26
|
+
|
|
27
|
+
variables:
|
|
28
|
+
EndUserId: linked string
|
|
29
|
+
source: @MessagingSession.MessagingEndUserId
|
|
30
|
+
description: "Messaging End User ID"
|
|
31
|
+
visibility: "External"
|
|
32
|
+
RoutableId: linked string
|
|
33
|
+
source: @MessagingSession.Id
|
|
34
|
+
description: "Messaging Session ID"
|
|
35
|
+
visibility: "External"
|
|
36
|
+
ContactId: linked string
|
|
37
|
+
source: @MessagingEndUser.ContactId
|
|
38
|
+
description: "Contact ID"
|
|
39
|
+
visibility: "External"
|
|
40
|
+
customer_email: mutable string = ""
|
|
41
|
+
description: "Customer email for verification"
|
|
42
|
+
customer_verified: mutable boolean = False
|
|
43
|
+
description: "Whether customer identity has been verified"
|
|
44
|
+
order_number: mutable string = ""
|
|
45
|
+
description: "Current order number"
|
|
46
|
+
order_status: mutable string = ""
|
|
47
|
+
description: "Current order status"
|
|
48
|
+
tracking_number: mutable string = ""
|
|
49
|
+
description: "Shipment tracking number"
|
|
50
|
+
return_reason: mutable string = ""
|
|
51
|
+
description: "Reason for return"
|
|
52
|
+
return_initiated: mutable boolean = False
|
|
53
|
+
description: "Whether a return has been initiated"
|
|
54
|
+
return_label_url: mutable string = ""
|
|
55
|
+
description: "URL for return shipping label"
|
|
56
|
+
|
|
57
|
+
language:
|
|
58
|
+
default_locale: "en_US"
|
|
59
|
+
additional_locales: ""
|
|
60
|
+
all_additional_locales: False
|
|
61
|
+
|
|
62
|
+
start_agent topic_selector:
|
|
63
|
+
description: "Route customers through verification then to the right topic"
|
|
64
|
+
reasoning:
|
|
65
|
+
instructions: |
|
|
66
|
+
You are a router only. Do NOT answer questions or provide help directly.
|
|
67
|
+
Route all users to identity verification first.
|
|
68
|
+
If already verified, route to the appropriate topic:
|
|
69
|
+
- Order questions -> use to_orders
|
|
70
|
+
- Returns -> use to_returns
|
|
71
|
+
- Tracking -> use to_tracking
|
|
72
|
+
actions:
|
|
73
|
+
to_verify: @utils.transition to @topic.verification
|
|
74
|
+
description: "Begin identity verification"
|
|
75
|
+
to_orders: @utils.transition to @topic.order_status
|
|
76
|
+
description: "Check order status"
|
|
77
|
+
available when @variables.customer_verified == True
|
|
78
|
+
to_returns: @utils.transition to @topic.returns
|
|
79
|
+
description: "Process a return"
|
|
80
|
+
available when @variables.customer_verified == True
|
|
81
|
+
to_tracking: @utils.transition to @topic.shipment_tracking
|
|
82
|
+
description: "Track a shipment"
|
|
83
|
+
available when @variables.customer_verified == True
|
|
84
|
+
|
|
85
|
+
topic verification:
|
|
86
|
+
label: "Identity Verification"
|
|
87
|
+
description: "Verify customer identity before accessing order information"
|
|
88
|
+
|
|
89
|
+
actions:
|
|
90
|
+
verify_customer:
|
|
91
|
+
description: "Verify customer identity by email"
|
|
92
|
+
target: "flow://Verify_Customer_Identity"
|
|
93
|
+
inputs:
|
|
94
|
+
email: string
|
|
95
|
+
description: "Customer email address"
|
|
96
|
+
outputs:
|
|
97
|
+
verified: boolean
|
|
98
|
+
description: "Whether verification succeeded"
|
|
99
|
+
customer_name: string
|
|
100
|
+
description: "Verified customer name"
|
|
101
|
+
|
|
102
|
+
reasoning:
|
|
103
|
+
instructions: ->
|
|
104
|
+
if @variables.customer_verified == True:
|
|
105
|
+
| Welcome back! How can I help you today?
|
|
106
|
+
|
|
107
|
+
if @variables.customer_verified == False:
|
|
108
|
+
| To help you with your order, I need to verify your identity.
|
|
109
|
+
| What is the email address associated with your account?
|
|
110
|
+
|
|
111
|
+
actions:
|
|
112
|
+
verify: @actions.verify_customer
|
|
113
|
+
description: "Verify customer identity by email"
|
|
114
|
+
with email = ...
|
|
115
|
+
set @variables.customer_verified = @outputs.verified
|
|
116
|
+
set @variables.customer_email = @outputs.customer_name
|
|
117
|
+
|
|
118
|
+
proceed_to_orders: @utils.transition to @topic.order_status
|
|
119
|
+
description: "Move to order lookup"
|
|
120
|
+
available when @variables.customer_verified == True
|
|
121
|
+
|
|
122
|
+
escalate_now: @utils.escalate
|
|
123
|
+
description: "Transfer to human agent"
|
|
124
|
+
|
|
125
|
+
topic order_status:
|
|
126
|
+
label: "Order Status"
|
|
127
|
+
description: "Look up order details and provide status updates"
|
|
128
|
+
|
|
129
|
+
actions:
|
|
130
|
+
lookup_order:
|
|
131
|
+
description: "Look up order by order number"
|
|
132
|
+
target: "flow://Lookup_Order"
|
|
133
|
+
inputs:
|
|
134
|
+
order_number: string
|
|
135
|
+
description: "Order number to look up"
|
|
136
|
+
customer_email: string
|
|
137
|
+
description: "Customer email for validation"
|
|
138
|
+
outputs:
|
|
139
|
+
status: string
|
|
140
|
+
description: "Order status"
|
|
141
|
+
is_displayable: True
|
|
142
|
+
tracking_number: string
|
|
143
|
+
description: "Shipment tracking number"
|
|
144
|
+
is_displayable: True
|
|
145
|
+
estimated_delivery: string
|
|
146
|
+
description: "Estimated delivery date"
|
|
147
|
+
is_displayable: True
|
|
148
|
+
|
|
149
|
+
reasoning:
|
|
150
|
+
instructions: ->
|
|
151
|
+
if @variables.order_status != "":
|
|
152
|
+
| Order {!@variables.order_number} status: {!@variables.order_status}
|
|
153
|
+
| Would you like to track your shipment or initiate a return?
|
|
154
|
+
|
|
155
|
+
if @variables.order_status == "":
|
|
156
|
+
| What is your order number? You can find it in your confirmation email.
|
|
157
|
+
| Use the find_order action to look up order details.
|
|
158
|
+
|
|
159
|
+
actions:
|
|
160
|
+
find_order: @actions.lookup_order
|
|
161
|
+
description: "Look up order details"
|
|
162
|
+
with order_number = ...
|
|
163
|
+
with customer_email = @variables.customer_email
|
|
164
|
+
set @variables.order_status = @outputs.status
|
|
165
|
+
set @variables.tracking_number = @outputs.tracking_number
|
|
166
|
+
|
|
167
|
+
to_returns: @utils.transition to @topic.returns
|
|
168
|
+
description: "Start a return"
|
|
169
|
+
available when @variables.order_status != ""
|
|
170
|
+
|
|
171
|
+
to_tracking: @utils.transition to @topic.shipment_tracking
|
|
172
|
+
description: "Track shipment"
|
|
173
|
+
available when @variables.tracking_number != ""
|
|
174
|
+
|
|
175
|
+
back: @utils.transition to @topic.topic_selector
|
|
176
|
+
description: "Route to a different topic"
|
|
177
|
+
|
|
178
|
+
topic shipment_tracking:
|
|
179
|
+
label: "Shipment Tracking"
|
|
180
|
+
description: "Track shipment status and estimated delivery"
|
|
181
|
+
|
|
182
|
+
actions:
|
|
183
|
+
get_tracking_details:
|
|
184
|
+
description: "Get detailed tracking information"
|
|
185
|
+
target: "flow://Get_Tracking_Details"
|
|
186
|
+
inputs:
|
|
187
|
+
tracking_number: string
|
|
188
|
+
description: "Shipment tracking number"
|
|
189
|
+
outputs:
|
|
190
|
+
current_location: string
|
|
191
|
+
description: "Current package location"
|
|
192
|
+
is_displayable: True
|
|
193
|
+
estimated_delivery: string
|
|
194
|
+
description: "Estimated delivery date"
|
|
195
|
+
is_displayable: True
|
|
196
|
+
delivery_status: string
|
|
197
|
+
description: "Delivery status"
|
|
198
|
+
is_displayable: True
|
|
199
|
+
|
|
200
|
+
reasoning:
|
|
201
|
+
instructions: |
|
|
202
|
+
Look up the tracking information for the customer's shipment.
|
|
203
|
+
Use the track action with the tracking number.
|
|
204
|
+
Do not fabricate tracking details — always use the action result.
|
|
205
|
+
|
|
206
|
+
actions:
|
|
207
|
+
track: @actions.get_tracking_details
|
|
208
|
+
description: "Get tracking details"
|
|
209
|
+
with tracking_number = @variables.tracking_number
|
|
210
|
+
|
|
211
|
+
back: @utils.transition to @topic.topic_selector
|
|
212
|
+
description: "Route to a different topic"
|
|
213
|
+
|
|
214
|
+
topic returns:
|
|
215
|
+
label: "Returns"
|
|
216
|
+
description: "Process return requests and generate return labels"
|
|
217
|
+
|
|
218
|
+
actions:
|
|
219
|
+
initiate_return:
|
|
220
|
+
description: "Initiate a return for an order"
|
|
221
|
+
target: "flow://Initiate_Return"
|
|
222
|
+
inputs:
|
|
223
|
+
order_number: string
|
|
224
|
+
description: "Order number to return"
|
|
225
|
+
reason: string
|
|
226
|
+
description: "Reason for return"
|
|
227
|
+
outputs:
|
|
228
|
+
return_label_url: string
|
|
229
|
+
description: "URL for return shipping label"
|
|
230
|
+
is_displayable: True
|
|
231
|
+
return_deadline: string
|
|
232
|
+
description: "Deadline to ship return"
|
|
233
|
+
is_displayable: True
|
|
234
|
+
|
|
235
|
+
reasoning:
|
|
236
|
+
instructions: ->
|
|
237
|
+
if @variables.return_initiated == True:
|
|
238
|
+
| Your return has been initiated!
|
|
239
|
+
| Return label: {!@variables.return_label_url}
|
|
240
|
+
|
|
241
|
+
if @variables.return_initiated == False:
|
|
242
|
+
| I can help you with a return for order {!@variables.order_number}.
|
|
243
|
+
| What is the reason for your return?
|
|
244
|
+
| Use the process_return action to start the return.
|
|
245
|
+
|
|
246
|
+
actions:
|
|
247
|
+
process_return: @actions.initiate_return
|
|
248
|
+
description: "Process the return request"
|
|
249
|
+
with order_number = @variables.order_number
|
|
250
|
+
with reason = ...
|
|
251
|
+
set @variables.return_initiated = True
|
|
252
|
+
set @variables.return_label_url = @outputs.return_label_url
|
|
253
|
+
|
|
254
|
+
back: @utils.transition to @topic.topic_selector
|
|
255
|
+
description: "Route to a different topic"
|
|
256
|
+
|
|
257
|
+
after_reasoning: ->
|
|
258
|
+
if @variables.return_initiated == True:
|
|
259
|
+
transition to @topic.follow_up
|
|
260
|
+
|
|
261
|
+
topic follow_up:
|
|
262
|
+
label: "Follow Up"
|
|
263
|
+
description: "Handle follow-up actions and next steps"
|
|
264
|
+
reasoning:
|
|
265
|
+
instructions: |
|
|
266
|
+
The customer's request has been processed.
|
|
267
|
+
Ask if there is anything else you can help with.
|
|
268
|
+
actions:
|
|
269
|
+
new_order: @utils.transition to @topic.order_status
|
|
270
|
+
description: "Look up another order"
|
|
271
|
+
back: @utils.transition to @topic.topic_selector
|
|
272
|
+
description: "Start over"
|
|
@@ -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:**
|