@salesforce/afv-skills 1.7.3 → 1.7.4
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 +4 -4
- package/skills/developing-agentforce/SKILL.md +37 -37
- package/skills/developing-agentforce/assets/README-legacy.md +8 -8
- package/skills/developing-agentforce/assets/agent-spec-template.md +9 -9
- package/skills/developing-agentforce/assets/agents/README.md +4 -4
- package/skills/developing-agentforce/assets/agents/hello-world.agent +3 -3
- package/skills/developing-agentforce/assets/agents/{multi-topic.agent → multi-subagent.agent} +30 -30
- package/skills/developing-agentforce/assets/agents/order-service.agent +25 -25
- package/skills/developing-agentforce/assets/agents/production-faq.agent +12 -12
- package/skills/developing-agentforce/assets/agents/simple-qa.agent +8 -8
- package/skills/developing-agentforce/assets/agents/verification-gate.agent +19 -19
- package/skills/developing-agentforce/assets/components/apex-action.agent +3 -3
- package/skills/developing-agentforce/assets/components/error-handling.agent +7 -7
- package/skills/developing-agentforce/assets/components/escalation-setup.agent +11 -11
- package/skills/developing-agentforce/assets/components/flow-action.agent +5 -5
- package/skills/developing-agentforce/assets/components/n-ary-conditions.agent +11 -11
- package/skills/developing-agentforce/assets/components/{topic-with-actions.agent → subagent-with-actions.agent} +9 -9
- package/skills/developing-agentforce/assets/deterministic-routing.agent +19 -19
- package/skills/developing-agentforce/assets/escalation-pattern.agent +13 -13
- package/skills/developing-agentforce/assets/flow-action-lookup.agent +3 -3
- package/skills/developing-agentforce/assets/hub-and-spoke.agent +18 -18
- package/skills/developing-agentforce/assets/local-info-agent-annotated.agent +37 -37
- package/skills/developing-agentforce/assets/metadata/genai-function-apex.xml +3 -3
- package/skills/developing-agentforce/assets/metadata/genai-function-flow.xml +1 -1
- package/skills/developing-agentforce/assets/metadata/genai-plugin.xml +10 -10
- package/skills/developing-agentforce/assets/minimal-starter.agent +4 -4
- package/skills/developing-agentforce/assets/patterns/README.md +21 -21
- package/skills/developing-agentforce/assets/patterns/action-callbacks.agent +4 -4
- package/skills/developing-agentforce/assets/patterns/advanced-input-bindings.agent +1 -1
- package/skills/developing-agentforce/assets/patterns/bidirectional-routing.agent +25 -25
- package/skills/developing-agentforce/assets/patterns/critical-input-collection.agent +8 -8
- package/skills/developing-agentforce/assets/patterns/delegation-routing.agent +21 -21
- package/skills/developing-agentforce/assets/patterns/lifecycle-events.agent +8 -8
- package/skills/developing-agentforce/assets/patterns/llm-controlled-actions.agent +5 -5
- package/skills/developing-agentforce/assets/patterns/multi-step-workflow.agent +3 -3
- package/skills/developing-agentforce/assets/patterns/open-gate-routing.agent +59 -58
- package/skills/developing-agentforce/assets/patterns/procedural-instructions.agent +15 -15
- package/skills/developing-agentforce/assets/patterns/prompt-template-action.agent +8 -8
- package/skills/developing-agentforce/assets/patterns/system-instruction-overrides.agent +40 -40
- package/skills/developing-agentforce/assets/prompt-rag-search.agent +9 -9
- package/skills/developing-agentforce/assets/{template-multi-topic.agent → template-multi-subagent.agent} +25 -25
- package/skills/developing-agentforce/assets/{template-single-topic.agent → template-single-subagent.agent} +14 -14
- package/skills/developing-agentforce/assets/verification-gate.agent +16 -16
- package/skills/developing-agentforce/references/action-prompt-templates.md +1 -1
- package/skills/developing-agentforce/references/actions-reference.md +4 -4
- package/skills/developing-agentforce/references/agent-design-and-spec-creation.md +107 -107
- package/skills/developing-agentforce/references/agent-metadata-and-lifecycle.md +5 -5
- package/skills/developing-agentforce/references/agent-script-core-language.md +79 -79
- package/skills/developing-agentforce/references/{agent-topic-map-diagrams.md → agent-subagent-map-diagrams.md} +65 -65
- package/skills/developing-agentforce/references/agent-user-setup.md +2 -2
- package/skills/developing-agentforce/references/agent-validation-and-debugging.md +55 -55
- package/skills/developing-agentforce/references/architecture-patterns.md +33 -33
- package/skills/developing-agentforce/references/deploy-reference.md +1 -1
- package/skills/developing-agentforce/references/discover-reference.md +1 -1
- package/skills/developing-agentforce/references/examples.md +32 -32
- package/skills/developing-agentforce/references/feature-validity.md +3 -3
- package/skills/developing-agentforce/references/instruction-resolution.md +29 -29
- package/skills/developing-agentforce/references/known-issues.md +10 -10
- package/skills/developing-agentforce/references/minimal-examples.md +6 -6
- package/skills/developing-agentforce/references/production-gotchas.md +22 -22
- package/skills/developing-agentforce/references/safety-review-reference.md +2 -2
- package/skills/developing-agentforce/references/scoring-rubric.md +3 -3
- package/skills/observing-agentforce/SKILL.md +8 -8
- package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls +2 -2
- package/skills/observing-agentforce/references/improve-reference.md +40 -40
- package/skills/observing-agentforce/references/issue-classification.md +47 -47
- package/skills/observing-agentforce/references/reproduce-reference.md +7 -7
- package/skills/observing-agentforce/references/stdm-queries.md +7 -7
- package/skills/observing-agentforce/references/stdm-schema.md +2 -2
- package/skills/testing-agentforce/SKILL.md +9 -9
- package/skills/testing-agentforce/assets/basic-test-spec.yaml +4 -0
- package/skills/testing-agentforce/assets/guardrail-test-spec.yaml +4 -0
- package/skills/testing-agentforce/assets/standard-test-spec.yaml +8 -4
- package/skills/testing-agentforce/references/batch-testing.md +17 -17
- package/skills/testing-agentforce/references/preview-testing.md +25 -25
- package/skills/testing-agentforce/references/test-report-format.md +6 -6
|
@@ -29,7 +29,7 @@ variables:
|
|
|
29
29
|
user_question: mutable string
|
|
30
30
|
description: "The user's current question"
|
|
31
31
|
conversation_topic: mutable string
|
|
32
|
-
description: "The current
|
|
32
|
+
description: "The current subject being discussed"
|
|
33
33
|
question_count: mutable number
|
|
34
34
|
description: "Number of questions answered in this session"
|
|
35
35
|
|
|
@@ -38,20 +38,20 @@ language:
|
|
|
38
38
|
additional_locales: ""
|
|
39
39
|
all_additional_locales: False
|
|
40
40
|
|
|
41
|
-
start_agent
|
|
42
|
-
label: "
|
|
41
|
+
start_agent agent_router:
|
|
42
|
+
label: "Subagent Router"
|
|
43
43
|
description: "Routes incoming questions to the FAQ handler"
|
|
44
44
|
|
|
45
45
|
reasoning:
|
|
46
46
|
instructions: ->
|
|
47
47
|
| Listen to the user's question and determine how to help.
|
|
48
|
-
| If the question is about a specific
|
|
48
|
+
| If the question is about a specific subject, note it.
|
|
49
49
|
| Route to the FAQ handler for processing.
|
|
50
50
|
actions:
|
|
51
|
-
handle_faq: @utils.transition to @
|
|
52
|
-
end_conversation: @utils.transition to @
|
|
51
|
+
handle_faq: @utils.transition to @subagent.faq_handler
|
|
52
|
+
end_conversation: @utils.transition to @subagent.farewell
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
subagent faq_handler:
|
|
55
55
|
label: "FAQ Handler"
|
|
56
56
|
description: "Handles frequently asked questions and provides helpful answers"
|
|
57
57
|
|
|
@@ -74,11 +74,11 @@ topic faq_handler:
|
|
|
74
74
|
| - Suggest contacting customer support
|
|
75
75
|
| - Offer to help with something else
|
|
76
76
|
actions:
|
|
77
|
-
new_question: @utils.transition to @
|
|
78
|
-
end_conversation: @utils.transition to @
|
|
79
|
-
escalate: @utils.transition to @
|
|
77
|
+
new_question: @utils.transition to @subagent.agent_router
|
|
78
|
+
end_conversation: @utils.transition to @subagent.farewell
|
|
79
|
+
escalate: @utils.transition to @subagent.escalation
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
subagent farewell:
|
|
82
82
|
label: "Farewell"
|
|
83
83
|
description: "Ends the conversation politely"
|
|
84
84
|
|
|
@@ -88,7 +88,7 @@ topic farewell:
|
|
|
88
88
|
| Wish them a great day.
|
|
89
89
|
| Let them know they can return anytime for more help.
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
subagent escalation:
|
|
92
92
|
label: "Escalation"
|
|
93
93
|
description: "Handles requests to speak with a human agent"
|
|
94
94
|
|
|
@@ -35,8 +35,8 @@ language:
|
|
|
35
35
|
additional_locales: ""
|
|
36
36
|
all_additional_locales: False
|
|
37
37
|
|
|
38
|
-
start_agent
|
|
39
|
-
label: "
|
|
38
|
+
start_agent agent_router:
|
|
39
|
+
label: "Subagent Router"
|
|
40
40
|
description: "Routes incoming requests to the Q&A handler"
|
|
41
41
|
|
|
42
42
|
reasoning:
|
|
@@ -44,10 +44,10 @@ start_agent topic_selector:
|
|
|
44
44
|
| Listen to the user's question.
|
|
45
45
|
| Route to the Q&A handler for processing.
|
|
46
46
|
actions:
|
|
47
|
-
handle_question: @utils.transition to @
|
|
48
|
-
end_conversation: @utils.transition to @
|
|
47
|
+
handle_question: @utils.transition to @subagent.qa_handler
|
|
48
|
+
end_conversation: @utils.transition to @subagent.farewell
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
subagent qa_handler:
|
|
51
51
|
label: "Q&A Handler"
|
|
52
52
|
description: "Handles questions and provides answers"
|
|
53
53
|
|
|
@@ -58,10 +58,10 @@ topic qa_handler:
|
|
|
58
58
|
| Keep responses clear and easy to understand.
|
|
59
59
|
| If you need more information, ask clarifying questions.
|
|
60
60
|
actions:
|
|
61
|
-
new_question: @utils.transition to @
|
|
62
|
-
end_conversation: @utils.transition to @
|
|
61
|
+
new_question: @utils.transition to @subagent.agent_router
|
|
62
|
+
end_conversation: @utils.transition to @subagent.farewell
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
subagent farewell:
|
|
65
65
|
label: "Farewell"
|
|
66
66
|
description: "Ends the conversation gracefully"
|
|
67
67
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Verification Gate Architecture Template
|
|
2
2
|
# ========================================
|
|
3
3
|
#
|
|
4
|
-
# Users must pass identity verification before accessing protected
|
|
4
|
+
# Users must pass identity verification before accessing protected subagents.
|
|
5
5
|
#
|
|
6
6
|
# Pattern: Security gate before protected functionality.
|
|
7
7
|
# Use when: Handling sensitive data, payments, PII access.
|
|
@@ -58,26 +58,26 @@ language:
|
|
|
58
58
|
additional_locales: ""
|
|
59
59
|
all_additional_locales: False
|
|
60
60
|
|
|
61
|
-
start_agent
|
|
61
|
+
start_agent agent_router:
|
|
62
62
|
description: "Route through identity verification"
|
|
63
63
|
reasoning:
|
|
64
64
|
instructions: |
|
|
65
65
|
You are a router only. Do NOT answer questions or provide help directly.
|
|
66
66
|
Route all users to identity verification first.
|
|
67
|
-
If already verified, route to the appropriate
|
|
67
|
+
If already verified, route to the appropriate subagent:
|
|
68
68
|
- Account questions -> use to_account
|
|
69
69
|
- Refund requests -> use to_refund
|
|
70
70
|
actions:
|
|
71
|
-
to_verify: @utils.transition to @
|
|
71
|
+
to_verify: @utils.transition to @subagent.identity_verification
|
|
72
72
|
description: "Begin identity verification"
|
|
73
|
-
to_account: @utils.transition to @
|
|
73
|
+
to_account: @utils.transition to @subagent.account_management
|
|
74
74
|
description: "Access account settings"
|
|
75
75
|
available when @variables.customer_verified == True
|
|
76
|
-
to_refund: @utils.transition to @
|
|
76
|
+
to_refund: @utils.transition to @subagent.refund_processor
|
|
77
77
|
description: "Process a refund request"
|
|
78
78
|
available when @variables.customer_verified == True
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
subagent identity_verification:
|
|
81
81
|
label: "Identity Verification"
|
|
82
82
|
description: "Verify customer identity before proceeding"
|
|
83
83
|
|
|
@@ -96,7 +96,7 @@ topic identity_verification:
|
|
|
96
96
|
instructions: ->
|
|
97
97
|
if @variables.failed_attempts >= 3:
|
|
98
98
|
| Too many failed attempts. Transferring to a human agent.
|
|
99
|
-
transition to @
|
|
99
|
+
transition to @subagent.escalation
|
|
100
100
|
|
|
101
101
|
if @variables.customer_verified == True:
|
|
102
102
|
| Identity verified! How can I help you today?
|
|
@@ -110,18 +110,18 @@ topic identity_verification:
|
|
|
110
110
|
with email = ...
|
|
111
111
|
set @variables.customer_verified = @outputs.verified
|
|
112
112
|
|
|
113
|
-
go_to_account: @utils.transition to @
|
|
113
|
+
go_to_account: @utils.transition to @subagent.account_management
|
|
114
114
|
description: "Access account settings"
|
|
115
115
|
available when @variables.customer_verified == True
|
|
116
116
|
|
|
117
|
-
go_to_refund: @utils.transition to @
|
|
117
|
+
go_to_refund: @utils.transition to @subagent.refund_processor
|
|
118
118
|
description: "Process a refund request"
|
|
119
119
|
available when @variables.customer_verified == True
|
|
120
120
|
|
|
121
121
|
escalate_now: @utils.escalate
|
|
122
122
|
description: "Transfer to human agent"
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
subagent account_management:
|
|
125
125
|
label: "Account Management"
|
|
126
126
|
description: "Manage customer account settings (requires verification)"
|
|
127
127
|
|
|
@@ -151,7 +151,7 @@ topic account_management:
|
|
|
151
151
|
reasoning:
|
|
152
152
|
instructions: ->
|
|
153
153
|
if @variables.customer_verified == False:
|
|
154
|
-
transition to @
|
|
154
|
+
transition to @subagent.identity_verification
|
|
155
155
|
|
|
156
156
|
| Welcome to account management.
|
|
157
157
|
| What would you like to do with your account?
|
|
@@ -169,10 +169,10 @@ topic account_management:
|
|
|
169
169
|
with pref_value = ...
|
|
170
170
|
available when @variables.customer_verified == True
|
|
171
171
|
|
|
172
|
-
back: @utils.transition to @
|
|
172
|
+
back: @utils.transition to @subagent.agent_router
|
|
173
173
|
description: "Return to main menu"
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
subagent refund_processor:
|
|
176
176
|
label: "Refund Processor"
|
|
177
177
|
description: "Process refund requests (requires verification)"
|
|
178
178
|
|
|
@@ -225,13 +225,13 @@ topic refund_processor:
|
|
|
225
225
|
reasoning:
|
|
226
226
|
instructions: ->
|
|
227
227
|
if @variables.customer_verified == False:
|
|
228
|
-
transition to @
|
|
228
|
+
transition to @subagent.identity_verification
|
|
229
229
|
|
|
230
230
|
if @variables.refund_status == "Approved":
|
|
231
231
|
run @actions.create_crm_case
|
|
232
232
|
with customer_id = @variables.ContactId
|
|
233
233
|
with refund_amount = @variables.refund_amount
|
|
234
|
-
transition to @
|
|
234
|
+
transition to @subagent.success_confirmation
|
|
235
235
|
|
|
236
236
|
run @actions.check_churn_risk
|
|
237
237
|
with customer_id = @variables.ContactId
|
|
@@ -257,7 +257,7 @@ topic refund_processor:
|
|
|
257
257
|
with amount = 10
|
|
258
258
|
set @variables.refund_status = @outputs.status
|
|
259
259
|
|
|
260
|
-
|
|
260
|
+
subagent success_confirmation:
|
|
261
261
|
label: "Success Confirmation"
|
|
262
262
|
description: "Confirm successful operation"
|
|
263
263
|
reasoning:
|
|
@@ -265,10 +265,10 @@ topic success_confirmation:
|
|
|
265
265
|
Great news! Your request has been processed successfully.
|
|
266
266
|
Is there anything else I can help you with?
|
|
267
267
|
actions:
|
|
268
|
-
new_request: @utils.transition to @
|
|
268
|
+
new_request: @utils.transition to @subagent.agent_router
|
|
269
269
|
description: "Start a new request"
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
subagent escalation:
|
|
272
272
|
label: "Escalation"
|
|
273
273
|
description: "Escalate to human agent"
|
|
274
274
|
reasoning:
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# Apex-Based Action Template
|
|
2
2
|
# Define an action that calls a Salesforce Apex @InvocableMethod
|
|
3
|
-
# This is a PARTIAL template - define actions inside a
|
|
3
|
+
# This is a PARTIAL template - define actions inside a subagent block
|
|
4
4
|
#
|
|
5
5
|
# Usage: Replace {{placeholders}} with your values
|
|
6
|
-
# Place this inside a
|
|
6
|
+
# Place this inside a subagent's actions: block
|
|
7
7
|
#
|
|
8
8
|
# ⚠️ The target format is apex://ClassName (NOT ClassName.MethodName)
|
|
9
9
|
# The runtime auto-discovers the @InvocableMethod on the class.
|
|
10
10
|
# ⚠️ NO GenAiFunction metadata needed for AiAuthoringBundle (Agent Script).
|
|
11
11
|
|
|
12
|
-
# Action Definition (place inside
|
|
12
|
+
# Action Definition (place inside subagent's actions: block)
|
|
13
13
|
{{action_name}}:
|
|
14
14
|
description: "{{ActionDescription}}"
|
|
15
15
|
inputs:
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Error Handling
|
|
2
|
-
# A
|
|
1
|
+
# Error Handling Subagent Template
|
|
2
|
+
# A subagent with validation and guard clauses for critical operations
|
|
3
3
|
# This is a PARTIAL template - use within a complete agent file
|
|
4
4
|
#
|
|
5
5
|
# Usage: Replace {{placeholders}} with your values
|
|
6
6
|
# Note: Includes validation patterns and error handling
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
label: "{{
|
|
10
|
-
description: "{{
|
|
8
|
+
subagent {{subagent_name}}:
|
|
9
|
+
label: "{{SubagentLabel}}"
|
|
10
|
+
description: "{{SubagentDescription}} - includes validation and error handling"
|
|
11
11
|
|
|
12
12
|
actions:
|
|
13
13
|
{{action_name}}:
|
|
@@ -52,7 +52,7 @@ topic {{topic_name}}:
|
|
|
52
52
|
available when @variables.validation_passed == True
|
|
53
53
|
|
|
54
54
|
# Handle errors
|
|
55
|
-
retry_operation: @utils.transition to @
|
|
55
|
+
retry_operation: @utils.transition to @subagent.{{subagent_name}}
|
|
56
56
|
available when @variables.operation_success == False
|
|
57
57
|
|
|
58
|
-
back_to_menu: @utils.transition to @
|
|
58
|
+
back_to_menu: @utils.transition to @subagent.agent_router
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
# ★ Key Components:
|
|
10
10
|
# 1. connection messaging: block - defines routing destination
|
|
11
11
|
# 2. @utils.escalate action - triggers the transfer
|
|
12
|
-
# 3. escalation
|
|
12
|
+
# 3. escalation subagent - handles the handoff flow
|
|
13
13
|
#
|
|
14
14
|
# ★ Prerequisites:
|
|
15
15
|
# - Omni-Channel configured in Salesforce
|
|
@@ -46,7 +46,7 @@ variables:
|
|
|
46
46
|
escalation_requested: mutable boolean = False
|
|
47
47
|
description: "Whether customer requested human agent"
|
|
48
48
|
escalation_reason: mutable string
|
|
49
|
-
description: "Reason for escalation"
|
|
49
|
+
description: "Reason for escalation subagent"
|
|
50
50
|
# ⚠️ Use 'number' not 'integer' - integer type is NOT supported in AiAuthoringBundle
|
|
51
51
|
attempts_before_escalation: mutable number = 0
|
|
52
52
|
description: "Number of attempts before escalating"
|
|
@@ -83,9 +83,9 @@ connection messaging:
|
|
|
83
83
|
# adaptive_response_allowed: False
|
|
84
84
|
|
|
85
85
|
# Entry point
|
|
86
|
-
start_agent
|
|
87
|
-
label: "
|
|
88
|
-
description: "Routes users to appropriate
|
|
86
|
+
start_agent agent_router:
|
|
87
|
+
label: "Subagent Router"
|
|
88
|
+
description: "Routes users to appropriate subagents based on intent"
|
|
89
89
|
|
|
90
90
|
reasoning:
|
|
91
91
|
instructions: ->
|
|
@@ -93,11 +93,11 @@ start_agent topic_selector:
|
|
|
93
93
|
| If they ask for a human or live agent, route to escalation.
|
|
94
94
|
| Otherwise, try to help them directly.
|
|
95
95
|
actions:
|
|
96
|
-
go_help: @utils.transition to @
|
|
97
|
-
go_escalation: @utils.transition to @
|
|
96
|
+
go_help: @utils.transition to @subagent.help
|
|
97
|
+
go_escalation: @utils.transition to @subagent.escalation
|
|
98
98
|
available when @variables.escalation_requested == True
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
subagent help:
|
|
101
101
|
label: "Help"
|
|
102
102
|
description: "Provides assistance to customers"
|
|
103
103
|
|
|
@@ -117,11 +117,11 @@ topic help:
|
|
|
117
117
|
| Track escalation reason if provided:
|
|
118
118
|
set @variables.escalation_reason = ...
|
|
119
119
|
actions:
|
|
120
|
-
offer_escalation: @utils.transition to @
|
|
120
|
+
offer_escalation: @utils.transition to @subagent.escalation
|
|
121
121
|
|
|
122
|
-
immediate_escalation: @utils.transition to @
|
|
122
|
+
immediate_escalation: @utils.transition to @subagent.escalation
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
subagent escalation:
|
|
125
125
|
label: "Escalation"
|
|
126
126
|
description: "Transfers conversation to human agent"
|
|
127
127
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
# Flow-Based Action Template
|
|
2
2
|
# Define an action that calls a Salesforce Flow
|
|
3
|
-
# This is a PARTIAL template - define actions inside a
|
|
3
|
+
# This is a PARTIAL template - define actions inside a subagent block
|
|
4
4
|
#
|
|
5
5
|
# ⚠️ NOTE ON DEPLOYMENT METHODS:
|
|
6
6
|
# - AiAuthoringBundle: `with`/`set` clauses ARE supported (TDD validated v1.7.0+)
|
|
7
7
|
# - GenAiPlannerBundle: Full syntax including `with`/`set` also supported
|
|
8
8
|
#
|
|
9
9
|
# Both deployment methods support the Two-Level Action System:
|
|
10
|
-
# Level 1: Action definition in
|
|
10
|
+
# Level 1: Action definition in subagent `actions:` block (with target/inputs/outputs)
|
|
11
11
|
# Level 2: Action invocation in `reasoning.actions:` block (with `with`/`set` clauses)
|
|
12
12
|
#
|
|
13
13
|
# Usage: Replace {{placeholders}} with your values
|
|
14
|
-
# Place this inside a
|
|
14
|
+
# Place this inside a subagent's actions: block
|
|
15
15
|
|
|
16
|
-
# Action Definition (place inside
|
|
16
|
+
# Action Definition (place inside subagent's actions: block)
|
|
17
17
|
{{action_name}}:
|
|
18
18
|
description: "{{ActionDescription}}"
|
|
19
19
|
inputs:
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
# | Help the user with their request.
|
|
55
55
|
# | Use the available actions when needed.
|
|
56
56
|
# actions:
|
|
57
|
-
# back_to_menu: @utils.transition to @
|
|
57
|
+
# back_to_menu: @utils.transition to @subagent.agent_router
|
|
58
58
|
|
|
59
59
|
# Common Flow Target Patterns:
|
|
60
60
|
# - flow://Get_Account_Details
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
# ═══════════════════════════════════════════════════════════════
|
|
24
24
|
|
|
25
25
|
# Example: Require multiple authentication checks
|
|
26
|
-
|
|
26
|
+
subagent secure_action:
|
|
27
27
|
label: "Secure Action"
|
|
28
28
|
description: "Performs security-sensitive operations"
|
|
29
29
|
|
|
30
30
|
before_reasoning:
|
|
31
31
|
# All three conditions must be true
|
|
32
32
|
if @variables.is_authenticated and @variables.has_permission and @variables.session_valid:
|
|
33
|
-
transition to @
|
|
34
|
-
# Otherwise stay in this
|
|
33
|
+
transition to @subagent.authorized_action
|
|
34
|
+
# Otherwise stay in this subagent
|
|
35
35
|
|
|
36
36
|
reasoning:
|
|
37
37
|
instructions: ->
|
|
@@ -42,22 +42,22 @@ topic secure_action:
|
|
|
42
42
|
# ═══════════════════════════════════════════════════════════════
|
|
43
43
|
|
|
44
44
|
# Example: Any elevated role gets access
|
|
45
|
-
|
|
45
|
+
subagent admin_panel:
|
|
46
46
|
label: "Admin Panel"
|
|
47
47
|
description: "Administrative features"
|
|
48
48
|
|
|
49
49
|
before_reasoning:
|
|
50
50
|
# Any one of these roles grants access
|
|
51
51
|
if @variables.is_admin or @variables.is_moderator or @variables.is_superuser:
|
|
52
|
-
transition to @
|
|
52
|
+
transition to @subagent.admin_features
|
|
53
53
|
# Non-admins redirected
|
|
54
|
-
transition to @
|
|
54
|
+
transition to @subagent.access_denied
|
|
55
55
|
|
|
56
56
|
# ═══════════════════════════════════════════════════════════════
|
|
57
57
|
# PATTERN 3: N-ary conditions in available when
|
|
58
58
|
# ═══════════════════════════════════════════════════════════════
|
|
59
59
|
|
|
60
|
-
|
|
60
|
+
subagent order_management:
|
|
61
61
|
label: "Order Management"
|
|
62
62
|
description: "Handles order operations"
|
|
63
63
|
|
|
@@ -84,14 +84,14 @@ topic order_management:
|
|
|
84
84
|
# PATTERN 4: Complex grouped conditions
|
|
85
85
|
# ═══════════════════════════════════════════════════════════════
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
subagent smart_routing:
|
|
88
88
|
label: "Smart Routing"
|
|
89
89
|
description: "Routes based on complex criteria"
|
|
90
90
|
|
|
91
91
|
before_reasoning:
|
|
92
92
|
# Premium with any product type OR standard with warranty
|
|
93
93
|
if (@variables.tier == "premium" and @variables.product_type != None) or (@variables.tier == "standard" and @variables.has_warranty == True):
|
|
94
|
-
transition to @
|
|
94
|
+
transition to @subagent.priority_support
|
|
95
95
|
|
|
96
96
|
# ═══════════════════════════════════════════════════════════════
|
|
97
97
|
# ANTI-PATTERNS - DO NOT USE
|
|
@@ -102,9 +102,9 @@ topic smart_routing:
|
|
|
102
102
|
# if @variables.a == True:
|
|
103
103
|
# if @variables.b == True:
|
|
104
104
|
# if @variables.c == True:
|
|
105
|
-
# transition to @
|
|
105
|
+
# transition to @subagent.x
|
|
106
106
|
|
|
107
107
|
# ✅ CORRECT - Flat N-ary condition
|
|
108
108
|
# before_reasoning:
|
|
109
109
|
# if @variables.a == True and @variables.b == True and @variables.c == True:
|
|
110
|
-
# transition to @
|
|
110
|
+
# transition to @subagent.x
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
#
|
|
2
|
-
# A
|
|
1
|
+
# Subagent with Actions Template
|
|
2
|
+
# A subagent that integrates with external systems via Flow or Apex actions
|
|
3
3
|
# This is a PARTIAL template - use within a complete agent file
|
|
4
4
|
#
|
|
5
5
|
# Two-Level Action System:
|
|
6
|
-
# Level 1:
|
|
6
|
+
# Level 1: subagent.actions block DEFINES actions (with target:, inputs:, outputs:)
|
|
7
7
|
# Level 2: reasoning.actions block INVOKES them (with @actions.name, with/set)
|
|
8
8
|
#
|
|
9
9
|
# Usage: Replace {{placeholders}} with your values
|
|
10
|
-
# Note: Actions defined inside
|
|
10
|
+
# Note: Actions defined inside subagent are local to that subagent
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
description: "{{
|
|
12
|
+
subagent {{subagent_name}}:
|
|
13
|
+
description: "{{SubagentDescription}}"
|
|
14
14
|
|
|
15
|
-
# Level 1: DEFINE actions available to this
|
|
15
|
+
# Level 1: DEFINE actions available to this subagent
|
|
16
16
|
actions:
|
|
17
17
|
{{action_name}}:
|
|
18
18
|
description: "{{ActionDescription}}"
|
|
@@ -26,7 +26,7 @@ topic {{topic_name}}:
|
|
|
26
26
|
|
|
27
27
|
reasoning:
|
|
28
28
|
instructions: ->
|
|
29
|
-
| {{
|
|
29
|
+
| {{SubagentInstructions}}
|
|
30
30
|
| Use the available actions to help the user.
|
|
31
31
|
| Capture and communicate results clearly.
|
|
32
32
|
|
|
@@ -36,5 +36,5 @@ topic {{topic_name}}:
|
|
|
36
36
|
with {{input_name}}=...
|
|
37
37
|
set @variables.{{result_variable}} = @outputs.{{output_name}}
|
|
38
38
|
|
|
39
|
-
back_to_menu: @utils.transition to @
|
|
39
|
+
back_to_menu: @utils.transition to @subagent.agent_router
|
|
40
40
|
description: "Return to main menu"
|
|
@@ -40,7 +40,7 @@ variables:
|
|
|
40
40
|
low_confidence_warning: mutable boolean = False
|
|
41
41
|
description: "Flag for low confidence routing"
|
|
42
42
|
|
|
43
|
-
start_agent
|
|
43
|
+
start_agent agent_router:
|
|
44
44
|
description: "Classify intent and route deterministically"
|
|
45
45
|
reasoning:
|
|
46
46
|
instructions: ->
|
|
@@ -54,13 +54,13 @@ start_agent topic_selector:
|
|
|
54
54
|
# HIGH-CONFIDENCE ROUTING
|
|
55
55
|
if @variables.confidence_score >= 80:
|
|
56
56
|
if @variables.classified_intent == "billing":
|
|
57
|
-
transition to @
|
|
57
|
+
transition to @subagent.billing
|
|
58
58
|
if @variables.classified_intent == "technical_support":
|
|
59
|
-
transition to @
|
|
59
|
+
transition to @subagent.technical_support
|
|
60
60
|
if @variables.classified_intent == "sales":
|
|
61
|
-
transition to @
|
|
61
|
+
transition to @subagent.sales
|
|
62
62
|
if @variables.classified_intent == "returns":
|
|
63
|
-
transition to @
|
|
63
|
+
transition to @subagent.returns
|
|
64
64
|
|
|
65
65
|
# LOW-CONFIDENCE: Confirm with user
|
|
66
66
|
if @variables.confidence_score < 80:
|
|
@@ -69,7 +69,7 @@ start_agent topic_selector:
|
|
|
69
69
|
| It sounds like you need help with **{!@variables.classified_intent}**.
|
|
70
70
|
| Is that correct?
|
|
71
71
|
|
|
72
|
-
# INITIAL STATE: Ask for help
|
|
72
|
+
# INITIAL STATE: Ask for help subject
|
|
73
73
|
if @variables.needs_classification == True:
|
|
74
74
|
| I can help with billing, technical support, sales, or returns.
|
|
75
75
|
| What do you need help with today?
|
|
@@ -88,19 +88,19 @@ start_agent topic_selector:
|
|
|
88
88
|
set @variables.needs_classification = False
|
|
89
89
|
|
|
90
90
|
# Manual routing for low-confidence cases
|
|
91
|
-
go_billing: @utils.transition to @
|
|
91
|
+
go_billing: @utils.transition to @subagent.billing
|
|
92
92
|
description: "Yes, I need billing help"
|
|
93
93
|
available when @variables.low_confidence_warning == True and @variables.classified_intent == "billing"
|
|
94
94
|
|
|
95
|
-
go_support: @utils.transition to @
|
|
95
|
+
go_support: @utils.transition to @subagent.technical_support
|
|
96
96
|
description: "Yes, I need technical support"
|
|
97
97
|
available when @variables.low_confidence_warning == True and @variables.classified_intent == "technical_support"
|
|
98
98
|
|
|
99
|
-
go_sales: @utils.transition to @
|
|
99
|
+
go_sales: @utils.transition to @subagent.sales
|
|
100
100
|
description: "Yes, I need sales help"
|
|
101
101
|
available when @variables.low_confidence_warning == True and @variables.classified_intent == "sales"
|
|
102
102
|
|
|
103
|
-
go_returns: @utils.transition to @
|
|
103
|
+
go_returns: @utils.transition to @subagent.returns
|
|
104
104
|
description: "Yes, I need returns help"
|
|
105
105
|
available when @variables.low_confidence_warning == True and @variables.classified_intent == "returns"
|
|
106
106
|
|
|
@@ -114,53 +114,53 @@ start_agent topic_selector:
|
|
|
114
114
|
with low_confidence_warning = False
|
|
115
115
|
|
|
116
116
|
# ============================================================
|
|
117
|
-
# ROUTED
|
|
117
|
+
# ROUTED SUBAGENTS
|
|
118
118
|
# ============================================================
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
subagent billing:
|
|
121
121
|
description: "Handle billing inquiries"
|
|
122
122
|
reasoning:
|
|
123
123
|
instructions: |
|
|
124
124
|
Help the customer with their billing question.
|
|
125
125
|
You can view invoices, explain charges, or process payments.
|
|
126
126
|
actions:
|
|
127
|
-
back: @utils.transition to @
|
|
127
|
+
back: @utils.transition to @subagent.agent_router
|
|
128
128
|
description: "Return to main menu"
|
|
129
129
|
escalate_now: @utils.escalate
|
|
130
130
|
description: "Transfer to billing specialist"
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
subagent technical_support:
|
|
133
133
|
description: "Handle technical support issues"
|
|
134
134
|
reasoning:
|
|
135
135
|
instructions: |
|
|
136
136
|
Help the customer with their technical issue.
|
|
137
137
|
Troubleshoot problems and provide solutions.
|
|
138
138
|
actions:
|
|
139
|
-
back: @utils.transition to @
|
|
139
|
+
back: @utils.transition to @subagent.agent_router
|
|
140
140
|
description: "Return to main menu"
|
|
141
141
|
escalate_now: @utils.escalate
|
|
142
142
|
description: "Transfer to technical specialist"
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
subagent sales:
|
|
145
145
|
description: "Handle sales inquiries"
|
|
146
146
|
reasoning:
|
|
147
147
|
instructions: |
|
|
148
148
|
Help the customer with sales questions.
|
|
149
149
|
Provide product information and pricing.
|
|
150
150
|
actions:
|
|
151
|
-
back: @utils.transition to @
|
|
151
|
+
back: @utils.transition to @subagent.agent_router
|
|
152
152
|
description: "Return to main menu"
|
|
153
153
|
escalate_now: @utils.escalate
|
|
154
154
|
description: "Transfer to sales representative"
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
subagent returns:
|
|
157
157
|
description: "Handle return requests"
|
|
158
158
|
reasoning:
|
|
159
159
|
instructions: |
|
|
160
160
|
Help the customer with their return request.
|
|
161
161
|
Check eligibility and process returns.
|
|
162
162
|
actions:
|
|
163
|
-
back: @utils.transition to @
|
|
163
|
+
back: @utils.transition to @subagent.agent_router
|
|
164
164
|
description: "Return to main menu"
|
|
165
165
|
escalate_now: @utils.escalate
|
|
166
166
|
description: "Transfer to returns specialist"
|