@salesforce/afv-skills 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -5
- package/skills/accessing-webapp-data/SKILL.md +178 -0
- package/skills/agentforce-development/SKILL.md +427 -0
- package/skills/agentforce-development/assets/README-legacy.md +89 -0
- package/skills/agentforce-development/assets/agent-spec-template.md +90 -0
- package/skills/agentforce-development/assets/agents/README.md +45 -0
- package/skills/agentforce-development/assets/agents/hello-world.agent +60 -0
- package/skills/agentforce-development/assets/agents/multi-topic.agent +105 -0
- package/skills/agentforce-development/assets/agents/production-faq.agent +101 -0
- package/skills/agentforce-development/assets/agents/production-faq.bundle-meta.xml +4 -0
- package/skills/agentforce-development/assets/agents/simple-qa.agent +72 -0
- package/skills/agentforce-development/assets/apex/models-api-queueable.cls +225 -0
- package/skills/agentforce-development/assets/bundle-meta.xml +23 -0
- package/skills/agentforce-development/assets/components/apex-action.agent +52 -0
- package/skills/agentforce-development/assets/components/error-handling.agent +58 -0
- package/skills/agentforce-development/assets/components/escalation-setup.agent +169 -0
- package/skills/agentforce-development/assets/components/flow-action.agent +66 -0
- package/skills/agentforce-development/assets/components/n-ary-conditions.agent +110 -0
- package/skills/agentforce-development/assets/components/topic-with-actions.agent +40 -0
- package/skills/agentforce-development/assets/deterministic-routing.agent +166 -0
- package/skills/agentforce-development/assets/escalation-pattern.agent +209 -0
- package/skills/agentforce-development/assets/flow-action-lookup.agent +115 -0
- package/skills/agentforce-development/assets/hub-and-spoke.agent +104 -0
- package/skills/agentforce-development/assets/invocable-apex-template.cls +187 -0
- package/skills/agentforce-development/assets/local-info-agent-annotated.agent +355 -0
- package/skills/agentforce-development/assets/metadata/basic-prompt-template.promptTemplate-meta.xml +109 -0
- package/skills/agentforce-development/assets/metadata/genai-function-apex.xml +92 -0
- package/skills/agentforce-development/assets/metadata/genai-function-flow.xml +57 -0
- package/skills/agentforce-development/assets/metadata/genai-plugin.xml +72 -0
- package/skills/agentforce-development/assets/metadata/http-callout-flow.flow-meta.xml +348 -0
- package/skills/agentforce-development/assets/metadata/record-grounded-prompt.promptTemplate-meta.xml +136 -0
- package/skills/agentforce-development/assets/minimal-starter.agent +42 -0
- package/skills/agentforce-development/assets/patterns/README.md +254 -0
- package/skills/agentforce-development/assets/patterns/action-callbacks.agent +178 -0
- package/skills/agentforce-development/assets/patterns/advanced-input-bindings.agent +141 -0
- package/skills/agentforce-development/assets/patterns/bidirectional-routing.agent +156 -0
- package/skills/agentforce-development/assets/patterns/critical-input-collection.agent +244 -0
- package/skills/agentforce-development/assets/patterns/delegation-routing.agent +89 -0
- package/skills/agentforce-development/assets/patterns/lifecycle-events.agent +127 -0
- package/skills/agentforce-development/assets/patterns/llm-controlled-actions.agent +184 -0
- package/skills/agentforce-development/assets/patterns/multi-step-workflow.agent +282 -0
- package/skills/agentforce-development/assets/patterns/open-gate-routing.agent +286 -0
- package/skills/agentforce-development/assets/patterns/procedural-instructions.agent +273 -0
- package/skills/agentforce-development/assets/patterns/prompt-template-action.agent +188 -0
- package/skills/agentforce-development/assets/patterns/system-instruction-overrides.agent +293 -0
- package/skills/agentforce-development/assets/prompt-rag-search.agent +131 -0
- package/skills/agentforce-development/assets/template-multi-topic.agent +160 -0
- package/skills/agentforce-development/assets/template-single-topic.agent +81 -0
- package/skills/agentforce-development/assets/verification-gate.agent +208 -0
- package/skills/agentforce-development/references/action-prompt-templates.md +164 -0
- package/skills/agentforce-development/references/actions-reference.md +592 -0
- package/skills/agentforce-development/references/agent-access-guide.md +72 -0
- package/skills/agentforce-development/references/agent-design-and-spec-creation.md +1010 -0
- package/skills/agentforce-development/references/agent-metadata-and-lifecycle.md +575 -0
- package/skills/agentforce-development/references/agent-script-core-language.md +1218 -0
- package/skills/agentforce-development/references/agent-topic-map-diagrams.md +323 -0
- package/skills/agentforce-development/references/agent-user-setup.md +526 -0
- package/skills/agentforce-development/references/agent-validation-and-debugging.md +803 -0
- package/skills/agentforce-development/references/known-issues.md +353 -0
- package/skills/agentforce-development/references/minimal-examples.md +67 -0
- package/skills/agentforce-development/references/production-gotchas.md +279 -0
- package/skills/agentforce-development/references/salesforce-cli-for-agents.md +393 -0
- package/skills/agentforce-development/references/version-history.md +23 -0
- package/skills/building-webapp-data-visualization/SKILL.md +72 -0
- package/skills/building-webapp-data-visualization/implementation/bar-line-chart.md +316 -0
- package/skills/building-webapp-data-visualization/implementation/dashboard-layout.md +189 -0
- package/skills/building-webapp-data-visualization/implementation/donut-chart.md +181 -0
- package/skills/building-webapp-data-visualization/implementation/stat-card.md +150 -0
- package/skills/building-webapp-react-components/SKILL.md +96 -0
- package/skills/building-webapp-react-components/implementation/component.md +78 -0
- package/skills/building-webapp-react-components/implementation/header-footer.md +132 -0
- package/skills/building-webapp-react-components/implementation/page.md +93 -0
- package/skills/configuring-webapp-csp-trusted-sites/SKILL.md +90 -0
- package/skills/configuring-webapp-csp-trusted-sites/implementation/metadata-format.md +281 -0
- package/skills/configuring-webapp-metadata/SKILL.md +158 -0
- package/skills/creating-webapp/SKILL.md +141 -0
- package/skills/deploying-webapp-to-salesforce/SKILL.md +229 -0
- package/skills/exploring-webapp-graphql-schema/SKILL.md +149 -0
- package/skills/fetching-webapp-rest-api/SKILL.md +167 -0
- package/skills/{salesforce-custom-application → generating-custom-application}/SKILL.md +2 -4
- package/skills/{salesforce-custom-field → generating-custom-field}/SKILL.md +1 -5
- package/skills/{salesforce-custom-lightning-type → generating-custom-lightning-type}/SKILL.md +36 -2
- package/skills/{salesforce-custom-object → generating-custom-object}/SKILL.md +1 -1
- package/skills/generating-custom-tab/SKILL.md +154 -0
- package/skills/generating-experience-lwr-site/SKILL.md +196 -0
- package/skills/generating-experience-lwr-site/docs/bootstrap-template-byo-lwr.md +224 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-brandingSet.md +131 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-route.md +232 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-themeLayout.md +141 -0
- package/skills/generating-experience-lwr-site/docs/configure-content-view.md +233 -0
- package/skills/generating-experience-lwr-site/docs/configure-guest-sharing-rules.md +42 -0
- package/skills/generating-experience-lwr-site/docs/handle-component-and-region-ids.md +27 -0
- package/skills/generating-experience-lwr-site/docs/handle-ui-components.md +215 -0
- package/skills/generating-experience-react-site/SKILL.md +67 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-custom-site.md +41 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience-bundle.md +17 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience-config.md +21 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience.md +38 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-network.md +72 -0
- package/skills/{salesforce-flexipage → generating-flexipage}/SKILL.md +86 -9
- package/skills/{salesforce-flow → generating-flow}/SKILL.md +3 -3
- package/skills/generating-fragment/SKILL.md +117 -0
- package/skills/generating-lightning-app/SKILL.md +423 -0
- package/skills/{salesforce-list-view → generating-list-view}/SKILL.md +1 -1
- package/skills/generating-permission-set/SKILL.md +174 -0
- package/skills/{salesforce-validation-rule → generating-validation-rule}/SKILL.md +1 -1
- package/skills/generating-webapp-graphql-mutation-query/SKILL.md +258 -0
- package/skills/generating-webapp-graphql-read-query/SKILL.md +253 -0
- package/skills/implementing-webapp-file-upload/SKILL.md +396 -0
- package/skills/installing-webapp-features/SKILL.md +210 -0
- package/skills/managing-webapp-agentforce-conversation-client/SKILL.md +186 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/constraints.md +134 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/examples.md +132 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/style-tokens.md +101 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/troubleshooting.md +57 -0
- package/skills/switching-org/SKILL.md +28 -0
- package/skills/using-webapp-graphql/SKILL.md +324 -0
- package/skills/using-webapp-graphql/shared-schema.graphqls +1150 -0
- package/skills/apex-class/SKILL.md +0 -253
- package/skills/apex-class/examples/AccountDeduplicationBatch.cls +0 -148
- package/skills/apex-class/examples/AccountSelector.cls +0 -193
- package/skills/apex-class/examples/AccountService.cls +0 -201
- package/skills/apex-class/templates/abstract.cls +0 -128
- package/skills/apex-class/templates/batch.cls +0 -125
- package/skills/apex-class/templates/domain.cls +0 -102
- package/skills/apex-class/templates/dto.cls +0 -108
- package/skills/apex-class/templates/exception.cls +0 -51
- package/skills/apex-class/templates/interface.cls +0 -25
- package/skills/apex-class/templates/queueable.cls +0 -92
- package/skills/apex-class/templates/schedulable.cls +0 -75
- package/skills/apex-class/templates/selector.cls +0 -92
- package/skills/apex-class/templates/service.cls +0 -69
- package/skills/apex-class/templates/utility.cls +0 -97
- package/skills/apex-test-class/SKILL.md +0 -101
- package/skills/apex-test-class/references/assertion-patterns.md +0 -209
- package/skills/apex-test-class/references/async-testing.md +0 -276
- package/skills/apex-test-class/references/mocking-patterns.md +0 -219
- package/skills/apex-test-class/references/test-data-factory.md +0 -176
- package/skills/deployment-readiness-check/SKILL.md +0 -257
- package/skills/deployment-readiness-check/assets/deployment_checklist.md +0 -286
- package/skills/deployment-readiness-check/references/rollback_procedures.md +0 -308
- package/skills/deployment-readiness-check/scripts/check_metadata.sh +0 -207
- package/skills/salesforce-custom-tab/SKILL.md +0 -78
- package/skills/salesforce-experience-site/SKILL.md +0 -178
- package/skills/salesforce-fragment/SKILL.md +0 -42
- package/skills/salesforce-lightning-app-build/SKILL.md +0 -254
- package/skills/salesforce-web-app-creating-records/SKILL.md +0 -84
- package/skills/salesforce-web-app-feature/SKILL.md +0 -70
- package/skills/salesforce-web-app-list-and-create-records/SKILL.md +0 -36
- package/skills/salesforce-web-application/SKILL.md +0 -34
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# N-ary Boolean Conditions Template
|
|
2
|
+
# Demonstrates using 3+ conditions with and/or operators
|
|
3
|
+
#
|
|
4
|
+
# This is a PARTIAL template - integrate into a complete agent file
|
|
5
|
+
#
|
|
6
|
+
# ★ KEY CONCEPTS:
|
|
7
|
+
#
|
|
8
|
+
# N-ary AND: All conditions must be true
|
|
9
|
+
# N-ary OR: At least one condition must be true
|
|
10
|
+
# Grouping: Use () for complex expressions
|
|
11
|
+
#
|
|
12
|
+
# ★ Supported Contexts:
|
|
13
|
+
# - if statements in before_reasoning/after_reasoning
|
|
14
|
+
# - available when clauses on actions
|
|
15
|
+
#
|
|
16
|
+
# ★ Common Mistake:
|
|
17
|
+
# DO NOT nest if statements. Use N-ary and/or instead.
|
|
18
|
+
# ❌ if a: if b: if c: (nested - INVALID)
|
|
19
|
+
# ✅ if a and b and c: (flat - CORRECT)
|
|
20
|
+
|
|
21
|
+
# ═══════════════════════════════════════════════════════════════
|
|
22
|
+
# PATTERN 1: Three+ AND conditions in lifecycle
|
|
23
|
+
# ═══════════════════════════════════════════════════════════════
|
|
24
|
+
|
|
25
|
+
# Example: Require multiple authentication checks
|
|
26
|
+
topic secure_action:
|
|
27
|
+
label: "Secure Action"
|
|
28
|
+
description: "Performs security-sensitive operations"
|
|
29
|
+
|
|
30
|
+
before_reasoning:
|
|
31
|
+
# All three conditions must be true
|
|
32
|
+
if @variables.is_authenticated and @variables.has_permission and @variables.session_valid:
|
|
33
|
+
transition to @topic.authorized_action
|
|
34
|
+
# Otherwise stay in this topic
|
|
35
|
+
|
|
36
|
+
reasoning:
|
|
37
|
+
instructions: ->
|
|
38
|
+
| User needs to authenticate before proceeding.
|
|
39
|
+
|
|
40
|
+
# ═══════════════════════════════════════════════════════════════
|
|
41
|
+
# PATTERN 2: Three+ OR conditions in lifecycle
|
|
42
|
+
# ═══════════════════════════════════════════════════════════════
|
|
43
|
+
|
|
44
|
+
# Example: Any elevated role gets access
|
|
45
|
+
topic admin_panel:
|
|
46
|
+
label: "Admin Panel"
|
|
47
|
+
description: "Administrative features"
|
|
48
|
+
|
|
49
|
+
before_reasoning:
|
|
50
|
+
# Any one of these roles grants access
|
|
51
|
+
if @variables.is_admin or @variables.is_moderator or @variables.is_superuser:
|
|
52
|
+
transition to @topic.admin_features
|
|
53
|
+
# Non-admins redirected
|
|
54
|
+
transition to @topic.access_denied
|
|
55
|
+
|
|
56
|
+
# ═══════════════════════════════════════════════════════════════
|
|
57
|
+
# PATTERN 3: N-ary conditions in available when
|
|
58
|
+
# ═══════════════════════════════════════════════════════════════
|
|
59
|
+
|
|
60
|
+
topic order_management:
|
|
61
|
+
label: "Order Management"
|
|
62
|
+
description: "Handles order operations"
|
|
63
|
+
|
|
64
|
+
reasoning:
|
|
65
|
+
instructions: ->
|
|
66
|
+
| Help the customer with their order.
|
|
67
|
+
actions:
|
|
68
|
+
# Action available only when ALL conditions met
|
|
69
|
+
process_return: @actions.handle_return
|
|
70
|
+
description: "Process a return request"
|
|
71
|
+
available when @variables.order_exists == True and @variables.within_return_window == True and @variables.item_eligible == True
|
|
72
|
+
|
|
73
|
+
# Action available when ANY premium tier matches
|
|
74
|
+
use_priority: @actions.priority_service
|
|
75
|
+
description: "Use priority service queue"
|
|
76
|
+
available when @variables.tier == "gold" or @variables.tier == "platinum" or @variables.tier == "enterprise"
|
|
77
|
+
|
|
78
|
+
# Mixed: specific product AND any valid status
|
|
79
|
+
expedite: @actions.expedite_order
|
|
80
|
+
description: "Expedite the current order"
|
|
81
|
+
available when @variables.product_type == "perishable" and (@variables.status == "pending" or @variables.status == "processing")
|
|
82
|
+
|
|
83
|
+
# ═══════════════════════════════════════════════════════════════
|
|
84
|
+
# PATTERN 4: Complex grouped conditions
|
|
85
|
+
# ═══════════════════════════════════════════════════════════════
|
|
86
|
+
|
|
87
|
+
topic smart_routing:
|
|
88
|
+
label: "Smart Routing"
|
|
89
|
+
description: "Routes based on complex criteria"
|
|
90
|
+
|
|
91
|
+
before_reasoning:
|
|
92
|
+
# Premium with any product type OR standard with warranty
|
|
93
|
+
if (@variables.tier == "premium" and @variables.product_type != None) or (@variables.tier == "standard" and @variables.has_warranty == True):
|
|
94
|
+
transition to @topic.priority_support
|
|
95
|
+
|
|
96
|
+
# ═══════════════════════════════════════════════════════════════
|
|
97
|
+
# ANTI-PATTERNS - DO NOT USE
|
|
98
|
+
# ═══════════════════════════════════════════════════════════════
|
|
99
|
+
|
|
100
|
+
# ❌ WRONG - Nested if statements (causes "Missing required element" error)
|
|
101
|
+
# before_reasoning:
|
|
102
|
+
# if @variables.a == True:
|
|
103
|
+
# if @variables.b == True:
|
|
104
|
+
# if @variables.c == True:
|
|
105
|
+
# transition to @topic.x
|
|
106
|
+
|
|
107
|
+
# ✅ CORRECT - Flat N-ary condition
|
|
108
|
+
# before_reasoning:
|
|
109
|
+
# if @variables.a == True and @variables.b == True and @variables.c == True:
|
|
110
|
+
# transition to @topic.x
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Topic with Actions Template
|
|
2
|
+
# A topic that integrates with external systems via Flow or Apex actions
|
|
3
|
+
# This is a PARTIAL template - use within a complete agent file
|
|
4
|
+
#
|
|
5
|
+
# Two-Level Action System:
|
|
6
|
+
# Level 1: topic.actions block DEFINES actions (with target:, inputs:, outputs:)
|
|
7
|
+
# Level 2: reasoning.actions block INVOKES them (with @actions.name, with/set)
|
|
8
|
+
#
|
|
9
|
+
# Usage: Replace {{placeholders}} with your values
|
|
10
|
+
# Note: Actions defined inside topic are local to that topic
|
|
11
|
+
|
|
12
|
+
topic {{topic_name}}:
|
|
13
|
+
description: "{{TopicDescription}}"
|
|
14
|
+
|
|
15
|
+
# Level 1: DEFINE actions available to this topic
|
|
16
|
+
actions:
|
|
17
|
+
{{action_name}}:
|
|
18
|
+
description: "{{ActionDescription}}"
|
|
19
|
+
inputs:
|
|
20
|
+
{{input_name}}: {{input_type}}
|
|
21
|
+
description: "{{InputDescription}}"
|
|
22
|
+
outputs:
|
|
23
|
+
{{output_name}}: {{output_type}}
|
|
24
|
+
description: "{{OutputDescription}}"
|
|
25
|
+
target: "{{ActionTarget}}" # flow://FlowName or apex://ClassName
|
|
26
|
+
|
|
27
|
+
reasoning:
|
|
28
|
+
instructions: ->
|
|
29
|
+
| {{TopicInstructions}}
|
|
30
|
+
| Use the available actions to help the user.
|
|
31
|
+
| Capture and communicate results clearly.
|
|
32
|
+
|
|
33
|
+
# Level 2: INVOKE the actions defined above
|
|
34
|
+
actions:
|
|
35
|
+
invoke_action: @actions.{{action_name}}
|
|
36
|
+
with {{input_name}}=...
|
|
37
|
+
set @variables.{{result_variable}} = @outputs.{{output_name}}
|
|
38
|
+
|
|
39
|
+
back_to_menu: @utils.transition to @topic.topic_selector
|
|
40
|
+
description: "Return to main menu"
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Deterministic Routing Template (Zero-Hallucination Pattern)
|
|
2
|
+
# ============================================================
|
|
3
|
+
#
|
|
4
|
+
# This template demonstrates the zero-hallucination intent classification
|
|
5
|
+
# pattern using action output flags to control LLM behavior.
|
|
6
|
+
#
|
|
7
|
+
# Pattern: Classify intent deterministically, route without hallucination
|
|
8
|
+
# Use when: Critical routing decisions that must not be influenced by LLM creativity
|
|
9
|
+
#
|
|
10
|
+
# KEY PATTERN:
|
|
11
|
+
# In Agentforce Assets, set action outputs with:
|
|
12
|
+
# - is_displayable: False (LLM cannot show this to user)
|
|
13
|
+
# - is_used_by_planner: True (LLM can use for routing)
|
|
14
|
+
#
|
|
15
|
+
# This ensures the LLM routes based on classification but cannot
|
|
16
|
+
# generate hallucinated responses based on the classification data.
|
|
17
|
+
|
|
18
|
+
system:
|
|
19
|
+
messages:
|
|
20
|
+
welcome: "Hello! How can I help you today?"
|
|
21
|
+
error: "I apologize, something went wrong. Let me try again."
|
|
22
|
+
instructions: "You are a customer service agent. Route users to the correct department based on their intent."
|
|
23
|
+
|
|
24
|
+
config:
|
|
25
|
+
agent_name: "DeterministicRoutingAgent"
|
|
26
|
+
agent_label: "Smart Router Agent"
|
|
27
|
+
description: "Agent demonstrating zero-hallucination intent routing pattern"
|
|
28
|
+
default_agent_user: "agent@yourorg.com" # REQUIRED: Change to valid Einstein Agent User
|
|
29
|
+
|
|
30
|
+
variables:
|
|
31
|
+
# Intent classification (populated by action with is_displayable: False)
|
|
32
|
+
classified_intent: mutable string = ""
|
|
33
|
+
description: "Classification result - hidden from user responses"
|
|
34
|
+
confidence_score: mutable number = 0
|
|
35
|
+
description: "Classification confidence (0-100)"
|
|
36
|
+
|
|
37
|
+
# Routing state
|
|
38
|
+
needs_classification: mutable boolean = True
|
|
39
|
+
description: "Whether user intent needs classification"
|
|
40
|
+
low_confidence_warning: mutable boolean = False
|
|
41
|
+
description: "Flag for low confidence routing"
|
|
42
|
+
|
|
43
|
+
start_agent topic_selector:
|
|
44
|
+
description: "Classify intent and route deterministically"
|
|
45
|
+
reasoning:
|
|
46
|
+
instructions: ->
|
|
47
|
+
# ====================================================
|
|
48
|
+
# DETERMINISTIC ROUTING (based on classified_intent)
|
|
49
|
+
# ====================================================
|
|
50
|
+
|
|
51
|
+
# Route ONLY when classification is complete
|
|
52
|
+
if @variables.needs_classification == False:
|
|
53
|
+
|
|
54
|
+
# HIGH-CONFIDENCE ROUTING
|
|
55
|
+
if @variables.confidence_score >= 80:
|
|
56
|
+
if @variables.classified_intent == "billing":
|
|
57
|
+
transition to @topic.billing
|
|
58
|
+
if @variables.classified_intent == "technical_support":
|
|
59
|
+
transition to @topic.technical_support
|
|
60
|
+
if @variables.classified_intent == "sales":
|
|
61
|
+
transition to @topic.sales
|
|
62
|
+
if @variables.classified_intent == "returns":
|
|
63
|
+
transition to @topic.returns
|
|
64
|
+
|
|
65
|
+
# LOW-CONFIDENCE: Confirm with user
|
|
66
|
+
if @variables.confidence_score < 80:
|
|
67
|
+
set @variables.low_confidence_warning = True
|
|
68
|
+
| I want to make sure I route you correctly.
|
|
69
|
+
| It sounds like you need help with **{!@variables.classified_intent}**.
|
|
70
|
+
| Is that correct?
|
|
71
|
+
|
|
72
|
+
# INITIAL STATE: Ask for help topic
|
|
73
|
+
if @variables.needs_classification == True:
|
|
74
|
+
| I can help with billing, technical support, sales, or returns.
|
|
75
|
+
| What do you need help with today?
|
|
76
|
+
|
|
77
|
+
actions:
|
|
78
|
+
# CRITICAL: This action's outputs must be configured in Agentforce Assets:
|
|
79
|
+
# - classified_intent: is_displayable=False, is_used_by_planner=True
|
|
80
|
+
# - confidence_score: is_displayable=False, is_used_by_planner=True
|
|
81
|
+
#
|
|
82
|
+
# This ensures LLM cannot hallucinate based on classification data
|
|
83
|
+
classify_intent: @actions.Classify_User_Intent
|
|
84
|
+
description: "Determine what the user needs help with"
|
|
85
|
+
with user_message = ... # LLM extracts from conversation
|
|
86
|
+
set @variables.classified_intent = @outputs.intent
|
|
87
|
+
set @variables.confidence_score = @outputs.confidence
|
|
88
|
+
set @variables.needs_classification = False
|
|
89
|
+
|
|
90
|
+
# Manual routing for low-confidence cases
|
|
91
|
+
go_billing: @utils.transition to @topic.billing
|
|
92
|
+
description: "Yes, I need billing help"
|
|
93
|
+
available when @variables.low_confidence_warning == True and @variables.classified_intent == "billing"
|
|
94
|
+
|
|
95
|
+
go_support: @utils.transition to @topic.technical_support
|
|
96
|
+
description: "Yes, I need technical support"
|
|
97
|
+
available when @variables.low_confidence_warning == True and @variables.classified_intent == "technical_support"
|
|
98
|
+
|
|
99
|
+
go_sales: @utils.transition to @topic.sales
|
|
100
|
+
description: "Yes, I need sales help"
|
|
101
|
+
available when @variables.low_confidence_warning == True and @variables.classified_intent == "sales"
|
|
102
|
+
|
|
103
|
+
go_returns: @utils.transition to @topic.returns
|
|
104
|
+
description: "Yes, I need returns help"
|
|
105
|
+
available when @variables.low_confidence_warning == True and @variables.classified_intent == "returns"
|
|
106
|
+
|
|
107
|
+
# Reclassify if user said "no"
|
|
108
|
+
reclassify: @utils.setVariables
|
|
109
|
+
description: "That's not what I need - let me clarify"
|
|
110
|
+
available when @variables.low_confidence_warning == True
|
|
111
|
+
with needs_classification = True
|
|
112
|
+
with classified_intent = ""
|
|
113
|
+
with confidence_score = 0
|
|
114
|
+
with low_confidence_warning = False
|
|
115
|
+
|
|
116
|
+
# ============================================================
|
|
117
|
+
# ROUTED TOPICS
|
|
118
|
+
# ============================================================
|
|
119
|
+
|
|
120
|
+
topic billing:
|
|
121
|
+
description: "Handle billing inquiries"
|
|
122
|
+
reasoning:
|
|
123
|
+
instructions: |
|
|
124
|
+
Help the customer with their billing question.
|
|
125
|
+
You can view invoices, explain charges, or process payments.
|
|
126
|
+
actions:
|
|
127
|
+
back: @utils.transition to @topic.topic_selector
|
|
128
|
+
description: "Return to main menu"
|
|
129
|
+
escalate_now: @utils.escalate
|
|
130
|
+
description: "Transfer to billing specialist"
|
|
131
|
+
|
|
132
|
+
topic technical_support:
|
|
133
|
+
description: "Handle technical support issues"
|
|
134
|
+
reasoning:
|
|
135
|
+
instructions: |
|
|
136
|
+
Help the customer with their technical issue.
|
|
137
|
+
Troubleshoot problems and provide solutions.
|
|
138
|
+
actions:
|
|
139
|
+
back: @utils.transition to @topic.topic_selector
|
|
140
|
+
description: "Return to main menu"
|
|
141
|
+
escalate_now: @utils.escalate
|
|
142
|
+
description: "Transfer to technical specialist"
|
|
143
|
+
|
|
144
|
+
topic sales:
|
|
145
|
+
description: "Handle sales inquiries"
|
|
146
|
+
reasoning:
|
|
147
|
+
instructions: |
|
|
148
|
+
Help the customer with sales questions.
|
|
149
|
+
Provide product information and pricing.
|
|
150
|
+
actions:
|
|
151
|
+
back: @utils.transition to @topic.topic_selector
|
|
152
|
+
description: "Return to main menu"
|
|
153
|
+
escalate_now: @utils.escalate
|
|
154
|
+
description: "Transfer to sales representative"
|
|
155
|
+
|
|
156
|
+
topic returns:
|
|
157
|
+
description: "Handle return requests"
|
|
158
|
+
reasoning:
|
|
159
|
+
instructions: |
|
|
160
|
+
Help the customer with their return request.
|
|
161
|
+
Check eligibility and process returns.
|
|
162
|
+
actions:
|
|
163
|
+
back: @utils.transition to @topic.topic_selector
|
|
164
|
+
description: "Return to main menu"
|
|
165
|
+
escalate_now: @utils.escalate
|
|
166
|
+
description: "Transfer to returns specialist"
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Escalation Pattern Template
|
|
2
|
+
# ===========================
|
|
3
|
+
#
|
|
4
|
+
# This template demonstrates the complete escalation pattern with:
|
|
5
|
+
# - Multi-channel connection blocks (messaging, voice, web)
|
|
6
|
+
# - Graceful handoff with escalation messages
|
|
7
|
+
# - Pre-escalation data gathering
|
|
8
|
+
# - OmniChannel routing configuration
|
|
9
|
+
#
|
|
10
|
+
# Pattern: Multi-channel escalation with context preservation
|
|
11
|
+
# Use when: Any agent that needs human handoff capabilities
|
|
12
|
+
|
|
13
|
+
system:
|
|
14
|
+
messages:
|
|
15
|
+
welcome: "Hello! I'm here to help. If I can't assist you, I can connect you with a specialist."
|
|
16
|
+
error: "I apologize, something went wrong. Let me connect you with someone who can help."
|
|
17
|
+
instructions: "You are a helpful agent. When you cannot resolve an issue, escalate to a human agent with full context."
|
|
18
|
+
|
|
19
|
+
config:
|
|
20
|
+
agent_name: "EscalationPatternAgent"
|
|
21
|
+
agent_label: "Escalation Demo Agent"
|
|
22
|
+
description: "Agent demonstrating complete escalation patterns"
|
|
23
|
+
default_agent_user: "agent@yourorg.com" # REQUIRED: Change to valid Einstein Agent User
|
|
24
|
+
|
|
25
|
+
# ============================================================
|
|
26
|
+
# CONNECTION BLOCKS (Multi-Channel Escalation)
|
|
27
|
+
# ============================================================
|
|
28
|
+
|
|
29
|
+
connections:
|
|
30
|
+
# Messaging channel (SMS, WhatsApp, etc.)
|
|
31
|
+
connection messaging:
|
|
32
|
+
escalation_message: "One moment, I'm transferring our conversation to a specialist who can better assist you."
|
|
33
|
+
outbound_route_type: "OmniChannelFlow"
|
|
34
|
+
outbound_route_name: "<flow://Escalate_Messaging_To_Agent>"
|
|
35
|
+
adaptive_response_allowed: False
|
|
36
|
+
|
|
37
|
+
# Voice channel
|
|
38
|
+
connection voice:
|
|
39
|
+
escalation_message: "Please hold while I transfer you to a specialist. They will have full context of our conversation."
|
|
40
|
+
outbound_route_type: "Queue"
|
|
41
|
+
outbound_route_name: "Customer_Support_Queue"
|
|
42
|
+
adaptive_response_allowed: True
|
|
43
|
+
|
|
44
|
+
# Web chat channel
|
|
45
|
+
connection web:
|
|
46
|
+
escalation_message: "Connecting you with a live agent now. They'll be with you shortly."
|
|
47
|
+
outbound_route_type: "OmniChannelFlow"
|
|
48
|
+
outbound_route_name: "<flow://Web_Chat_Escalation_Flow>"
|
|
49
|
+
adaptive_response_allowed: False
|
|
50
|
+
|
|
51
|
+
variables:
|
|
52
|
+
# Customer context
|
|
53
|
+
customer_name: mutable string = ""
|
|
54
|
+
description: "Customer's name for personalization"
|
|
55
|
+
customer_issue: mutable string = ""
|
|
56
|
+
description: "Summary of customer's issue"
|
|
57
|
+
issue_category: mutable string = ""
|
|
58
|
+
description: "Category of issue for routing"
|
|
59
|
+
|
|
60
|
+
# Escalation state
|
|
61
|
+
escalation_reason: mutable string = ""
|
|
62
|
+
description: "Reason for escalation"
|
|
63
|
+
attempts_before_escalation: mutable number = 0
|
|
64
|
+
description: "Number of resolution attempts"
|
|
65
|
+
ready_to_escalate: mutable boolean = False
|
|
66
|
+
description: "Whether pre-escalation data is gathered"
|
|
67
|
+
|
|
68
|
+
start_agent entry:
|
|
69
|
+
description: "Entry point - greet and assess needs"
|
|
70
|
+
reasoning:
|
|
71
|
+
instructions: |
|
|
72
|
+
Greet the customer and understand their needs.
|
|
73
|
+
Try to help directly, escalate if needed.
|
|
74
|
+
actions:
|
|
75
|
+
go_support: @utils.transition to @topic.support
|
|
76
|
+
description: "Help with support issue"
|
|
77
|
+
|
|
78
|
+
# ============================================================
|
|
79
|
+
# SUPPORT TOPIC (With Escalation Triggers)
|
|
80
|
+
# ============================================================
|
|
81
|
+
|
|
82
|
+
topic support:
|
|
83
|
+
description: "Attempt to resolve issue, escalate if unable"
|
|
84
|
+
reasoning:
|
|
85
|
+
instructions: ->
|
|
86
|
+
# POST-ACTION: Check if escalation was triggered
|
|
87
|
+
if @variables.ready_to_escalate == True:
|
|
88
|
+
transition to @topic.pre_escalation
|
|
89
|
+
|
|
90
|
+
# Track attempts
|
|
91
|
+
| I'm here to help you with your issue.
|
|
92
|
+
|
|
93
|
+
if @variables.attempts_before_escalation >= 2:
|
|
94
|
+
| It seems like I'm having trouble resolving this.
|
|
95
|
+
| Would you like me to connect you with a specialist?
|
|
96
|
+
|
|
97
|
+
actions:
|
|
98
|
+
# Attempt resolution
|
|
99
|
+
try_resolve: @actions.Attempt_Resolution
|
|
100
|
+
description: "Try to resolve the issue"
|
|
101
|
+
with issue = ... # LLM extracts from conversation
|
|
102
|
+
set @variables.customer_issue = @outputs.issue_summary
|
|
103
|
+
set @variables.issue_category = @outputs.category
|
|
104
|
+
set @variables.attempts_before_escalation = @variables.attempts_before_escalation + 1
|
|
105
|
+
|
|
106
|
+
# User-initiated escalation
|
|
107
|
+
request_human: @utils.setVariables
|
|
108
|
+
description: "I'd like to speak with a human"
|
|
109
|
+
with escalation_reason = "Customer requested human agent"
|
|
110
|
+
with ready_to_escalate = True
|
|
111
|
+
|
|
112
|
+
# Agent-initiated escalation (after failed attempts)
|
|
113
|
+
escalate_complex: @utils.setVariables
|
|
114
|
+
description: "Connect me with a specialist"
|
|
115
|
+
available when @variables.attempts_before_escalation >= 2
|
|
116
|
+
with escalation_reason = "Unable to resolve after multiple attempts"
|
|
117
|
+
with ready_to_escalate = True
|
|
118
|
+
|
|
119
|
+
# ============================================================
|
|
120
|
+
# PRE-ESCALATION TOPIC (Gather Context)
|
|
121
|
+
# ============================================================
|
|
122
|
+
|
|
123
|
+
topic pre_escalation:
|
|
124
|
+
description: "Gather information before escalating"
|
|
125
|
+
reasoning:
|
|
126
|
+
instructions: ->
|
|
127
|
+
# Ensure we have customer name for personalization
|
|
128
|
+
if @variables.customer_name == "":
|
|
129
|
+
| Before I transfer you, may I have your name so the specialist can address you properly?
|
|
130
|
+
else:
|
|
131
|
+
| Thank you, {!@variables.customer_name}. Let me prepare the transfer.
|
|
132
|
+
|
|
133
|
+
# Display summary of what we'll share
|
|
134
|
+
if @variables.customer_name != "" and @variables.customer_issue != "":
|
|
135
|
+
| I'll share the following with the specialist:
|
|
136
|
+
| - Your issue: {!@variables.customer_issue}
|
|
137
|
+
| - Category: {!@variables.issue_category}
|
|
138
|
+
| - Reason for transfer: {!@variables.escalation_reason}
|
|
139
|
+
|
|
|
140
|
+
| Ready to connect you now.
|
|
141
|
+
transition to @topic.escalation
|
|
142
|
+
|
|
143
|
+
actions:
|
|
144
|
+
# Capture customer name
|
|
145
|
+
save_name: @utils.setVariables
|
|
146
|
+
description: "Save customer name"
|
|
147
|
+
available when @variables.customer_name == ""
|
|
148
|
+
with customer_name = ... # LLM extracts name from response
|
|
149
|
+
|
|
150
|
+
# Proceed to escalation
|
|
151
|
+
proceed: @utils.transition to @topic.escalation
|
|
152
|
+
description: "Proceed with transfer"
|
|
153
|
+
available when @variables.customer_name != ""
|
|
154
|
+
|
|
155
|
+
# Cancel escalation
|
|
156
|
+
cancel_escalation: @utils.setVariables
|
|
157
|
+
description: "Actually, let me try again with the bot"
|
|
158
|
+
with ready_to_escalate = False
|
|
159
|
+
with escalation_reason = ""
|
|
160
|
+
run @utils.transition to @topic.support
|
|
161
|
+
|
|
162
|
+
# ============================================================
|
|
163
|
+
# ESCALATION TOPIC (Handoff)
|
|
164
|
+
# ============================================================
|
|
165
|
+
|
|
166
|
+
topic escalation:
|
|
167
|
+
description: "Execute escalation to human agent"
|
|
168
|
+
reasoning:
|
|
169
|
+
instructions: ->
|
|
170
|
+
# Log escalation context (this gets passed to human agent)
|
|
171
|
+
run @actions.Log_Escalation_Context
|
|
172
|
+
with customer_name = @variables.customer_name
|
|
173
|
+
with issue_summary = @variables.customer_issue
|
|
174
|
+
with category = @variables.issue_category
|
|
175
|
+
with reason = @variables.escalation_reason
|
|
176
|
+
with attempt_count = @variables.attempts_before_escalation
|
|
177
|
+
|
|
178
|
+
| Transferring you now. Thank you for your patience!
|
|
179
|
+
|
|
180
|
+
actions:
|
|
181
|
+
# The actual escalation - uses connection block configuration
|
|
182
|
+
handoff: @utils.escalate
|
|
183
|
+
description: "Transfer to human agent"
|
|
184
|
+
|
|
185
|
+
# ============================================================
|
|
186
|
+
# OPTIONAL: SPECIALIZED ESCALATION QUEUES
|
|
187
|
+
# ============================================================
|
|
188
|
+
|
|
189
|
+
topic escalate_billing:
|
|
190
|
+
description: "Escalate specifically to billing team"
|
|
191
|
+
reasoning:
|
|
192
|
+
instructions: |
|
|
193
|
+
I'm connecting you with our billing specialists.
|
|
194
|
+
They'll be able to help with your account questions.
|
|
195
|
+
actions:
|
|
196
|
+
# Note: In production, you'd configure this action
|
|
197
|
+
# to route to a specific billing queue
|
|
198
|
+
billing_handoff: @utils.escalate
|
|
199
|
+
description: "Transfer to billing team"
|
|
200
|
+
|
|
201
|
+
topic escalate_technical:
|
|
202
|
+
description: "Escalate specifically to technical support"
|
|
203
|
+
reasoning:
|
|
204
|
+
instructions: |
|
|
205
|
+
I'm connecting you with our technical support team.
|
|
206
|
+
They specialize in resolving complex technical issues.
|
|
207
|
+
actions:
|
|
208
|
+
tech_handoff: @utils.escalate
|
|
209
|
+
description: "Transfer to technical support"
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# Flow Action Lookup Template
|
|
2
|
+
# ============================
|
|
3
|
+
#
|
|
4
|
+
# This template demonstrates the pattern for calling Flow actions
|
|
5
|
+
# that return complex data types (SObjects, lists, custom types).
|
|
6
|
+
#
|
|
7
|
+
# Pattern: Data lookup and display using Flow actions
|
|
8
|
+
# Use when: Fetching records from Salesforce (Cases, Orders, Accounts)
|
|
9
|
+
#
|
|
10
|
+
# CRITICAL: When defining Flow action outputs in Agentforce Assets:
|
|
11
|
+
# - For SObject returns: complex_data_type_name = "lightning__recordInfoType"
|
|
12
|
+
# - For list[string]: complex_data_type_name = "lightning__textType"
|
|
13
|
+
# - For currency: complex_data_type_name = "lightning__currencyType"
|
|
14
|
+
|
|
15
|
+
system:
|
|
16
|
+
messages:
|
|
17
|
+
welcome: "Hello! I can help you look up order information."
|
|
18
|
+
error: "I apologize, something went wrong retrieving your data."
|
|
19
|
+
instructions: "You are a customer service agent helping users look up their orders."
|
|
20
|
+
|
|
21
|
+
config:
|
|
22
|
+
agent_name: "FlowActionLookupAgent"
|
|
23
|
+
agent_label: "Order Lookup Agent"
|
|
24
|
+
description: "Agent demonstrating Flow action patterns with complex data types"
|
|
25
|
+
default_agent_user: "agent@yourorg.com" # REQUIRED: Change to valid Einstein Agent User
|
|
26
|
+
|
|
27
|
+
variables:
|
|
28
|
+
# Customer context (from session)
|
|
29
|
+
customer_id: linked string
|
|
30
|
+
source: @session.customerId
|
|
31
|
+
description: "Customer ID from session context"
|
|
32
|
+
|
|
33
|
+
# Order data (populated by Flow action)
|
|
34
|
+
order_id: mutable string = ""
|
|
35
|
+
description: "Current order being viewed"
|
|
36
|
+
order_status: mutable string = ""
|
|
37
|
+
description: "Order status from lookup"
|
|
38
|
+
order_total: mutable string = ""
|
|
39
|
+
description: "Order total amount"
|
|
40
|
+
order_date: mutable string = ""
|
|
41
|
+
description: "Order date"
|
|
42
|
+
|
|
43
|
+
# Error handling
|
|
44
|
+
lookup_error: mutable boolean = False
|
|
45
|
+
description: "Whether lookup encountered an error"
|
|
46
|
+
|
|
47
|
+
start_agent entry:
|
|
48
|
+
description: "Entry point - welcome and route to order lookup"
|
|
49
|
+
reasoning:
|
|
50
|
+
instructions: |
|
|
51
|
+
Welcome the customer and offer to help with order lookups.
|
|
52
|
+
actions:
|
|
53
|
+
go_lookup: @utils.transition to @topic.order_lookup
|
|
54
|
+
description: "Start order lookup"
|
|
55
|
+
|
|
56
|
+
# ============================================================
|
|
57
|
+
# ORDER LOOKUP TOPIC (Flow Action Pattern)
|
|
58
|
+
# ============================================================
|
|
59
|
+
|
|
60
|
+
topic order_lookup:
|
|
61
|
+
description: "Look up order details using Flow action"
|
|
62
|
+
reasoning:
|
|
63
|
+
instructions: ->
|
|
64
|
+
# POST-ACTION CHECK: Display results if order was found
|
|
65
|
+
if @variables.order_status != "":
|
|
66
|
+
| **Order Details**
|
|
67
|
+
| - Order ID: {!@variables.order_id}
|
|
68
|
+
| - Status: {!@variables.order_status}
|
|
69
|
+
| - Total: {!@variables.order_total}
|
|
70
|
+
| - Date: {!@variables.order_date}
|
|
71
|
+
|
|
|
72
|
+
| Is there anything else you'd like to know about this order?
|
|
73
|
+
|
|
74
|
+
# ERROR CHECK: Handle lookup failures
|
|
75
|
+
if @variables.lookup_error == True:
|
|
76
|
+
| I couldn't find that order. Please check the order ID and try again.
|
|
77
|
+
set @variables.lookup_error = False
|
|
78
|
+
|
|
79
|
+
# INITIAL STATE: Ask for order ID
|
|
80
|
+
if @variables.order_id == "":
|
|
81
|
+
| What order would you like me to look up?
|
|
82
|
+
| Please provide your order ID.
|
|
83
|
+
|
|
84
|
+
actions:
|
|
85
|
+
# Flow action with SObject return type
|
|
86
|
+
# In Agentforce Assets, set outputs.order_record complex_data_type_name = "lightning__recordInfoType"
|
|
87
|
+
lookup_order: @actions.Get_Order_Details
|
|
88
|
+
description: "Look up order by ID"
|
|
89
|
+
with order_id = ... # LLM extracts from user message
|
|
90
|
+
include_in_progress_indicator: True
|
|
91
|
+
progress_indicator_message: "Looking up your order..."
|
|
92
|
+
set @variables.order_id = @outputs.order_id
|
|
93
|
+
set @variables.order_status = @outputs.status
|
|
94
|
+
set @variables.order_total = @outputs.total_amount
|
|
95
|
+
set @variables.order_date = @outputs.order_date
|
|
96
|
+
# Error handling: check if lookup failed
|
|
97
|
+
if @outputs.found == False:
|
|
98
|
+
set @variables.lookup_error = True
|
|
99
|
+
|
|
100
|
+
# Flow action returning a list of strings
|
|
101
|
+
# In Agentforce Assets, set outputs.product_names complex_data_type_name = "lightning__textType"
|
|
102
|
+
get_items: @actions.Get_Order_Line_Items
|
|
103
|
+
description: "Get list of items in the order"
|
|
104
|
+
available when @variables.order_id != ""
|
|
105
|
+
with order_id = @variables.order_id
|
|
106
|
+
|
|
107
|
+
clear_search: @utils.setVariables
|
|
108
|
+
description: "Search for a different order"
|
|
109
|
+
with order_id = ""
|
|
110
|
+
with order_status = ""
|
|
111
|
+
with order_total = ""
|
|
112
|
+
with order_date = ""
|
|
113
|
+
|
|
114
|
+
escalate_now: @utils.escalate
|
|
115
|
+
description: "Transfer to human agent"
|