@salesforce/afv-skills 1.7.2 → 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/generating-custom-lightning-type/SKILL.md +12 -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
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# Bidirectional Routing Pattern
|
|
2
|
-
# Navigate to a specialist
|
|
2
|
+
# Navigate to a specialist subagent and return with results
|
|
3
3
|
#
|
|
4
4
|
# ★ When To Use This Pattern:
|
|
5
|
-
# - Main
|
|
5
|
+
# - Main subagent needs specialized processing then returns
|
|
6
6
|
# - "Consult a specialist" pattern (like asking an expert)
|
|
7
7
|
# - Complex workflows where you leave, do work, then come back
|
|
8
|
-
# - Alternative to cramming everything into one
|
|
8
|
+
# - Alternative to cramming everything into one subagent
|
|
9
9
|
#
|
|
10
10
|
# ★ Key Insight:
|
|
11
11
|
# Standard transitions (@utils.transition) are one-way.
|
|
12
12
|
# For round-trip routing, store the "return address" in a variable.
|
|
13
|
-
# The specialist
|
|
13
|
+
# The specialist subagent transitions back when done.
|
|
14
14
|
#
|
|
15
15
|
# ★ Architecture Decision:
|
|
16
16
|
# Use this when you want separation of concerns:
|
|
17
|
-
# - Main
|
|
18
|
-
# - Specialist
|
|
17
|
+
# - Main subagent: Orchestration and user interaction
|
|
18
|
+
# - Specialist subagent: Focused, complex processing
|
|
19
19
|
#
|
|
20
20
|
# This is a PARTIAL template - integrate into a complete agent file
|
|
21
21
|
|
|
22
22
|
variables:
|
|
23
23
|
# ... standard linked variables ...
|
|
24
|
-
|
|
25
|
-
description: "
|
|
24
|
+
return_subagent: mutable string = ""
|
|
25
|
+
description: "Subagent to return to after specialist consultation"
|
|
26
26
|
specialist_result: mutable string = ""
|
|
27
|
-
description: "Result from specialist
|
|
27
|
+
description: "Result from specialist subagent"
|
|
28
28
|
consultation_status: mutable string = ""
|
|
29
29
|
description: "Status of specialist consultation"
|
|
30
30
|
|
|
31
|
-
# Main orchestration
|
|
31
|
+
# Main orchestration subagent
|
|
32
32
|
start_agent main_hub:
|
|
33
33
|
label: "Main Hub"
|
|
34
34
|
description: "Central hub that routes to specialists and handles results"
|
|
@@ -46,17 +46,17 @@ start_agent main_hub:
|
|
|
46
46
|
| Consultation status: {!@variables.consultation_status}
|
|
47
47
|
actions:
|
|
48
48
|
# Route to pricing specialist (store return address first)
|
|
49
|
-
consult_pricing: @utils.transition to @
|
|
49
|
+
consult_pricing: @utils.transition to @subagent.pricing_specialist
|
|
50
50
|
available when @variables.consultation_status != "in_progress"
|
|
51
51
|
|
|
52
52
|
# Route to technical specialist
|
|
53
|
-
consult_technical: @utils.transition to @
|
|
53
|
+
consult_technical: @utils.transition to @subagent.technical_specialist
|
|
54
54
|
available when @variables.consultation_status != "in_progress"
|
|
55
55
|
|
|
56
|
-
end_conversation: @utils.transition to @
|
|
56
|
+
end_conversation: @utils.transition to @subagent.farewell
|
|
57
57
|
|
|
58
|
-
# Pricing specialist
|
|
59
|
-
|
|
58
|
+
# Pricing specialist subagent
|
|
59
|
+
subagent pricing_specialist:
|
|
60
60
|
label: "Pricing Specialist"
|
|
61
61
|
description: "Handles complex pricing calculations and returns results"
|
|
62
62
|
|
|
@@ -78,7 +78,7 @@ topic pricing_specialist:
|
|
|
78
78
|
# Mark consultation as in progress when entering
|
|
79
79
|
before_reasoning:
|
|
80
80
|
set @variables.consultation_status = "in_progress"
|
|
81
|
-
set @variables.
|
|
81
|
+
set @variables.return_subagent = "main_hub"
|
|
82
82
|
|
|
83
83
|
reasoning:
|
|
84
84
|
instructions: ->
|
|
@@ -93,14 +93,14 @@ topic pricing_specialist:
|
|
|
93
93
|
set @variables.specialist_result = @outputs.final_price
|
|
94
94
|
|
|
95
95
|
# Return to main hub with results
|
|
96
|
-
return_with_results: @utils.transition to @
|
|
96
|
+
return_with_results: @utils.transition to @subagent.main_hub
|
|
97
97
|
|
|
98
98
|
# Mark consultation complete when leaving
|
|
99
99
|
after_reasoning:
|
|
100
100
|
set @variables.consultation_status = "completed"
|
|
101
101
|
|
|
102
|
-
# Technical specialist
|
|
103
|
-
|
|
102
|
+
# Technical specialist subagent
|
|
103
|
+
subagent technical_specialist:
|
|
104
104
|
label: "Technical Specialist"
|
|
105
105
|
description: "Handles technical troubleshooting and returns results"
|
|
106
106
|
|
|
@@ -119,7 +119,7 @@ topic technical_specialist:
|
|
|
119
119
|
|
|
120
120
|
before_reasoning:
|
|
121
121
|
set @variables.consultation_status = "in_progress"
|
|
122
|
-
set @variables.
|
|
122
|
+
set @variables.return_subagent = "main_hub"
|
|
123
123
|
|
|
124
124
|
reasoning:
|
|
125
125
|
instructions: ->
|
|
@@ -132,12 +132,12 @@ topic technical_specialist:
|
|
|
132
132
|
with symptoms=...
|
|
133
133
|
set @variables.specialist_result = @outputs.diagnosis
|
|
134
134
|
|
|
135
|
-
return_with_results: @utils.transition to @
|
|
135
|
+
return_with_results: @utils.transition to @subagent.main_hub
|
|
136
136
|
|
|
137
137
|
after_reasoning:
|
|
138
138
|
set @variables.consultation_status = "completed"
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
subagent farewell:
|
|
141
141
|
label: "Farewell"
|
|
142
142
|
description: "Ends the conversation"
|
|
143
143
|
|
|
@@ -148,9 +148,9 @@ topic farewell:
|
|
|
148
148
|
# ★ Alternative: Simple one-way transitions (when you don't need to return)
|
|
149
149
|
#
|
|
150
150
|
# If the specialist doesn't need to return results to a coordinator,
|
|
151
|
-
# use simple transitions without the
|
|
151
|
+
# use simple transitions without the return_subagent pattern:
|
|
152
152
|
#
|
|
153
|
-
# go_orders: @utils.transition to @
|
|
154
|
-
# go_billing: @utils.transition to @
|
|
153
|
+
# go_orders: @utils.transition to @subagent.orders
|
|
154
|
+
# go_billing: @utils.transition to @subagent.billing
|
|
155
155
|
#
|
|
156
156
|
# The bidirectional pattern adds complexity - only use when needed.
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
# - Workflows that REQUIRE a specific ID (account, order, case, etc.)
|
|
24
24
|
# - When slot filling has been unreliable
|
|
25
25
|
# - When invalid input causes downstream failures
|
|
26
|
-
# - Multi-
|
|
26
|
+
# - Multi-subagent agents where input must persist across transitions
|
|
27
27
|
#
|
|
28
28
|
# This is a COMPLETE template - customize for your use case
|
|
29
29
|
|
|
@@ -74,8 +74,8 @@ language:
|
|
|
74
74
|
additional_locales: ""
|
|
75
75
|
all_additional_locales: False
|
|
76
76
|
|
|
77
|
-
# ★ ENTRY POINT: Input Collection
|
|
78
|
-
# This
|
|
77
|
+
# ★ ENTRY POINT: Input Collection Subagent
|
|
78
|
+
# This subagent's ONLY job is to collect and validate the critical input
|
|
79
79
|
start_agent input_collector:
|
|
80
80
|
label: "Input Collector"
|
|
81
81
|
description: "Collects and validates the account ID before allowing research"
|
|
@@ -127,7 +127,7 @@ start_agent input_collector:
|
|
|
127
127
|
| ✅ Account ID validated: {!@variables.account_id}
|
|
128
128
|
| Account Name: {!@variables.account_name}
|
|
129
129
|
|
|
|
130
|
-
| Transition to research
|
|
130
|
+
| Transition to research subagent to begin analysis.
|
|
131
131
|
|
|
132
132
|
if @variables.collection_attempts > 2 and @variables.account_id_validated == False:
|
|
133
133
|
| ❌ Multiple validation failures.
|
|
@@ -148,11 +148,11 @@ start_agent input_collector:
|
|
|
148
148
|
|
|
149
149
|
# ★ PATTERN 4: Null Guard Pattern
|
|
150
150
|
# Transition ONLY available when input is validated
|
|
151
|
-
go_research: @utils.transition to @
|
|
151
|
+
go_research: @utils.transition to @subagent.research
|
|
152
152
|
available when @variables.account_id_validated == True
|
|
153
153
|
|
|
154
|
-
# ★ RESEARCH
|
|
155
|
-
|
|
154
|
+
# ★ RESEARCH SUBAGENT: Only accessible after input is validated
|
|
155
|
+
subagent research:
|
|
156
156
|
label: "Account Research"
|
|
157
157
|
description: "Performs research on the validated account"
|
|
158
158
|
|
|
@@ -194,7 +194,7 @@ topic research:
|
|
|
194
194
|
available when @variables.research_summary == ""
|
|
195
195
|
|
|
196
196
|
# Return to collector for new account
|
|
197
|
-
new_account: @utils.transition to @
|
|
197
|
+
new_account: @utils.transition to @subagent.input_collector
|
|
198
198
|
available when @variables.research_summary != ""
|
|
199
199
|
|
|
200
200
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Subagent Delegation vs Transition Pattern
|
|
2
2
|
# Understanding the difference between delegation and permanent handoffs
|
|
3
3
|
#
|
|
4
4
|
# ★ KEY CONCEPTS:
|
|
5
5
|
#
|
|
6
|
-
# DELEGATION (@
|
|
7
|
-
# - Syntax: action_name: @
|
|
8
|
-
# - Control CAN return to the calling
|
|
6
|
+
# DELEGATION (@subagent.* syntax):
|
|
7
|
+
# - Syntax: action_name: @subagent.subagent_name
|
|
8
|
+
# - Control CAN return to the calling subagent
|
|
9
9
|
# - Use for: consulting specialists, sub-tasks, getting help
|
|
10
10
|
#
|
|
11
11
|
# TRANSITION (@utils.transition syntax):
|
|
12
|
-
# - Syntax: action_name: @utils.transition to @
|
|
12
|
+
# - Syntax: action_name: @utils.transition to @subagent.subagent_name
|
|
13
13
|
# - PERMANENT handoff - control does NOT return
|
|
14
14
|
# - Use for: menu navigation, workflow stages, permanent routing
|
|
15
15
|
#
|
|
16
16
|
# ★ When To Use Each:
|
|
17
17
|
# DELEGATION: "Consult an expert then continue here"
|
|
18
|
-
# TRANSITION: "Go to this
|
|
18
|
+
# TRANSITION: "Go to this subagent and stay there"
|
|
19
19
|
#
|
|
20
20
|
# ★ Implementation Note:
|
|
21
21
|
# If delegation syntax doesn't work in your deployment method,
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
# This is a PARTIAL template - integrate into a complete agent file
|
|
26
26
|
|
|
27
27
|
# ═══════════════════════════════════════════════════════════════
|
|
28
|
-
# PATTERN 1:
|
|
28
|
+
# PATTERN 1: Subagent Delegation (can return)
|
|
29
29
|
# ═══════════════════════════════════════════════════════════════
|
|
30
30
|
|
|
31
31
|
# Delegation syntax in reasoning.actions:
|
|
32
32
|
#
|
|
33
33
|
# reasoning:
|
|
34
34
|
# actions:
|
|
35
|
-
# # Delegation - specialist CAN return control to this
|
|
36
|
-
# consult_expert: @
|
|
35
|
+
# # Delegation - specialist CAN return control to this subagent
|
|
36
|
+
# consult_expert: @subagent.specialist_subagent
|
|
37
37
|
# description: "Consult specialist for complex questions"
|
|
38
38
|
# available when @variables.needs_expert_help == True
|
|
39
39
|
#
|
|
40
|
-
# The specialist
|
|
41
|
-
# to the original
|
|
40
|
+
# The specialist subagent processes the request and control returns
|
|
41
|
+
# to the original subagent when done.
|
|
42
42
|
|
|
43
43
|
# ═══════════════════════════════════════════════════════════════
|
|
44
44
|
# PATTERN 2: Transition (permanent handoff)
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
#
|
|
49
49
|
# reasoning:
|
|
50
50
|
# actions:
|
|
51
|
-
# # Transition - permanent move to orders
|
|
52
|
-
# go_orders: @utils.transition to @
|
|
51
|
+
# # Transition - permanent move to orders subagent
|
|
52
|
+
# go_orders: @utils.transition to @subagent.orders
|
|
53
53
|
#
|
|
54
|
-
# Control moves to orders
|
|
55
|
-
# User continues in that
|
|
54
|
+
# Control moves to orders subagent and STAYS there.
|
|
55
|
+
# User continues in that subagent until another transition occurs.
|
|
56
56
|
|
|
57
57
|
# ═══════════════════════════════════════════════════════════════
|
|
58
58
|
# PATTERN 3: Manual Bidirectional (fallback pattern)
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
# See: bidirectional-routing.agent for full implementation
|
|
63
63
|
|
|
64
64
|
variables:
|
|
65
|
-
|
|
66
|
-
description: "
|
|
65
|
+
return_subagent: mutable string = ""
|
|
66
|
+
description: "Subagent to return to after specialist"
|
|
67
67
|
specialist_result: mutable string = ""
|
|
68
68
|
description: "Result from specialist consultation"
|
|
69
69
|
|
|
70
70
|
# Before going to specialist, store return address:
|
|
71
|
-
# set @variables.
|
|
72
|
-
# go_specialist: @utils.transition to @
|
|
71
|
+
# set @variables.return_subagent = "main_hub"
|
|
72
|
+
# go_specialist: @utils.transition to @subagent.specialist
|
|
73
73
|
|
|
74
74
|
# In specialist, transition back when done:
|
|
75
|
-
# return_home: @utils.transition to @
|
|
75
|
+
# return_home: @utils.transition to @subagent.main_hub
|
|
76
76
|
|
|
77
77
|
# ═══════════════════════════════════════════════════════════════
|
|
78
78
|
# COMPARISON TABLE
|
|
@@ -80,7 +80,7 @@ variables:
|
|
|
80
80
|
#
|
|
81
81
|
# | Feature | Delegation | Transition |
|
|
82
82
|
# |----------------------|-------------------|-------------------------|
|
|
83
|
-
# | Syntax | @
|
|
83
|
+
# | Syntax | @subagent.name | @utils.transition to |
|
|
84
84
|
# | Returns to caller? | YES | NO |
|
|
85
85
|
# | Use in actions: | YES | YES |
|
|
86
86
|
# | Use in lifecycle: | NO | YES (bare syntax) |
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# ★ CRITICAL SYNTAX RULES for Lifecycle Blocks:
|
|
16
16
|
# 1. Use "transition to" NOT "@utils.transition to" for transitions
|
|
17
17
|
# 2. The pipe (|) command is NOT supported in lifecycle blocks
|
|
18
|
-
# 3. after_reasoning may NOT run if a transition occurs mid-
|
|
18
|
+
# 3. after_reasoning may NOT run if a transition occurs mid-subagent
|
|
19
19
|
# 4. `run` has inconsistent runtime behavior in lifecycle blocks —
|
|
20
20
|
# reliable primitives are `set`, `if`/`else`, `transition to`
|
|
21
21
|
#
|
|
@@ -40,9 +40,9 @@ variables:
|
|
|
40
40
|
current_context: mutable string = ""
|
|
41
41
|
description: "Refreshed context for current turn"
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
subagent conversation:
|
|
44
44
|
label: "Conversation"
|
|
45
|
-
description: "Main conversation
|
|
45
|
+
description: "Main conversation subagent with lifecycle tracking"
|
|
46
46
|
|
|
47
47
|
actions:
|
|
48
48
|
get_timestamp:
|
|
@@ -67,8 +67,8 @@ topic conversation:
|
|
|
67
67
|
inputs:
|
|
68
68
|
turn_number: number
|
|
69
69
|
description: "Which turn this is"
|
|
70
|
-
|
|
71
|
-
description: "Current
|
|
70
|
+
subagent_name: string
|
|
71
|
+
description: "Current subagent"
|
|
72
72
|
outputs:
|
|
73
73
|
logged: boolean
|
|
74
74
|
description: "Whether log succeeded"
|
|
@@ -87,7 +87,7 @@ topic conversation:
|
|
|
87
87
|
# ★ CORRECT: Use "transition to" (not @utils.transition to) in lifecycle blocks
|
|
88
88
|
# Example: Route away if session expired
|
|
89
89
|
# if @variables.session_expired == True:
|
|
90
|
-
# transition to @
|
|
90
|
+
# transition to @subagent.session_expired
|
|
91
91
|
|
|
92
92
|
# Refresh context before every turn
|
|
93
93
|
run @actions.refresh_context
|
|
@@ -105,14 +105,14 @@ topic conversation:
|
|
|
105
105
|
|
|
|
106
106
|
| Respond helpfully using the refreshed context above.
|
|
107
107
|
actions:
|
|
108
|
-
end_conversation: @utils.transition to @
|
|
108
|
+
end_conversation: @utils.transition to @subagent.farewell
|
|
109
109
|
|
|
110
110
|
# ★ after_reasoning: Runs AFTER each reasoning step
|
|
111
111
|
after_reasoning:
|
|
112
112
|
# Log analytics for each turn
|
|
113
113
|
run @actions.log_turn
|
|
114
114
|
with turn_number=@variables.turn_count
|
|
115
|
-
with
|
|
115
|
+
with subagent_name="conversation"
|
|
116
116
|
|
|
117
117
|
# Update last activity timestamp
|
|
118
118
|
run @actions.get_timestamp
|
|
@@ -27,7 +27,7 @@ variables:
|
|
|
27
27
|
action_taken: mutable string
|
|
28
28
|
description: "Last action taken by agent"
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
subagent order_assistance:
|
|
31
31
|
label: "Order Assistance"
|
|
32
32
|
description: "Helps customers with order-related questions"
|
|
33
33
|
|
|
@@ -122,9 +122,9 @@ topic order_assistance:
|
|
|
122
122
|
available when @variables.has_order_id == True
|
|
123
123
|
available when @variables.order_status != "shipped"
|
|
124
124
|
|
|
125
|
-
#
|
|
126
|
-
go_help: @utils.transition to @
|
|
127
|
-
go_escalation: @utils.transition to @
|
|
125
|
+
# Subagent transitions
|
|
126
|
+
go_help: @utils.transition to @subagent.general_help
|
|
127
|
+
go_escalation: @utils.transition to @subagent.escalation
|
|
128
128
|
available when @variables.needs_human == True
|
|
129
129
|
|
|
130
130
|
# ★ Insight: When to Use Each Method
|
|
@@ -150,7 +150,7 @@ topic order_assistance:
|
|
|
150
150
|
# ★ Example: Action Callback Pattern (Deterministic Chaining)
|
|
151
151
|
# Use "run" for guaranteed follow-up actions after a primary action
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
subagent checkout:
|
|
154
154
|
label: "Checkout"
|
|
155
155
|
description: "Handles order checkout"
|
|
156
156
|
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
# This is a COMPLETE template - customize for your use case
|
|
23
23
|
#
|
|
24
24
|
# ★ Step Guard Pattern (Feb 2026 Community Best Practice):
|
|
25
|
-
# - The
|
|
25
|
+
# - The subagent router re-evaluates on EVERY user utterance
|
|
26
26
|
# - Without a step guard, follow-up messages ("my email is X") get re-routed
|
|
27
27
|
# - The `if @variables.current_step > 1:` guard in start_agent forces
|
|
28
|
-
# re-entry to the current workflow, bypassing LLM
|
|
28
|
+
# re-entry to the current workflow, bypassing LLM subagent selection
|
|
29
29
|
# - Reset current_step to 1 when the workflow completes
|
|
30
30
|
|
|
31
31
|
system:
|
|
@@ -168,7 +168,7 @@ start_agent onboarding:
|
|
|
168
168
|
reasoning:
|
|
169
169
|
instructions: ->
|
|
170
170
|
# ★ STEP GUARD — Force re-entry if workflow in progress
|
|
171
|
-
# This prevents the
|
|
171
|
+
# This prevents the subagent router from re-routing the user
|
|
172
172
|
# mid-workflow when they provide follow-up information
|
|
173
173
|
if @variables.current_step > 1:
|
|
174
174
|
| Continuing your account setup...
|