@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,26 +1,26 @@
|
|
|
1
1
|
# Open Gate Routing Pattern
|
|
2
|
-
# 3-variable state machine for auth-gated
|
|
2
|
+
# 3-variable state machine for auth-gated subagent routing with LLM bypass
|
|
3
3
|
#
|
|
4
4
|
# ★ When To Use This Pattern:
|
|
5
|
-
# - Multiple protected
|
|
6
|
-
# - You want to bypass the LLM
|
|
5
|
+
# - Multiple protected subagents require authentication before access
|
|
6
|
+
# - You want to bypass the LLM subagent selector when a gate subagent holds focus
|
|
7
7
|
# - Users should be redirected to auth, then automatically returned to their
|
|
8
|
-
# original intended
|
|
8
|
+
# original intended subagent after authentication completes
|
|
9
9
|
# - You need an EXIT_PROTOCOL to reset state when users change intent
|
|
10
10
|
#
|
|
11
11
|
# ★ Key Insight (Zero Credit Bypass):
|
|
12
|
-
# When open_gate is set, before_reasoning in the
|
|
12
|
+
# When open_gate is set, before_reasoning in the agent_router
|
|
13
13
|
# deterministically routes via "transition to" — the LLM never reasons.
|
|
14
14
|
# This saves credits on every turn the gate holds focus.
|
|
15
15
|
#
|
|
16
16
|
# ★ The 3 Variables:
|
|
17
|
-
# open_gate — Which
|
|
18
|
-
#
|
|
17
|
+
# open_gate — Which subagent currently holds focus ("null" = none)
|
|
18
|
+
# next_subagent — Deferred destination after auth completes
|
|
19
19
|
# authenticated — Whether the user has passed authentication
|
|
20
20
|
#
|
|
21
21
|
# ★ EXIT_PROTOCOL:
|
|
22
|
-
# Any
|
|
23
|
-
# This releases the gate lock and returns control to the LLM
|
|
22
|
+
# Any subagent can reset open_gate to "null" when the user changes intent.
|
|
23
|
+
# This releases the gate lock and returns control to the LLM subagent router.
|
|
24
24
|
#
|
|
25
25
|
# ★ Related Patterns:
|
|
26
26
|
# - Latch Variable (SKILL.md) — simpler 1-variable version, no auth gate
|
|
@@ -34,55 +34,56 @@
|
|
|
34
34
|
variables:
|
|
35
35
|
# ... standard linked variables ...
|
|
36
36
|
open_gate: mutable string = "null"
|
|
37
|
-
description: "Which
|
|
38
|
-
|
|
37
|
+
description: "Which subagent currently holds focus (null = LLM decides)"
|
|
38
|
+
next_subagent: mutable string = ""
|
|
39
39
|
description: "Deferred destination after authentication completes"
|
|
40
40
|
authenticated: mutable boolean = False
|
|
41
41
|
description: "Whether the user has passed authentication"
|
|
42
42
|
|
|
43
43
|
# ─────────────────────────────────────────────────────────────────────
|
|
44
|
-
#
|
|
44
|
+
# SUBAGENT ROUTER (Entry Point)
|
|
45
45
|
# When open_gate is set, bypasses LLM entirely (zero credit cost)
|
|
46
46
|
# ─────────────────────────────────────────────────────────────────────
|
|
47
|
-
start_agent
|
|
48
|
-
|
|
47
|
+
start_agent agent_router:
|
|
48
|
+
label: "Subagent Router"
|
|
49
|
+
description: "Routes to subagents — deterministic bypass when open_gate is set"
|
|
49
50
|
|
|
50
51
|
before_reasoning:
|
|
51
|
-
# ★ GATE CHECK: If a
|
|
52
|
+
# ★ GATE CHECK: If a subagent holds focus, bypass LLM entirely
|
|
52
53
|
if @variables.open_gate == "protected_workflow":
|
|
53
|
-
transition to @
|
|
54
|
+
transition to @subagent.protected_workflow
|
|
54
55
|
if @variables.open_gate == "account_management":
|
|
55
|
-
transition to @
|
|
56
|
+
transition to @subagent.account_management
|
|
56
57
|
if @variables.open_gate == "authentication_gate":
|
|
57
|
-
transition to @
|
|
58
|
+
transition to @subagent.authentication_gate
|
|
58
59
|
|
|
59
60
|
reasoning:
|
|
60
61
|
instructions: ->
|
|
61
62
|
| You are a customer service agent.
|
|
62
|
-
| Route the customer to the appropriate
|
|
63
|
+
| Route the customer to the appropriate subagent:
|
|
63
64
|
| - Order status, returns, or shipping → protected workflow
|
|
64
65
|
| - Account settings or profile changes → account management
|
|
65
66
|
| - General questions → general inquiry
|
|
66
67
|
actions:
|
|
67
|
-
go_protected: @utils.transition to @
|
|
68
|
-
go_account: @utils.transition to @
|
|
69
|
-
go_general: @utils.transition to @
|
|
68
|
+
go_protected: @utils.transition to @subagent.protected_workflow
|
|
69
|
+
go_account: @utils.transition to @subagent.account_management
|
|
70
|
+
go_general: @utils.transition to @subagent.general_inquiry
|
|
70
71
|
|
|
71
72
|
# ─────────────────────────────────────────────────────────────────────
|
|
72
73
|
# PROTECTED WORKFLOW (Requires Authentication)
|
|
73
74
|
# Checks auth state, redirects to auth gate if needed, locks focus if authed
|
|
74
75
|
# ─────────────────────────────────────────────────────────────────────
|
|
75
|
-
|
|
76
|
+
subagent protected_workflow:
|
|
76
77
|
description: "Handles order status, returns, and shipping (requires authentication)"
|
|
77
78
|
|
|
78
79
|
before_reasoning:
|
|
79
80
|
# ★ AUTH CHECK: Redirect unauthenticated users to auth gate
|
|
80
81
|
if @variables.authenticated == False:
|
|
81
|
-
set @variables.
|
|
82
|
+
set @variables.next_subagent = "protected_workflow"
|
|
82
83
|
set @variables.open_gate = "authentication_gate"
|
|
83
|
-
transition to @
|
|
84
|
+
transition to @subagent.authentication_gate
|
|
84
85
|
|
|
85
|
-
# ★ FOCUS LOCK: Keep gate open so
|
|
86
|
+
# ★ FOCUS LOCK: Keep gate open so subagent router bypasses LLM
|
|
86
87
|
set @variables.open_gate = "protected_workflow"
|
|
87
88
|
|
|
88
89
|
reasoning:
|
|
@@ -98,25 +99,25 @@ topic protected_workflow:
|
|
|
98
99
|
set @variables.order_result = @outputs.status
|
|
99
100
|
|
|
100
101
|
# ★ EXIT_PROTOCOL: User changed intent — release gate
|
|
101
|
-
exit_to_menu: @utils.transition to @
|
|
102
|
+
exit_to_menu: @utils.transition to @subagent.exit_protocol
|
|
102
103
|
|
|
103
104
|
after_reasoning:
|
|
104
105
|
# Logging or cleanup after each turn (optional)
|
|
105
|
-
set @variables.
|
|
106
|
+
set @variables.last_subagent = "protected_workflow"
|
|
106
107
|
|
|
107
108
|
# ─────────────────────────────────────────────────────────────────────
|
|
108
|
-
# ACCOUNT MANAGEMENT (Second Protected
|
|
109
|
-
# Demonstrates the pattern scales to N protected
|
|
109
|
+
# ACCOUNT MANAGEMENT (Second Protected Subagent)
|
|
110
|
+
# Demonstrates the pattern scales to N protected subagents
|
|
110
111
|
# ─────────────────────────────────────────────────────────────────────
|
|
111
|
-
|
|
112
|
+
subagent account_management:
|
|
112
113
|
description: "Handles account settings and profile changes (requires authentication)"
|
|
113
114
|
|
|
114
115
|
before_reasoning:
|
|
115
116
|
# ★ AUTH CHECK: Same pattern as protected_workflow
|
|
116
117
|
if @variables.authenticated == False:
|
|
117
|
-
set @variables.
|
|
118
|
+
set @variables.next_subagent = "account_management"
|
|
118
119
|
set @variables.open_gate = "authentication_gate"
|
|
119
|
-
transition to @
|
|
120
|
+
transition to @subagent.authentication_gate
|
|
120
121
|
|
|
121
122
|
# ★ FOCUS LOCK
|
|
122
123
|
set @variables.open_gate = "account_management"
|
|
@@ -135,14 +136,14 @@ topic account_management:
|
|
|
135
136
|
set @variables.update_result = @outputs.success
|
|
136
137
|
|
|
137
138
|
# ★ EXIT_PROTOCOL: User changed intent — release gate
|
|
138
|
-
exit_to_menu: @utils.transition to @
|
|
139
|
+
exit_to_menu: @utils.transition to @subagent.exit_protocol
|
|
139
140
|
|
|
140
141
|
# ─────────────────────────────────────────────────────────────────────
|
|
141
142
|
# AUTHENTICATION GATE
|
|
142
|
-
# Handles auth flow, then routes back via
|
|
143
|
+
# Handles auth flow, then routes back via next_subagent
|
|
143
144
|
# ─────────────────────────────────────────────────────────────────────
|
|
144
|
-
|
|
145
|
-
description: "Verifies customer identity before allowing access to protected
|
|
145
|
+
subagent authentication_gate:
|
|
146
|
+
description: "Verifies customer identity before allowing access to protected subagents"
|
|
146
147
|
|
|
147
148
|
before_reasoning:
|
|
148
149
|
# ★ FOCUS LOCK: Hold gate open during auth flow
|
|
@@ -165,54 +166,54 @@ topic authentication_gate:
|
|
|
165
166
|
after_reasoning:
|
|
166
167
|
# ★ POST-AUTH ROUTING: If authenticated, route to deferred destination
|
|
167
168
|
if @variables.authenticated == True:
|
|
168
|
-
if @variables.
|
|
169
|
+
if @variables.next_subagent == "protected_workflow":
|
|
169
170
|
set @variables.open_gate = "protected_workflow"
|
|
170
|
-
transition to @
|
|
171
|
-
if @variables.
|
|
171
|
+
transition to @subagent.protected_workflow
|
|
172
|
+
if @variables.next_subagent == "account_management":
|
|
172
173
|
set @variables.open_gate = "account_management"
|
|
173
|
-
transition to @
|
|
174
|
+
transition to @subagent.account_management
|
|
174
175
|
|
|
175
176
|
# ─────────────────────────────────────────────────────────────────────
|
|
176
177
|
# EXIT PROTOCOL (Resets Gate State)
|
|
177
|
-
# Clears open_gate so LLM
|
|
178
|
+
# Clears open_gate so LLM subagent router regains control
|
|
178
179
|
# ─────────────────────────────────────────────────────────────────────
|
|
179
|
-
|
|
180
|
-
description: "Resets gate state and returns to
|
|
180
|
+
subagent exit_protocol:
|
|
181
|
+
description: "Resets gate state and returns to subagent router"
|
|
181
182
|
|
|
182
183
|
before_reasoning:
|
|
183
184
|
# ★ RELEASE GATE: Clear all gate state
|
|
184
185
|
set @variables.open_gate = "null"
|
|
185
|
-
set @variables.
|
|
186
|
-
transition to @
|
|
186
|
+
set @variables.next_subagent = ""
|
|
187
|
+
transition to @subagent.agent_router
|
|
187
188
|
|
|
188
189
|
reasoning:
|
|
189
190
|
instructions: ->
|
|
190
191
|
| Redirecting you to the main menu.
|
|
191
192
|
|
|
192
193
|
# ─────────────────────────────────────────────────────────────────────
|
|
193
|
-
# GENERAL INQUIRY (Unprotected
|
|
194
|
-
# Demonstrates that not every
|
|
194
|
+
# GENERAL INQUIRY (Unprotected Subagent)
|
|
195
|
+
# Demonstrates that not every subagent needs gating
|
|
195
196
|
# ─────────────────────────────────────────────────────────────────────
|
|
196
|
-
|
|
197
|
+
subagent general_inquiry:
|
|
197
198
|
description: "Handles general questions that do not require authentication"
|
|
198
199
|
|
|
199
200
|
reasoning:
|
|
200
201
|
instructions: ->
|
|
201
202
|
| Help the customer with general questions.
|
|
202
|
-
| No authentication is needed for this
|
|
203
|
+
| No authentication is needed for this subagent.
|
|
203
204
|
|
|
|
204
205
|
| If the customer needs help with orders or account settings,
|
|
205
206
|
| let them know they will need to verify their identity first.
|
|
206
207
|
actions:
|
|
207
|
-
go_protected: @utils.transition to @
|
|
208
|
-
go_account: @utils.transition to @
|
|
208
|
+
go_protected: @utils.transition to @subagent.protected_workflow
|
|
209
|
+
go_account: @utils.transition to @subagent.account_management
|
|
209
210
|
|
|
210
211
|
# ═════════════════════════════════════════════════════════════════════
|
|
211
212
|
# ARCHITECTURE DIAGRAM
|
|
212
213
|
# ═════════════════════════════════════════════════════════════════════
|
|
213
214
|
#
|
|
214
215
|
# ┌─────────────────────┐
|
|
215
|
-
# │
|
|
216
|
+
# │ agent_router │
|
|
216
217
|
# │ (start_agent) │
|
|
217
218
|
# │ │
|
|
218
219
|
# │ before_reasoning: │
|
|
@@ -237,7 +238,7 @@ topic general_inquiry:
|
|
|
237
238
|
# │ before_reasoning: lock gate │
|
|
238
239
|
# │ reasoning: verify identity │
|
|
239
240
|
# │ after_reasoning: │
|
|
240
|
-
# │ if auth → route via
|
|
241
|
+
# │ if auth → route via next_subagent │
|
|
241
242
|
# └──────────────────────────────────────┘
|
|
242
243
|
#
|
|
243
244
|
# ═════════════════════════════════════════════════════════════════════
|
|
@@ -246,11 +247,11 @@ topic general_inquiry:
|
|
|
246
247
|
#
|
|
247
248
|
# User says: "I want to check my order status"
|
|
248
249
|
#
|
|
249
|
-
# Step 1:
|
|
250
|
+
# Step 1: agent_router
|
|
250
251
|
# open_gate = "null" → LLM reasons → routes to protected_workflow
|
|
251
252
|
#
|
|
252
253
|
# Step 2: protected_workflow.before_reasoning
|
|
253
|
-
# authenticated = False → set
|
|
254
|
+
# authenticated = False → set next_subagent = "protected_workflow"
|
|
254
255
|
# → set open_gate = "authentication_gate"
|
|
255
256
|
# → transition to authentication_gate
|
|
256
257
|
#
|
|
@@ -261,7 +262,7 @@ topic general_inquiry:
|
|
|
261
262
|
# authenticated = True
|
|
262
263
|
#
|
|
263
264
|
# Step 5: authentication_gate.after_reasoning
|
|
264
|
-
# authenticated = True,
|
|
265
|
+
# authenticated = True, next_subagent = "protected_workflow"
|
|
265
266
|
# → set open_gate = "protected_workflow"
|
|
266
267
|
# → transition to protected_workflow
|
|
267
268
|
#
|
|
@@ -272,7 +273,7 @@ topic general_inquiry:
|
|
|
272
273
|
# Step 7: User says "actually, never mind"
|
|
273
274
|
# → LLM selects exit_to_menu action
|
|
274
275
|
# → exit_protocol.before_reasoning: open_gate = "null"
|
|
275
|
-
# → transition to
|
|
276
|
+
# → transition to agent_router (subagent router regains control)
|
|
276
277
|
#
|
|
277
278
|
# ═════════════════════════════════════════════════════════════════════
|
|
278
279
|
# PATTERN COMPARISON
|
|
@@ -73,9 +73,9 @@ variables:
|
|
|
73
73
|
language:
|
|
74
74
|
default_locale: "en_US"
|
|
75
75
|
|
|
76
|
-
start_agent
|
|
77
|
-
label: "
|
|
78
|
-
description: "Routes to
|
|
76
|
+
start_agent agent_router:
|
|
77
|
+
label: "Subagent Router"
|
|
78
|
+
description: "Routes to subagents with procedural data loading"
|
|
79
79
|
|
|
80
80
|
actions:
|
|
81
81
|
# Data loading actions
|
|
@@ -147,11 +147,11 @@ start_agent topic_selector:
|
|
|
147
147
|
| - Account questions
|
|
148
148
|
|
|
149
149
|
actions:
|
|
150
|
-
go_orders: @utils.transition to @
|
|
151
|
-
go_cases: @utils.transition to @
|
|
152
|
-
go_account: @utils.transition to @
|
|
150
|
+
go_orders: @utils.transition to @subagent.order_status
|
|
151
|
+
go_cases: @utils.transition to @subagent.support_cases
|
|
152
|
+
go_account: @utils.transition to @subagent.account_help
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
subagent order_status:
|
|
155
155
|
label: "Order Status"
|
|
156
156
|
description: "Check order status with lazy loading"
|
|
157
157
|
|
|
@@ -172,7 +172,7 @@ topic order_status:
|
|
|
172
172
|
|
|
173
173
|
reasoning:
|
|
174
174
|
instructions: ->
|
|
175
|
-
# ★ LAZY LOADING: Only fetch orders when user enters this
|
|
175
|
+
# ★ LAZY LOADING: Only fetch orders when user enters this subagent
|
|
176
176
|
if @variables.orders_loaded == False:
|
|
177
177
|
run @actions.load_orders
|
|
178
178
|
with contact_id=@variables.ContactId
|
|
@@ -194,9 +194,9 @@ topic order_status:
|
|
|
194
194
|
actions:
|
|
195
195
|
get_details: @actions.get_tracking_details
|
|
196
196
|
with order_id=@variables.recent_order_id
|
|
197
|
-
back: @utils.transition to @
|
|
197
|
+
back: @utils.transition to @subagent.agent_router
|
|
198
198
|
|
|
199
|
-
|
|
199
|
+
subagent support_cases:
|
|
200
200
|
label: "Support Cases"
|
|
201
201
|
description: "Review support cases with lazy loading"
|
|
202
202
|
|
|
@@ -225,18 +225,18 @@ topic support_cases:
|
|
|
225
225
|
| - Return to the main menu
|
|
226
226
|
|
|
227
227
|
actions:
|
|
228
|
-
back: @utils.transition to @
|
|
228
|
+
back: @utils.transition to @subagent.agent_router
|
|
229
229
|
escalate: @utils.escalate
|
|
230
230
|
description: "Transfer to support specialist"
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
subagent account_help:
|
|
233
233
|
label: "Account Help"
|
|
234
234
|
description: "Account questions - customer data already loaded"
|
|
235
235
|
|
|
236
236
|
reasoning:
|
|
237
237
|
instructions: ->
|
|
238
238
|
# ★ DATA ALREADY AVAILABLE - no loading needed
|
|
239
|
-
# Customer data was loaded in
|
|
239
|
+
# Customer data was loaded in agent_router
|
|
240
240
|
| Account Information:
|
|
241
241
|
| Name: {!@variables.customer_name}
|
|
242
242
|
| Tier: {!@variables.customer_tier}
|
|
@@ -245,7 +245,7 @@ topic account_help:
|
|
|
245
245
|
| What would you like to know about your account?
|
|
246
246
|
|
|
247
247
|
actions:
|
|
248
|
-
back: @utils.transition to @
|
|
248
|
+
back: @utils.transition to @subagent.agent_router
|
|
249
249
|
|
|
250
250
|
# ★ Insight: Procedural vs Declarative Actions
|
|
251
251
|
#
|
|
@@ -267,7 +267,7 @@ topic account_help:
|
|
|
267
267
|
# - Result: Efficient, context-aware agents
|
|
268
268
|
|
|
269
269
|
# ★ Performance Benefits:
|
|
270
|
-
# - Fetch only what's needed per
|
|
270
|
+
# - Fetch only what's needed per subagent
|
|
271
271
|
# - Avoid loading all data upfront
|
|
272
272
|
# - Reduce API calls for simple conversations
|
|
273
273
|
# - Better response times
|
|
@@ -60,7 +60,7 @@ variables:
|
|
|
60
60
|
language:
|
|
61
61
|
default_locale: "en_US"
|
|
62
62
|
|
|
63
|
-
start_agent
|
|
63
|
+
start_agent agent_router:
|
|
64
64
|
label: "Content Generator"
|
|
65
65
|
description: "Routes to content generation options"
|
|
66
66
|
|
|
@@ -70,12 +70,12 @@ start_agent topic_selector:
|
|
|
70
70
|
| 1. Personalized daily schedule
|
|
71
71
|
| 2. Professional email
|
|
72
72
|
|
|
|
73
|
-
| Route to the appropriate
|
|
73
|
+
| Route to the appropriate subagent.
|
|
74
74
|
actions:
|
|
75
|
-
go_schedule: @utils.transition to @
|
|
76
|
-
go_email: @utils.transition to @
|
|
75
|
+
go_schedule: @utils.transition to @subagent.schedule_generation
|
|
76
|
+
go_email: @utils.transition to @subagent.email_generation
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
subagent schedule_generation:
|
|
79
79
|
label: "Schedule Generation"
|
|
80
80
|
description: "Generate personalized daily schedules"
|
|
81
81
|
|
|
@@ -123,9 +123,9 @@ topic schedule_generation:
|
|
|
123
123
|
with "Input:timezone"=@variables.user_timezone
|
|
124
124
|
set @variables.generated_schedule = @outputs.promptResponse
|
|
125
125
|
|
|
126
|
-
back: @utils.transition to @
|
|
126
|
+
back: @utils.transition to @subagent.agent_router
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
subagent email_generation:
|
|
129
129
|
label: "Email Generation"
|
|
130
130
|
description: "Generate professional emails"
|
|
131
131
|
|
|
@@ -168,7 +168,7 @@ topic email_generation:
|
|
|
168
168
|
with "Input:tone"=...
|
|
169
169
|
set @variables.generated_email = @outputs.promptResponse
|
|
170
170
|
|
|
171
|
-
back: @utils.transition to @
|
|
171
|
+
back: @utils.transition to @subagent.agent_router
|
|
172
172
|
|
|
173
173
|
# ★ Insight: Prompt Template Integration Checklist
|
|
174
174
|
#
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
#
|
|
10
10
|
# ★ Key Insight:
|
|
11
11
|
# - System block defines BASE behavior (always applies)
|
|
12
|
-
# -
|
|
12
|
+
# - Subagent instructions can OVERRIDE or EXTEND system behavior
|
|
13
13
|
# - Use conditionals in reasoning to dynamically adjust tone
|
|
14
14
|
# - Variables can control instruction branches
|
|
15
15
|
#
|
|
16
16
|
# ★ Important Limitation:
|
|
17
17
|
# - The system: block itself cannot use conditionals or variables
|
|
18
|
-
# - Dynamic behavior must be implemented in
|
|
18
|
+
# - Dynamic behavior must be implemented in subagent reasoning
|
|
19
19
|
#
|
|
20
20
|
# This is a COMPLETE template - customize for your use case
|
|
21
21
|
|
|
@@ -59,9 +59,9 @@ language:
|
|
|
59
59
|
additional_locales: ""
|
|
60
60
|
all_additional_locales: False
|
|
61
61
|
|
|
62
|
-
start_agent
|
|
63
|
-
label: "
|
|
64
|
-
description: "Routes to appropriate
|
|
62
|
+
start_agent agent_router:
|
|
63
|
+
label: "Subagent Router"
|
|
64
|
+
description: "Routes to appropriate subagent based on user tier"
|
|
65
65
|
|
|
66
66
|
# ★ Use before_reasoning to set up context-based variables
|
|
67
67
|
before_reasoning:
|
|
@@ -108,12 +108,12 @@ start_agent topic_selector:
|
|
|
108
108
|
if @variables.agent_mode == "formal":
|
|
109
109
|
| Use formal language. Address customer as Sir/Madam.
|
|
110
110
|
|
|
111
|
-
| Route the customer to the appropriate
|
|
111
|
+
| Route the customer to the appropriate subagent.
|
|
112
112
|
|
|
113
113
|
actions:
|
|
114
|
-
go_orders: @utils.transition to @
|
|
115
|
-
go_billing: @utils.transition to @
|
|
116
|
-
go_support: @utils.transition to @
|
|
114
|
+
go_orders: @utils.transition to @subagent.orders
|
|
115
|
+
go_billing: @utils.transition to @subagent.billing
|
|
116
|
+
go_support: @utils.transition to @subagent.support
|
|
117
117
|
available when @variables.business_hours == True
|
|
118
118
|
|
|
119
119
|
actions:
|
|
@@ -134,13 +134,13 @@ start_agent topic_selector:
|
|
|
134
134
|
description: "True if in business hours"
|
|
135
135
|
target: "flow://Check_Business_Hours"
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
subagent orders:
|
|
138
138
|
label: "Order Management"
|
|
139
139
|
description: "Handle order inquiries with tier-appropriate service"
|
|
140
140
|
|
|
141
141
|
reasoning:
|
|
142
142
|
instructions: ->
|
|
143
|
-
# ★ Tier-specific instructions carry through to
|
|
143
|
+
# ★ Tier-specific instructions carry through to subagents
|
|
144
144
|
if @variables.customer_tier == "vip":
|
|
145
145
|
| This is a VIP customer. Expedite all order requests.
|
|
146
146
|
| Offer free shipping upgrades proactively.
|
|
@@ -149,9 +149,9 @@ topic orders:
|
|
|
149
149
|
| Look up order status, process changes, or handle returns.
|
|
150
150
|
|
|
151
151
|
actions:
|
|
152
|
-
back: @utils.transition to @
|
|
152
|
+
back: @utils.transition to @subagent.agent_router
|
|
153
153
|
|
|
154
|
-
|
|
154
|
+
subagent billing:
|
|
155
155
|
label: "Billing Support"
|
|
156
156
|
description: "Handle billing with appropriate authority levels"
|
|
157
157
|
|
|
@@ -171,12 +171,12 @@ topic billing:
|
|
|
171
171
|
| Help the customer understand their bill and resolve issues.
|
|
172
172
|
|
|
173
173
|
actions:
|
|
174
|
-
back: @utils.transition to @
|
|
174
|
+
back: @utils.transition to @subagent.agent_router
|
|
175
175
|
escalate: @utils.escalate
|
|
176
176
|
description: "Transfer to billing specialist"
|
|
177
177
|
available when @variables.customer_tier == "standard"
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
subagent support:
|
|
180
180
|
label: "Technical Support"
|
|
181
181
|
description: "Technical support with business hours awareness"
|
|
182
182
|
|
|
@@ -192,20 +192,20 @@ topic support:
|
|
|
192
192
|
| Help resolve the customer's technical issue.
|
|
193
193
|
|
|
194
194
|
actions:
|
|
195
|
-
back: @utils.transition to @
|
|
195
|
+
back: @utils.transition to @subagent.agent_router
|
|
196
196
|
|
|
197
197
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
198
|
-
# ★
|
|
199
|
-
# These
|
|
198
|
+
# ★ SUBAGENT-LEVEL SYSTEM OVERRIDES (NEW PATTERN)
|
|
199
|
+
# These subagents demonstrate complete persona switching using subagent-level
|
|
200
200
|
# system: blocks that OVERRIDE the global system instructions.
|
|
201
201
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
202
202
|
|
|
203
|
-
|
|
203
|
+
subagent formal_mode:
|
|
204
204
|
label: "Formal Communication"
|
|
205
205
|
description: "Professional business communication mode"
|
|
206
206
|
|
|
207
|
-
# ★
|
|
208
|
-
# This completely replaces global system instructions for this
|
|
207
|
+
# ★ SUBAGENT-LEVEL SYSTEM OVERRIDE
|
|
208
|
+
# This completely replaces global system instructions for this subagent
|
|
209
209
|
system:
|
|
210
210
|
instructions: "You are a formal business professional. Use professional language at all times. Address users as Sir or Madam. Avoid contractions, slang, and casual expressions. Focus on efficiency and clarity. Maintain a respectful, corporate tone."
|
|
211
211
|
|
|
@@ -217,13 +217,13 @@ topic formal_mode:
|
|
|
217
217
|
| I am prepared to address your inquiry with the utmost professionalism.
|
|
218
218
|
|
|
219
219
|
actions:
|
|
220
|
-
back: @utils.transition to @
|
|
220
|
+
back: @utils.transition to @subagent.agent_router
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
subagent creative_mode:
|
|
223
223
|
label: "Creative Assistant"
|
|
224
224
|
description: "Creative and imaginative communication mode"
|
|
225
225
|
|
|
226
|
-
# ★
|
|
226
|
+
# ★ SUBAGENT-LEVEL SYSTEM OVERRIDE
|
|
227
227
|
# Different persona entirely
|
|
228
228
|
system:
|
|
229
229
|
instructions: "You are a creative and imaginative assistant. Be playful, use metaphors and analogies. Think outside the box. Encourage brainstorming and wild ideas. Use emojis sparingly but effectively. Make conversations engaging and fun while still being helpful."
|
|
@@ -238,13 +238,13 @@ topic creative_mode:
|
|
|
238
238
|
| What shall we dream up today?
|
|
239
239
|
|
|
240
240
|
actions:
|
|
241
|
-
back: @utils.transition to @
|
|
241
|
+
back: @utils.transition to @subagent.agent_router
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
subagent technical_expert:
|
|
244
244
|
label: "Technical Expert"
|
|
245
245
|
description: "Deep technical expertise mode"
|
|
246
246
|
|
|
247
|
-
# ★
|
|
247
|
+
# ★ SUBAGENT-LEVEL SYSTEM OVERRIDE
|
|
248
248
|
# Specialist persona
|
|
249
249
|
system:
|
|
250
250
|
instructions: "You are a technical expert with deep knowledge. Use precise technical terminology. Provide detailed explanations with examples. Reference documentation when helpful. Assume the user has technical background. Be thorough but avoid unnecessary verbosity."
|
|
@@ -259,35 +259,35 @@ topic technical_expert:
|
|
|
259
259
|
| What technical challenge are we solving?
|
|
260
260
|
|
|
261
261
|
actions:
|
|
262
|
-
back: @utils.transition to @
|
|
262
|
+
back: @utils.transition to @subagent.agent_router
|
|
263
263
|
|
|
264
264
|
# ★ Insight: Three Levels of Instruction Control
|
|
265
265
|
#
|
|
266
266
|
# LEVEL 1: GLOBAL SYSTEM BLOCK
|
|
267
267
|
# - Static text only (no variables, no conditionals)
|
|
268
|
-
# - Applies to ALL
|
|
268
|
+
# - Applies to ALL subagents as baseline
|
|
269
269
|
# - Good for: Guardrails, base personality, universal rules
|
|
270
270
|
# - Example: "Never share confidential information"
|
|
271
271
|
#
|
|
272
|
-
# LEVEL 2:
|
|
273
|
-
# - Placed inside
|
|
274
|
-
# - COMPLETELY OVERRIDES global system for that
|
|
272
|
+
# LEVEL 2: SUBAGENT-LEVEL SYSTEM BLOCK (NEW!)
|
|
273
|
+
# - Placed inside subagent definition
|
|
274
|
+
# - COMPLETELY OVERRIDES global system for that subagent
|
|
275
275
|
# - Good for: Persona switching, mode changes, specialist behavior
|
|
276
|
-
# - Example:
|
|
276
|
+
# - Example: subagent formal_mode: system: instructions: "Be professional..."
|
|
277
277
|
#
|
|
278
|
-
# LEVEL 3:
|
|
278
|
+
# LEVEL 3: SUBAGENT REASONING INSTRUCTIONS
|
|
279
279
|
# - Dynamic (variables, conditionals, template expressions)
|
|
280
|
-
# - Extends/adjusts behavior within
|
|
280
|
+
# - Extends/adjusts behavior within subagent
|
|
281
281
|
# - Good for: Context-aware responses, personalization
|
|
282
282
|
# - Example: if @variables.is_vip: | Provide priority service
|
|
283
283
|
#
|
|
284
284
|
# OVERRIDE HIERARCHY:
|
|
285
|
-
#
|
|
285
|
+
# Subagent system: > Global system: > Default behavior
|
|
286
286
|
#
|
|
287
287
|
# COMBINING APPROACHES:
|
|
288
288
|
# - Use GLOBAL system for universal guardrails
|
|
289
|
-
# - Use
|
|
290
|
-
# - Use
|
|
289
|
+
# - Use SUBAGENT system: for complete persona changes
|
|
290
|
+
# - Use SUBAGENT reasoning for dynamic conditional behavior
|
|
291
291
|
#
|
|
292
|
-
# Best Practice: Put guardrails in global system, personas in
|
|
293
|
-
# and context-aware personalization in
|
|
292
|
+
# Best Practice: Put guardrails in global system, personas in subagent system,
|
|
293
|
+
# and context-aware personalization in subagent reasoning instructions.
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
# CREDIT CONSUMPTION:
|
|
11
11
|
# - Prompt Templates: 2-16 credits per invocation
|
|
12
12
|
# - Retriever actions: 20 credits per search
|
|
13
|
-
# - TIP: Cache retriever results in variables, reuse across
|
|
13
|
+
# - TIP: Cache retriever results in variables, reuse across subagents
|
|
14
14
|
|
|
15
15
|
system:
|
|
16
16
|
messages:
|
|
@@ -43,14 +43,14 @@ start_agent entry:
|
|
|
43
43
|
instructions: |
|
|
44
44
|
Welcome the user and offer to help with questions.
|
|
45
45
|
actions:
|
|
46
|
-
go_search: @utils.transition to @
|
|
46
|
+
go_search: @utils.transition to @subagent.knowledge_search
|
|
47
47
|
description: "Start knowledge search"
|
|
48
48
|
|
|
49
49
|
# ============================================================
|
|
50
|
-
# KNOWLEDGE SEARCH
|
|
50
|
+
# KNOWLEDGE SEARCH SUBAGENT (RAG Pattern)
|
|
51
51
|
# ============================================================
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
subagent knowledge_search:
|
|
54
54
|
description: "Search knowledge base and generate grounded responses"
|
|
55
55
|
reasoning:
|
|
56
56
|
instructions: ->
|
|
@@ -64,7 +64,7 @@ topic knowledge_search:
|
|
|
64
64
|
|
|
65
65
|
# NO RESULTS: Escalate or try different search
|
|
66
66
|
if @variables.has_results == False and @variables.search_query != "":
|
|
67
|
-
| I couldn't find information about that
|
|
67
|
+
| I couldn't find information about that subject.
|
|
68
68
|
| Would you like to try a different search, or speak with a human agent?
|
|
69
69
|
|
|
70
70
|
# INITIAL STATE: Ask for question
|
|
@@ -110,10 +110,10 @@ topic knowledge_search:
|
|
|
110
110
|
description: "Transfer to human agent"
|
|
111
111
|
|
|
112
112
|
# ============================================================
|
|
113
|
-
# FOLLOW-UP QUESTIONS
|
|
113
|
+
# FOLLOW-UP QUESTIONS SUBAGENT
|
|
114
114
|
# ============================================================
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
subagent follow_up:
|
|
117
117
|
description: "Handle follow-up questions using cached context"
|
|
118
118
|
reasoning:
|
|
119
119
|
instructions: ->
|
|
@@ -124,8 +124,8 @@ topic follow_up:
|
|
|
124
124
|
with query = ... # Follow-up question extracted by LLM
|
|
125
125
|
with context = @variables.search_results # Reuse cached results!
|
|
126
126
|
else:
|
|
127
|
-
transition to @
|
|
127
|
+
transition to @subagent.knowledge_search
|
|
128
128
|
|
|
129
129
|
actions:
|
|
130
|
-
back_to_search: @utils.transition to @
|
|
130
|
+
back_to_search: @utils.transition to @subagent.knowledge_search
|
|
131
131
|
description: "Start a new search"
|