@salesforce/afv-skills 1.7.3 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- 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/developing-datacloud-code-extension/SKILL.md +321 -0
- package/skills/developing-datacloud-code-extension/references/README.md +193 -0
- package/skills/developing-datacloud-code-extension/references/quick-reference.md +269 -0
- package/skills/generating-permission-set/SKILL.md +1 -1
- package/skills/getting-datacloud-schema/SKILL.md +380 -0
- package/skills/getting-datacloud-schema/references/README.md +191 -0
- package/skills/getting-datacloud-schema/scripts/get_dlo_schema.py +244 -0
- package/skills/getting-datacloud-schema/scripts/get_dmo_schema.py +233 -0
- 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
- package/skills/trigger-refactor-pipeline/SKILL.md +0 -191
- package/skills/trigger-refactor-pipeline/assets/test_template.apex +0 -321
- package/skills/trigger-refactor-pipeline/references/handler_patterns.md +0 -442
- package/skills/trigger-refactor-pipeline/scripts/analyze_trigger.py +0 -258
|
@@ -2,37 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
> Extracted from SKILL.md Section 8. This file is loaded on demand when architecture pattern guidance is needed.
|
|
4
4
|
|
|
5
|
-
> All architecture patterns below work for both `AgentforceServiceAgent` and `AgentforceEmployeeAgent`. The only difference is that employee agents cannot use `@utils.escalate` or `connection messaging:` — replace escalation with a `@utils.transition` to a help
|
|
5
|
+
> All architecture patterns below work for both `AgentforceServiceAgent` and `AgentforceEmployeeAgent`. The only difference is that employee agents cannot use `@utils.escalate` or `connection messaging:` — replace escalation with a `@utils.transition` to a help subagent or an action that creates a case/ticket.
|
|
6
6
|
|
|
7
7
|
## When to Use Each Pattern
|
|
8
8
|
|
|
9
9
|
| Pattern | Use When |
|
|
10
10
|
|---------|----------|
|
|
11
|
-
| Hub-and-Spoke | Agent has 2+ distinct
|
|
11
|
+
| Hub-and-Spoke | Agent has 2+ distinct subagents with different intents (most common) |
|
|
12
12
|
| Verification Gate | Sensitive data, payments, or PII require identity verification first |
|
|
13
13
|
| Post-Action Loop | Actions produce state that drives follow-up logic (e.g., risk scoring) |
|
|
14
|
-
| Single
|
|
14
|
+
| Single Subagent | Agent serves one focused purpose with no routing needed |
|
|
15
15
|
|
|
16
16
|
## Hub-and-Spoke (Most Common)
|
|
17
17
|
|
|
18
|
-
A central `
|
|
18
|
+
A central `agent_router` routes to specialized spoke subagents. Each spoke has a "back to hub" transition. Use when users may have multiple distinct intents.
|
|
19
19
|
|
|
20
20
|
```
|
|
21
|
-
start_agent
|
|
22
|
-
description: "Route user requests to the appropriate
|
|
21
|
+
start_agent agent_router:
|
|
22
|
+
description: "Route user requests to the appropriate subagent"
|
|
23
23
|
reasoning:
|
|
24
24
|
instructions: |
|
|
25
25
|
You are a router only. Do NOT answer questions directly.
|
|
26
26
|
Always use a transition action to route immediately.
|
|
27
27
|
actions:
|
|
28
|
-
to_orders: @utils.transition to @
|
|
28
|
+
to_orders: @utils.transition to @subagent.order_support
|
|
29
29
|
description: "Order questions"
|
|
30
|
-
to_returns: @utils.transition to @
|
|
30
|
+
to_returns: @utils.transition to @subagent.return_support
|
|
31
31
|
description: "Return or refund requests"
|
|
32
|
-
to_general: @utils.transition to @
|
|
32
|
+
to_general: @utils.transition to @subagent.general_support
|
|
33
33
|
description: "General questions"
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
subagent order_support:
|
|
36
36
|
description: "Handle order inquiries"
|
|
37
37
|
reasoning:
|
|
38
38
|
instructions: ->
|
|
@@ -40,34 +40,34 @@ topic order_support:
|
|
|
40
40
|
actions:
|
|
41
41
|
lookup: @actions.get_order
|
|
42
42
|
description: "Look up order"
|
|
43
|
-
back: @utils.transition to @
|
|
44
|
-
description: "Route to a different
|
|
43
|
+
back: @utils.transition to @subagent.agent_router
|
|
44
|
+
description: "Route to a different subagent"
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
> **Routing lives in `start_agent`** -- put all transition actions directly in `start_agent
|
|
47
|
+
> **Routing lives in `start_agent`** -- put all transition actions directly in `start_agent agent_router:`. Do NOT create a separate routing-only subagent (e.g. `main_menu`, `central_hub`) -- that duplicates the router, adds an extra LLM hop (~3-5s latency), and confuses the platform. Subagents that need "go back" should transition to `@subagent.agent_router`.
|
|
48
48
|
|
|
49
49
|
## Verification Gate
|
|
50
50
|
|
|
51
|
-
Users must pass through identity verification before accessing protected
|
|
51
|
+
Users must pass through identity verification before accessing protected subagents. Use when handling sensitive data, payments, or PII.
|
|
52
52
|
|
|
53
53
|
```
|
|
54
|
-
start_agent
|
|
54
|
+
start_agent agent_router:
|
|
55
55
|
description: "Route through identity verification"
|
|
56
56
|
reasoning:
|
|
57
57
|
instructions: |
|
|
58
58
|
You are a router only. Do NOT answer questions directly.
|
|
59
59
|
Route all users to identity verification first.
|
|
60
60
|
actions:
|
|
61
|
-
verify: @utils.transition to @
|
|
61
|
+
verify: @utils.transition to @subagent.identity_verification
|
|
62
62
|
description: "Begin verification"
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
subagent identity_verification:
|
|
65
65
|
description: "Verify customer identity"
|
|
66
66
|
reasoning:
|
|
67
67
|
instructions: ->
|
|
68
68
|
if @variables.failed_attempts >= 3:
|
|
69
69
|
| Too many failed attempts. Transferring to human agent.
|
|
70
|
-
transition to @
|
|
70
|
+
transition to @subagent.escalation
|
|
71
71
|
|
|
72
72
|
if @variables.is_verified == True:
|
|
73
73
|
| Identity verified! How can I help?
|
|
@@ -80,7 +80,7 @@ topic identity_verification:
|
|
|
80
80
|
description: "Verify customer email"
|
|
81
81
|
set @variables.is_verified = @outputs.verified
|
|
82
82
|
|
|
83
|
-
to_account: @utils.transition to @
|
|
83
|
+
to_account: @utils.transition to @subagent.account_mgmt
|
|
84
84
|
description: "Account management"
|
|
85
85
|
available when @variables.is_verified == True
|
|
86
86
|
|
|
@@ -90,7 +90,7 @@ topic identity_verification:
|
|
|
90
90
|
|
|
91
91
|
## Post-Action Loop
|
|
92
92
|
|
|
93
|
-
The
|
|
93
|
+
The subagent re-resolves after an action completes. Place post-action checks at the TOP of `instructions: ->` so they trigger on the loop:
|
|
94
94
|
|
|
95
95
|
```
|
|
96
96
|
reasoning:
|
|
@@ -99,7 +99,7 @@ reasoning:
|
|
|
99
99
|
if @variables.refund_status == "Approved":
|
|
100
100
|
run @actions.create_crm_case
|
|
101
101
|
with customer_id = @variables.customer_id
|
|
102
|
-
transition to @
|
|
102
|
+
transition to @subagent.confirmation
|
|
103
103
|
|
|
104
104
|
# PRE-LLM: Load data
|
|
105
105
|
run @actions.load_risk_score
|
|
@@ -116,19 +116,19 @@ reasoning:
|
|
|
116
116
|
|
|
117
117
|
## Migrating to Hub-and-Spoke
|
|
118
118
|
|
|
119
|
-
When refactoring a flat agent (all logic in one
|
|
119
|
+
When refactoring a flat agent (all logic in one subagent) into hub-and-spoke:
|
|
120
120
|
|
|
121
|
-
1. **Identify distinct intents** — each becomes a spoke
|
|
122
|
-
2. **Move instructions and actions** from the monolithic
|
|
123
|
-
3. **Create `start_agent
|
|
124
|
-
4. **Add "back to hub" transitions** in each spoke: `@utils.transition to @
|
|
125
|
-
5. **Re-preview immediately** — verify
|
|
121
|
+
1. **Identify distinct intents** — each becomes a spoke subagent
|
|
122
|
+
2. **Move instructions and actions** from the monolithic subagent into spoke subagents. Each spoke needs BOTH its Level 1 action definitions (under `subagent > actions`) AND Level 2 action invocations (under `subagent > reasoning > actions`).
|
|
123
|
+
3. **Create `start_agent agent_router:`** with transition actions pointing to each spoke
|
|
124
|
+
4. **Add "back to hub" transitions** in each spoke: `@utils.transition to @subagent.agent_router`
|
|
125
|
+
5. **Re-preview immediately** — verify subagent routing works before making further changes
|
|
126
126
|
|
|
127
127
|
**Common migration mistakes:**
|
|
128
|
-
- Creating a separate `main_menu`
|
|
129
|
-
- Leaving action definitions in `start_agent` instead of moving them to spoke
|
|
130
|
-
- Forgetting to add "back to hub" transitions — users get stuck in a spoke
|
|
131
|
-
- If trace shows `topic: "DefaultTopic"`, check that
|
|
128
|
+
- Creating a separate `main_menu` subagent instead of using `start_agent agent_router:` as the hub — adds an unnecessary LLM hop
|
|
129
|
+
- Leaving action definitions in `start_agent` instead of moving them to spoke subagents — all actions visible in all subagents, confusing the planner
|
|
130
|
+
- Forgetting to add "back to hub" transitions — users get stuck in a spoke subagent
|
|
131
|
+
- If trace shows `topic: "DefaultTopic"`, check that subagent descriptions contain keywords matching test utterances
|
|
132
132
|
|
|
133
133
|
## Multi-Intent Handling
|
|
134
134
|
|
|
@@ -137,8 +137,8 @@ When a user sends multiple intents in one message, the start_agent router should
|
|
|
137
137
|
```
|
|
138
138
|
instructions: |
|
|
139
139
|
You are a router only. Do NOT answer questions directly.
|
|
140
|
-
If the user asks about multiple
|
|
141
|
-
|
|
140
|
+
If the user asks about multiple subagents in one message, route to the first
|
|
141
|
+
subagent. After that task is complete, remind the user about the other request.
|
|
142
142
|
```
|
|
143
143
|
|
|
144
144
|
## Handling Incomplete Action Inputs
|
|
@@ -64,7 +64,7 @@ Publishing creates an **inactive** version. Without activation, preview fails wi
|
|
|
64
64
|
|-------|-------|-----|
|
|
65
65
|
| `Required fields missing: [BundleType]` | Extra fields in bundle-meta.xml | Use minimal: only `<bundleType>AGENT</bundleType>` |
|
|
66
66
|
| `Internal Error, try again later` | Invalid default_agent_user or new agent platform bug | Query Einstein Agent Users; for new agents, create shell in Setup UI first |
|
|
67
|
-
| `Duplicate value found: GenAiPluginDefinition` | `start_agent` and `
|
|
67
|
+
| `Duplicate value found: GenAiPluginDefinition` | `start_agent` and `subagent` share name | Use different names |
|
|
68
68
|
| `Flow not found` | Metadata not deployed | Deploy flows before publishing |
|
|
69
69
|
| `SetupEntityType is not supported for DML` | PermissionSet via Apex DML | Use Metadata API (`sf project deploy start`) |
|
|
70
70
|
|
|
@@ -38,10 +38,10 @@ language:
|
|
|
38
38
|
additional_locales: ""
|
|
39
39
|
all_additional_locales: False
|
|
40
40
|
|
|
41
|
-
start_agent
|
|
41
|
+
start_agent agent_router:
|
|
42
42
|
description: "Begin the onboarding flow"
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
subagent greeting:
|
|
45
45
|
label: "Greeting"
|
|
46
46
|
description: "Greet users and provide help"
|
|
47
47
|
reasoning:
|
|
@@ -62,7 +62,7 @@ Companion `bundle-meta.xml` (MUST be this exact content -- no extra fields):
|
|
|
62
62
|
|
|
63
63
|
## Minimal Employee Agent
|
|
64
64
|
|
|
65
|
-
Employee agents differ from service agents in their config, variables, and connection blocks. This example shows a 2-
|
|
65
|
+
Employee agents differ from service agents in their config, variables, and connection blocks. This example shows a 2-subagent IT Knowledge agent deployed to internal employees.
|
|
66
66
|
|
|
67
67
|
```
|
|
68
68
|
system:
|
|
@@ -95,8 +95,8 @@ language:
|
|
|
95
95
|
additional_locales: ""
|
|
96
96
|
all_additional_locales: False
|
|
97
97
|
|
|
98
|
-
start_agent
|
|
99
|
-
description: "Route employees to the right IT support
|
|
98
|
+
start_agent agent_router:
|
|
99
|
+
description: "Route employees to the right IT support subagent"
|
|
100
100
|
reasoning:
|
|
101
101
|
instructions: |
|
|
102
102
|
You are a router only. Do NOT answer questions directly.
|
|
@@ -104,12 +104,12 @@ start_agent topic_selector:
|
|
|
104
104
|
- IT questions, troubleshooting, how-to -> use to_knowledge
|
|
105
105
|
- Password reset, account access -> use to_account
|
|
106
106
|
actions:
|
|
107
|
-
to_knowledge: @utils.transition to @
|
|
107
|
+
to_knowledge: @utils.transition to @subagent.knowledge_search
|
|
108
108
|
description: "Search IT knowledge base"
|
|
109
|
-
to_account: @utils.transition to @
|
|
109
|
+
to_account: @utils.transition to @subagent.account_support
|
|
110
110
|
description: "Account and password help"
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
subagent knowledge_search:
|
|
113
113
|
label: "Knowledge Search"
|
|
114
114
|
description: "Search and retrieve IT knowledge articles"
|
|
115
115
|
|
|
@@ -139,10 +139,10 @@ topic knowledge_search:
|
|
|
139
139
|
with query = ...
|
|
140
140
|
set @variables.search_query = @outputs.articles
|
|
141
141
|
|
|
142
|
-
back: @utils.transition to @
|
|
143
|
-
description: "Route to a different
|
|
142
|
+
back: @utils.transition to @subagent.agent_router
|
|
143
|
+
description: "Route to a different subagent"
|
|
144
144
|
|
|
145
|
-
|
|
145
|
+
subagent account_support:
|
|
146
146
|
label: "Account Support"
|
|
147
147
|
description: "Help with password resets and account access"
|
|
148
148
|
|
|
@@ -171,8 +171,8 @@ topic account_support:
|
|
|
171
171
|
# NOTE: No @utils.escalate — employee agents cannot escalate to
|
|
172
172
|
# human agents via messaging. Use a transition or case-creation
|
|
173
173
|
# action instead.
|
|
174
|
-
back: @utils.transition to @
|
|
175
|
-
description: "Route to a different
|
|
174
|
+
back: @utils.transition to @subagent.agent_router
|
|
175
|
+
description: "Route to a different subagent"
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
**What's deliberately absent (vs. service agents):**
|
|
@@ -183,7 +183,7 @@ topic account_support:
|
|
|
183
183
|
|
|
184
184
|
---
|
|
185
185
|
|
|
186
|
-
## Multi-
|
|
186
|
+
## Multi-Subagent Agent with Actions
|
|
187
187
|
|
|
188
188
|
```
|
|
189
189
|
system:
|
|
@@ -228,25 +228,25 @@ language:
|
|
|
228
228
|
additional_locales: ""
|
|
229
229
|
all_additional_locales: False
|
|
230
230
|
|
|
231
|
-
start_agent
|
|
232
|
-
description: "Route customers to the right support
|
|
231
|
+
start_agent agent_router:
|
|
232
|
+
description: "Route customers to the right support subagent"
|
|
233
233
|
reasoning:
|
|
234
234
|
instructions: |
|
|
235
235
|
You are a router only. Do NOT answer questions or provide help directly.
|
|
236
|
-
Always use a transition action to route to the correct
|
|
236
|
+
Always use a transition action to route to the correct subagent immediately.
|
|
237
237
|
- Order status or tracking -> use to_orders
|
|
238
238
|
- Returns or refunds -> use to_returns
|
|
239
239
|
- General questions -> use to_general
|
|
240
240
|
Never attempt to help the customer yourself. Always route.
|
|
241
241
|
actions:
|
|
242
|
-
to_orders: @utils.transition to @
|
|
242
|
+
to_orders: @utils.transition to @subagent.order_support
|
|
243
243
|
description: "Check order status or tracking"
|
|
244
|
-
to_returns: @utils.transition to @
|
|
244
|
+
to_returns: @utils.transition to @subagent.return_support
|
|
245
245
|
description: "Process a return or refund"
|
|
246
|
-
to_general: @utils.transition to @
|
|
246
|
+
to_general: @utils.transition to @subagent.general_support
|
|
247
247
|
description: "General questions and support"
|
|
248
248
|
|
|
249
|
-
|
|
249
|
+
subagent order_support:
|
|
250
250
|
label: "Order Support"
|
|
251
251
|
description: "Handle order status and tracking inquiries"
|
|
252
252
|
|
|
@@ -281,10 +281,10 @@ topic order_support:
|
|
|
281
281
|
set @variables.order_id = @outputs.order_id
|
|
282
282
|
set @variables.order_status = @outputs.status
|
|
283
283
|
|
|
284
|
-
back: @utils.transition to @
|
|
285
|
-
description: "Route to a different
|
|
284
|
+
back: @utils.transition to @subagent.agent_router
|
|
285
|
+
description: "Route to a different subagent"
|
|
286
286
|
|
|
287
|
-
|
|
287
|
+
subagent return_support:
|
|
288
288
|
label: "Return Support"
|
|
289
289
|
description: "Handle returns and refund requests"
|
|
290
290
|
|
|
@@ -315,14 +315,14 @@ topic return_support:
|
|
|
315
315
|
with reason = ...
|
|
316
316
|
set @variables.case_id = @outputs.return_id
|
|
317
317
|
|
|
318
|
-
back: @utils.transition to @
|
|
319
|
-
description: "Route to a different
|
|
318
|
+
back: @utils.transition to @subagent.agent_router
|
|
319
|
+
description: "Route to a different subagent"
|
|
320
320
|
|
|
321
321
|
after_reasoning:
|
|
322
322
|
if @variables.case_id != "":
|
|
323
|
-
transition to @
|
|
323
|
+
transition to @subagent.confirmation
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
subagent general_support:
|
|
326
326
|
label: "General Support"
|
|
327
327
|
description: "Handle general support questions"
|
|
328
328
|
reasoning:
|
|
@@ -332,10 +332,10 @@ topic general_support:
|
|
|
332
332
|
actions:
|
|
333
333
|
escalate_now: @utils.escalate
|
|
334
334
|
description: "Transfer to human agent"
|
|
335
|
-
back: @utils.transition to @
|
|
336
|
-
description: "Route to a different
|
|
335
|
+
back: @utils.transition to @subagent.agent_router
|
|
336
|
+
description: "Route to a different subagent"
|
|
337
337
|
|
|
338
|
-
|
|
338
|
+
subagent confirmation:
|
|
339
339
|
label: "Confirmation"
|
|
340
340
|
description: "Confirm the completed action"
|
|
341
341
|
reasoning:
|
|
@@ -343,7 +343,7 @@ topic confirmation:
|
|
|
343
343
|
| Your request has been processed. Reference: {!@variables.case_id}
|
|
344
344
|
| Is there anything else I can help with?
|
|
345
345
|
actions:
|
|
346
|
-
new_request: @utils.transition to @
|
|
346
|
+
new_request: @utils.transition to @subagent.agent_router
|
|
347
347
|
description: "Start a new request"
|
|
348
348
|
end_chat: @actions.end_conversation
|
|
349
349
|
description: "End the conversation"
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
| Feature | On `@utils.transition` | On action definitions with `target:` | Notes |
|
|
8
8
|
|---------|------------------------|---------------------------------------|-------|
|
|
9
|
-
| `label:` on
|
|
9
|
+
| `label:` on subagents | ❌ | ✅ | Valid on subagent blocks |
|
|
10
10
|
| `label:` on actions | ❌ | ✅ | Valid on Level 1 action definitions |
|
|
11
11
|
| `label:` on I/O fields | ❌ | ✅ | Valid on inputs/outputs |
|
|
12
12
|
| `require_user_confirmation:` | ❌ | ✅ | Compiles; runtime no-op |
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
**What works on `@utils.transition` actions:**
|
|
19
19
|
```yaml
|
|
20
20
|
actions:
|
|
21
|
-
go_next: @utils.transition to @
|
|
22
|
-
description: "Navigate to next
|
|
21
|
+
go_next: @utils.transition to @subagent.next
|
|
22
|
+
description: "Navigate to next subagent" # ✅ ONLY description works
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
**What works on action definitions with `target:`:**
|
|
@@ -34,7 +34,7 @@ During Phase 1, the Agent Script runtime evaluates deterministic constructs in `
|
|
|
34
34
|
2. **Variable injection**: `{!@variables.X}` tokens are replaced with current values.
|
|
35
35
|
3. **`run` execution**: Deterministic `run @actions.X` calls execute and their outputs are captured.
|
|
36
36
|
4. **`set` execution**: Variable assignments execute immediately.
|
|
37
|
-
5. **`transition to`**: If reached, the
|
|
37
|
+
5. **`transition to`**: If reached, the subagent switch happens immediately (LLM is never called).
|
|
38
38
|
|
|
39
39
|
### Phase 1 Example
|
|
40
40
|
|
|
@@ -46,7 +46,7 @@ reasoning:
|
|
|
46
46
|
# 1. Post-action check (from previous loop)
|
|
47
47
|
if @variables.refund_approved == True:
|
|
48
48
|
| Your refund has been processed. Reference: {!@variables.refund_id}
|
|
49
|
-
transition to @
|
|
49
|
+
transition to @subagent.confirmation
|
|
50
50
|
|
|
51
51
|
# 2. Pre-LLM data loading
|
|
52
52
|
if @variables.data_loaded == False:
|
|
@@ -97,7 +97,7 @@ The Agent Script runtime assembles a 4-message prompt for the LLM:
|
|
|
97
97
|
| # | Message Role | Content Source | Purpose |
|
|
98
98
|
|---|---|---|---|
|
|
99
99
|
| 1 | **System** | `system: instructions:` + agent metadata | Global persona, safety rules, capabilities |
|
|
100
|
-
| 2 | **System** | `
|
|
100
|
+
| 2 | **System** | `subagent: reasoning: instructions:` (resolved from Phase 1) | Subagent-specific operating instructions |
|
|
101
101
|
| 3 | **User/Assistant** | Conversation history (all turns) | Context for the current request |
|
|
102
102
|
| 4 | **System** | Available actions + their descriptions | Tool palette the LLM can choose from |
|
|
103
103
|
|
|
@@ -147,7 +147,7 @@ reasoning:
|
|
|
147
147
|
# POST-ACTION CHECK (at TOP -- fires on re-resolution)
|
|
148
148
|
if @variables.order_cancelled == True:
|
|
149
149
|
| Your order has been cancelled successfully.
|
|
150
|
-
transition to @
|
|
150
|
+
transition to @subagent.confirmation
|
|
151
151
|
|
|
152
152
|
# These instructions are for the FIRST entry (before action runs)
|
|
153
153
|
| I can help you cancel your order.
|
|
@@ -167,7 +167,7 @@ reasoning:
|
|
|
167
167
|
instructions: ->
|
|
168
168
|
# 1. POST-ACTION CHECKS (deterministic transitions)
|
|
169
169
|
if @variables.action_completed == True:
|
|
170
|
-
transition to @
|
|
170
|
+
transition to @subagent.next_step
|
|
171
171
|
|
|
172
172
|
# 2. PRE-LLM DATA LOADING (deterministic actions)
|
|
173
173
|
if @variables.data_needed == True:
|
|
@@ -258,7 +258,7 @@ reasoning:
|
|
|
258
258
|
run @actions.assign_case
|
|
259
259
|
with case_id = @variables.case_id
|
|
260
260
|
with priority = @variables.priority
|
|
261
|
-
transition to @
|
|
261
|
+
transition to @subagent.case_confirmation
|
|
262
262
|
|
|
263
263
|
| I need to collect some information to create a support case.
|
|
264
264
|
| What is the issue you're experiencing?
|
|
@@ -273,11 +273,11 @@ reasoning:
|
|
|
273
273
|
instructions: ->
|
|
274
274
|
if @variables.intent == "billing" and @variables.is_verified == True:
|
|
275
275
|
| I can help with your billing question.
|
|
276
|
-
transition to @
|
|
276
|
+
transition to @subagent.billing_support
|
|
277
277
|
|
|
278
278
|
if @variables.intent == "billing" and @variables.is_verified == False:
|
|
279
279
|
| For billing questions, I need to verify your identity first.
|
|
280
|
-
transition to @
|
|
280
|
+
transition to @subagent.identity_verification
|
|
281
281
|
|
|
282
282
|
if @variables.intent == "general":
|
|
283
283
|
| How can I help you today?
|
|
@@ -314,32 +314,32 @@ reasoning:
|
|
|
314
314
|
| What is your order number?
|
|
315
315
|
|
|
316
316
|
if @variables.order_status != "":
|
|
317
|
-
transition to @
|
|
317
|
+
transition to @subagent.show_status
|
|
318
318
|
|
|
319
319
|
# CORRECT -- Check at TOP
|
|
320
320
|
reasoning:
|
|
321
321
|
instructions: ->
|
|
322
322
|
if @variables.order_status != "":
|
|
323
|
-
transition to @
|
|
323
|
+
transition to @subagent.show_status
|
|
324
324
|
|
|
325
325
|
| What is your order number?
|
|
326
326
|
```
|
|
327
327
|
|
|
328
|
-
### Anti-Pattern 3: Persona in
|
|
328
|
+
### Anti-Pattern 3: Persona in Subagent Instructions
|
|
329
329
|
|
|
330
330
|
```
|
|
331
|
-
# WRONG -- Persona text duplicated in every
|
|
331
|
+
# WRONG -- Persona text duplicated in every subagent
|
|
332
332
|
reasoning:
|
|
333
333
|
instructions: |
|
|
334
334
|
You are a friendly, professional customer service agent.
|
|
335
335
|
Help the customer with their order.
|
|
336
336
|
|
|
337
|
-
# CORRECT -- Persona in system instructions,
|
|
337
|
+
# CORRECT -- Persona in system instructions, subagent has operational instructions only
|
|
338
338
|
system:
|
|
339
339
|
instructions: |
|
|
340
340
|
You are a friendly, professional customer service agent.
|
|
341
341
|
|
|
342
|
-
|
|
342
|
+
subagent order_support:
|
|
343
343
|
reasoning:
|
|
344
344
|
instructions: ->
|
|
345
345
|
| Help the customer check their order status.
|
|
@@ -454,14 +454,14 @@ set @variables.counter = @variables.counter + 1
|
|
|
454
454
|
### Deterministic Transition
|
|
455
455
|
|
|
456
456
|
```
|
|
457
|
-
transition to @
|
|
457
|
+
transition to @subagent.next_subagent
|
|
458
458
|
```
|
|
459
459
|
|
|
460
460
|
### Conditional Transition
|
|
461
461
|
|
|
462
462
|
```
|
|
463
463
|
if @variables.all_collected == True:
|
|
464
|
-
transition to @
|
|
464
|
+
transition to @subagent.confirmation
|
|
465
465
|
```
|
|
466
466
|
|
|
467
467
|
---
|
|
@@ -507,20 +507,20 @@ For production agents, use the Session Trace Data Model (STDM) in Data Cloud to
|
|
|
507
507
|
|
|
508
508
|
---
|
|
509
509
|
|
|
510
|
-
## 10. Resolution Across
|
|
510
|
+
## 10. Resolution Across Subagent Transitions
|
|
511
511
|
|
|
512
|
-
When a
|
|
512
|
+
When a subagent transition occurs (via `@utils.transition to @subagent.X` or `transition to @subagent.X`), instruction resolution starts fresh in the new subagent:
|
|
513
513
|
|
|
514
|
-
1. The current
|
|
515
|
-
2. The new
|
|
516
|
-
3. The new
|
|
517
|
-
4. The LLM receives the new
|
|
514
|
+
1. The current subagent's remaining instructions are NOT processed
|
|
515
|
+
2. The new subagent's `before_reasoning:` runs (if present)
|
|
516
|
+
3. The new subagent's `reasoning: instructions:` resolves from Phase 1
|
|
517
|
+
4. The LLM receives the new subagent's assembled prompt
|
|
518
518
|
|
|
519
|
-
**Important**: Variables persist across transitions. A variable set in
|
|
519
|
+
**Important**: Variables persist across transitions. A variable set in Subagent A is available in Subagent B. This is how you pass data between subagents:
|
|
520
520
|
|
|
521
521
|
```
|
|
522
|
-
#
|
|
523
|
-
|
|
522
|
+
# Subagent A: Collect data
|
|
523
|
+
subagent collect_info:
|
|
524
524
|
reasoning:
|
|
525
525
|
instructions: ->
|
|
526
526
|
| Please provide your order number.
|
|
@@ -531,13 +531,13 @@ topic collect_info:
|
|
|
531
531
|
|
|
532
532
|
after_reasoning:
|
|
533
533
|
if @variables.order_id != "":
|
|
534
|
-
transition to @
|
|
534
|
+
transition to @subagent.process_order
|
|
535
535
|
|
|
536
|
-
#
|
|
537
|
-
|
|
536
|
+
# Subagent B: Use the data
|
|
537
|
+
subagent process_order:
|
|
538
538
|
reasoning:
|
|
539
539
|
instructions: ->
|
|
540
|
-
# order_id is available from
|
|
540
|
+
# order_id is available from Subagent A
|
|
541
541
|
| Processing order {!@variables.order_id}...
|
|
542
542
|
run @actions.get_order_details
|
|
543
543
|
with order_id = @variables.order_id
|
|
@@ -163,9 +163,9 @@ Unresolved platform bugs, limitations, and edge cases that affect Agent Script d
|
|
|
163
163
|
- **Status**: OPEN
|
|
164
164
|
- **Date Discovered**: 2026-02-14
|
|
165
165
|
- **Affects**: Agents with actions targeting secured resources
|
|
166
|
-
- **Symptom**: If the running user (Einstein Agent User or session user) lacks permission to execute ANY action defined in the agent — even actions in other
|
|
167
|
-
- **Root Cause**: The planner appears to validate permissions for all registered actions at startup, not lazily per-
|
|
168
|
-
- **Workaround**: For **Service Agents**: Ensure the Einstein Agent User has both the `AgentforceServiceAgentUser` system PS AND a custom `{AgentName}_Access` PS with `<classAccesses>` for ALL Apex classes across all
|
|
166
|
+
- **Symptom**: If the running user (Einstein Agent User or session user) lacks permission to execute ANY action defined in the agent — even actions in other subagents — the entire agent may fail with a permission error rather than gracefully skipping the unauthorized action.
|
|
167
|
+
- **Root Cause**: The planner appears to validate permissions for all registered actions at startup, not lazily per-subagent.
|
|
168
|
+
- **Workaround**: For **Service Agents**: Ensure the Einstein Agent User has both the `AgentforceServiceAgentUser` system PS AND a custom `{AgentName}_Access` PS with `<classAccesses>` for ALL Apex classes across all subagents. Do NOT rely on the auto-generated `NextGen_{AgentName}_Permissions` — it is often incomplete (ORM1 testing: 3/4 classes, missing `ShipmentTracker`). For **Employee Agents**: Ensure each employee user has the custom PS assigned. See [agent-user-setup.md](agent-user-setup.md) for the full provisioning workflow and permission set XML template. Alternatively, split agents by permission boundary.
|
|
169
169
|
- **Open Questions**: Will the planner support lazy permission checking in a future release?
|
|
170
170
|
|
|
171
171
|
---
|
|
@@ -176,7 +176,7 @@ Unresolved platform bugs, limitations, and edge cases that affect Agent Script d
|
|
|
176
176
|
- **Affects**: `system.messages.welcome` with variable interpolation
|
|
177
177
|
- **Symptom**: Variable references like `{!@variables.customer_name}` or `{!userName}` in the welcome message display as literal text instead of resolved values.
|
|
178
178
|
- **Root Cause**: Welcome messages are rendered before the agent runtime initializes variables. Mutable variables have not been set yet, and linked variables may not be resolved at welcome-message time.
|
|
179
|
-
- **Workaround**: Use static welcome messages. Personalize greetings in the first
|
|
179
|
+
- **Workaround**: Use static welcome messages. Personalize greetings in the first subagent's instructions instead.
|
|
180
180
|
- **Open Questions**: Will welcome message variable resolution be supported in a future release?
|
|
181
181
|
|
|
182
182
|
---
|
|
@@ -187,7 +187,7 @@ Unresolved platform bugs, limitations, and edge cases that affect Agent Script d
|
|
|
187
187
|
- **Affects**: `system.messages.welcome` with multi-line content
|
|
188
188
|
- **Symptom**: Line breaks (`\n`) in welcome messages are stripped, causing multi-line messages to render as a single line.
|
|
189
189
|
- **Root Cause**: The welcome message renderer does not preserve newline characters from the Agent Script source.
|
|
190
|
-
- **Workaround**: Keep welcome messages as a single line. Use the first
|
|
190
|
+
- **Workaround**: Keep welcome messages as a single line. Use the first subagent's instructions with pipe syntax (`|`) for multi-line greetings.
|
|
191
191
|
- **Open Questions**: Is this by design or a bug?
|
|
192
192
|
|
|
193
193
|
---
|
|
@@ -196,9 +196,9 @@ Unresolved platform bugs, limitations, and edge cases that affect Agent Script d
|
|
|
196
196
|
- **Status**: OPEN
|
|
197
197
|
- **Date Discovered**: 2026-02-14
|
|
198
198
|
- **Affects**: Multi-agent configurations using `related_agent` references
|
|
199
|
-
- **Symptom**: SOMA (Same Org Multi-Agent) configurations that reference related agents via node declarations fail with "Node does not have corresponding
|
|
200
|
-
- **Root Cause**: The planner resolves agent references at compile time but may not correctly map cross-agent
|
|
201
|
-
- **Workaround**: Use `@
|
|
199
|
+
- **Symptom**: SOMA (Same Org Multi-Agent) configurations that reference related agents via node declarations fail with "Node does not have corresponding subagent" error at runtime.
|
|
200
|
+
- **Root Cause**: The planner resolves agent references at compile time but may not correctly map cross-agent subagent references when agents are deployed independently.
|
|
201
|
+
- **Workaround**: Use `@subagent.X` delegation within the same agent instead of cross-agent references. For true multi-agent scenarios, use the `@utils.escalate` or connection-based handoff patterns.
|
|
202
202
|
- **Open Questions**: Will SOMA node resolution be fixed in a future planner update?
|
|
203
203
|
|
|
204
204
|
---
|
|
@@ -218,8 +218,8 @@ Unresolved platform bugs, limitations, and edge cases that affect Agent Script d
|
|
|
218
218
|
- **Status**: WORKAROUND
|
|
219
219
|
- **Date Discovered**: 2026-02-16
|
|
220
220
|
- **Date Updated**: 2026-02-17 (TDD v2.1.0 — clarified outputs specifically required)
|
|
221
|
-
- **Affects**: `sf agent publish authoring-bundle` with
|
|
222
|
-
- **Symptom**: `sf agent publish` returns "Internal Error, try again later" when
|
|
221
|
+
- **Affects**: `sf agent publish authoring-bundle` with subagent-level action definitions
|
|
222
|
+
- **Symptom**: `sf agent publish` returns "Internal Error, try again later" when subagent-level action definitions have `target:` but no `outputs:` block. Also triggered when using `inputs:` without `outputs:`. LSP + CLI validation both PASS — error is server-side compilation only.
|
|
223
223
|
- **Root Cause**: The server-side compiler needs output type contracts to resolve `flow://` and `apex://` action targets. Without an `outputs:` block, the compiler cannot generate return bindings. The `inputs:` block alone is NOT sufficient — `outputs:` is specifically required.
|
|
224
224
|
- **Workaround**: Always include an `outputs:` block in action definitions. The `inputs:` block can be omitted if the target has no required inputs (the LLM will still slot-fill via `with param=...`), but `outputs:` must always be present.
|
|
225
225
|
- **TDD Validation**: `Val_No_Outputs` (v2.1.0) confirms inputs-only action definition → "Internal Error". `Val_Partial_Output` confirms declaring a subset of outputs IS valid. `Val_Apex_Bare_Output` confirms bare `@InvocableMethod` without wrapper classes also triggers this error.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# Minimal Working Examples
|
|
2
2
|
|
|
3
|
-
Complete, deployable agent examples with single
|
|
3
|
+
Complete, deployable agent examples with single subagents, actions, and conditional logic.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Hello-World Agent Script
|
|
8
8
|
|
|
9
|
-
A complete, deployable agent with one
|
|
9
|
+
A complete, deployable agent with one subagent, one action, and conditional logic:
|
|
10
10
|
|
|
11
11
|
```agentscript
|
|
12
12
|
system:
|
|
@@ -28,12 +28,12 @@ start_agent entry:
|
|
|
28
28
|
description: "Entry point for all conversations"
|
|
29
29
|
reasoning:
|
|
30
30
|
instructions: |
|
|
31
|
-
Greet the customer and route to the main
|
|
31
|
+
Greet the customer and route to the main subagent.
|
|
32
32
|
actions:
|
|
33
|
-
go_main: @utils.transition to @
|
|
33
|
+
go_main: @utils.transition to @subagent.main
|
|
34
34
|
description: "Navigate to main conversation"
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
subagent main:
|
|
37
37
|
description: "Main conversation handler"
|
|
38
38
|
reasoning:
|
|
39
39
|
instructions: ->
|
|
@@ -64,4 +64,4 @@ topic main:
|
|
|
64
64
|
- **`instructions: ->`**: Procedural mode enables `if`/`else` and `run` directives
|
|
65
65
|
- **`instructions: |`**: Literal mode for static text passed to the LLM
|
|
66
66
|
- **`set @variables.X = @outputs.Y`**: Captures action output into mutable state
|
|
67
|
-
- **`@utils.transition`**: Permanent handoff (does not return to calling
|
|
67
|
+
- **`@utils.transition`**: Permanent handoff (does not return to calling subagent)
|