@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.
Files changed (78) hide show
  1. package/package.json +1 -1
  2. package/skills/developing-agentforce/README.md +4 -4
  3. package/skills/developing-agentforce/SKILL.md +37 -37
  4. package/skills/developing-agentforce/assets/README-legacy.md +8 -8
  5. package/skills/developing-agentforce/assets/agent-spec-template.md +9 -9
  6. package/skills/developing-agentforce/assets/agents/README.md +4 -4
  7. package/skills/developing-agentforce/assets/agents/hello-world.agent +3 -3
  8. package/skills/developing-agentforce/assets/agents/{multi-topic.agent → multi-subagent.agent} +30 -30
  9. package/skills/developing-agentforce/assets/agents/order-service.agent +25 -25
  10. package/skills/developing-agentforce/assets/agents/production-faq.agent +12 -12
  11. package/skills/developing-agentforce/assets/agents/simple-qa.agent +8 -8
  12. package/skills/developing-agentforce/assets/agents/verification-gate.agent +19 -19
  13. package/skills/developing-agentforce/assets/components/apex-action.agent +3 -3
  14. package/skills/developing-agentforce/assets/components/error-handling.agent +7 -7
  15. package/skills/developing-agentforce/assets/components/escalation-setup.agent +11 -11
  16. package/skills/developing-agentforce/assets/components/flow-action.agent +5 -5
  17. package/skills/developing-agentforce/assets/components/n-ary-conditions.agent +11 -11
  18. package/skills/developing-agentforce/assets/components/{topic-with-actions.agent → subagent-with-actions.agent} +9 -9
  19. package/skills/developing-agentforce/assets/deterministic-routing.agent +19 -19
  20. package/skills/developing-agentforce/assets/escalation-pattern.agent +13 -13
  21. package/skills/developing-agentforce/assets/flow-action-lookup.agent +3 -3
  22. package/skills/developing-agentforce/assets/hub-and-spoke.agent +18 -18
  23. package/skills/developing-agentforce/assets/local-info-agent-annotated.agent +37 -37
  24. package/skills/developing-agentforce/assets/metadata/genai-function-apex.xml +3 -3
  25. package/skills/developing-agentforce/assets/metadata/genai-function-flow.xml +1 -1
  26. package/skills/developing-agentforce/assets/metadata/genai-plugin.xml +10 -10
  27. package/skills/developing-agentforce/assets/minimal-starter.agent +4 -4
  28. package/skills/developing-agentforce/assets/patterns/README.md +21 -21
  29. package/skills/developing-agentforce/assets/patterns/action-callbacks.agent +4 -4
  30. package/skills/developing-agentforce/assets/patterns/advanced-input-bindings.agent +1 -1
  31. package/skills/developing-agentforce/assets/patterns/bidirectional-routing.agent +25 -25
  32. package/skills/developing-agentforce/assets/patterns/critical-input-collection.agent +8 -8
  33. package/skills/developing-agentforce/assets/patterns/delegation-routing.agent +21 -21
  34. package/skills/developing-agentforce/assets/patterns/lifecycle-events.agent +8 -8
  35. package/skills/developing-agentforce/assets/patterns/llm-controlled-actions.agent +5 -5
  36. package/skills/developing-agentforce/assets/patterns/multi-step-workflow.agent +3 -3
  37. package/skills/developing-agentforce/assets/patterns/open-gate-routing.agent +59 -58
  38. package/skills/developing-agentforce/assets/patterns/procedural-instructions.agent +15 -15
  39. package/skills/developing-agentforce/assets/patterns/prompt-template-action.agent +8 -8
  40. package/skills/developing-agentforce/assets/patterns/system-instruction-overrides.agent +40 -40
  41. package/skills/developing-agentforce/assets/prompt-rag-search.agent +9 -9
  42. package/skills/developing-agentforce/assets/{template-multi-topic.agent → template-multi-subagent.agent} +25 -25
  43. package/skills/developing-agentforce/assets/{template-single-topic.agent → template-single-subagent.agent} +14 -14
  44. package/skills/developing-agentforce/assets/verification-gate.agent +16 -16
  45. package/skills/developing-agentforce/references/action-prompt-templates.md +1 -1
  46. package/skills/developing-agentforce/references/actions-reference.md +4 -4
  47. package/skills/developing-agentforce/references/agent-design-and-spec-creation.md +107 -107
  48. package/skills/developing-agentforce/references/agent-metadata-and-lifecycle.md +5 -5
  49. package/skills/developing-agentforce/references/agent-script-core-language.md +79 -79
  50. package/skills/developing-agentforce/references/{agent-topic-map-diagrams.md → agent-subagent-map-diagrams.md} +65 -65
  51. package/skills/developing-agentforce/references/agent-user-setup.md +2 -2
  52. package/skills/developing-agentforce/references/agent-validation-and-debugging.md +55 -55
  53. package/skills/developing-agentforce/references/architecture-patterns.md +33 -33
  54. package/skills/developing-agentforce/references/deploy-reference.md +1 -1
  55. package/skills/developing-agentforce/references/discover-reference.md +1 -1
  56. package/skills/developing-agentforce/references/examples.md +32 -32
  57. package/skills/developing-agentforce/references/feature-validity.md +3 -3
  58. package/skills/developing-agentforce/references/instruction-resolution.md +29 -29
  59. package/skills/developing-agentforce/references/known-issues.md +10 -10
  60. package/skills/developing-agentforce/references/minimal-examples.md +6 -6
  61. package/skills/developing-agentforce/references/production-gotchas.md +22 -22
  62. package/skills/developing-agentforce/references/safety-review-reference.md +2 -2
  63. package/skills/developing-agentforce/references/scoring-rubric.md +3 -3
  64. package/skills/generating-custom-lightning-type/SKILL.md +12 -3
  65. package/skills/observing-agentforce/SKILL.md +8 -8
  66. package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls +2 -2
  67. package/skills/observing-agentforce/references/improve-reference.md +40 -40
  68. package/skills/observing-agentforce/references/issue-classification.md +47 -47
  69. package/skills/observing-agentforce/references/reproduce-reference.md +7 -7
  70. package/skills/observing-agentforce/references/stdm-queries.md +7 -7
  71. package/skills/observing-agentforce/references/stdm-schema.md +2 -2
  72. package/skills/testing-agentforce/SKILL.md +9 -9
  73. package/skills/testing-agentforce/assets/basic-test-spec.yaml +4 -0
  74. package/skills/testing-agentforce/assets/guardrail-test-spec.yaml +4 -0
  75. package/skills/testing-agentforce/assets/standard-test-spec.yaml +8 -4
  76. package/skills/testing-agentforce/references/batch-testing.md +17 -17
  77. package/skills/testing-agentforce/references/preview-testing.md +25 -25
  78. package/skills/testing-agentforce/references/test-report-format.md +6 -6
@@ -22,13 +22,13 @@ The `before_reasoning:` and `after_reasoning:` lifecycle hooks are validated. Co
22
22
 
23
23
  ### Cost Optimization Pattern
24
24
 
25
- Fetch data once in `before_reasoning:`, cache in variables, reuse across topics.
25
+ Fetch data once in `before_reasoning:`, cache in variables, reuse across subagents.
26
26
 
27
27
  ## Lifecycle Hooks
28
28
 
29
29
  ```yaml
30
- topic main:
31
- description: "Topic with lifecycle hooks"
30
+ subagent main:
31
+ description: "Subagent with lifecycle hooks"
32
32
 
33
33
  # BEFORE: Runs deterministically BEFORE LLM sees instructions
34
34
  before_reasoning:
@@ -55,7 +55,7 @@ topic main:
55
55
  - Reliable primitives: `set`, `if`/`else`, `transition to`. `run` has inconsistent runtime behavior across bundle types — use it in `reasoning.actions:` or `instructions: ->` instead
56
56
  - `before_reasoning:` is FREE (no credit cost) - use for data prep
57
57
  - `after_reasoning:` is FREE (no credit cost) - use for logging, cleanup
58
- - `transition to` works in `after_reasoning:` — but if a topic transitions mid-reasoning, the original topic's `after_reasoning:` does NOT run
58
+ - `transition to` works in `after_reasoning:` — but if a subagent transitions mid-reasoning, the original subagent's `after_reasoning:` does NOT run
59
59
 
60
60
  **❌ WRONG Syntax (causes compile error):**
61
61
  ```yaml
@@ -74,19 +74,19 @@ before_reasoning:
74
74
 
75
75
  | Term | Syntax | Behavior | Use When |
76
76
  |------|--------|----------|----------|
77
- | **Handoff** | `@utils.transition to @topic.X` | Control transfers completely, child generates final response | Checkout, escalation, terminal states |
78
- | **Supervision** | `@topic.X` (as action reference) | Parent orchestrates, child returns, parent synthesizes | Expert consultation, sub-tasks |
77
+ | **Handoff** | `@utils.transition to @subagent.X` | Control transfers completely, child generates final response | Checkout, escalation, terminal states |
78
+ | **Supervision** | `@subagent.X` (as action reference) | Parent orchestrates, child returns, parent synthesizes | Expert consultation, sub-tasks |
79
79
 
80
80
  ```yaml
81
- # HANDOFF - child topic takes over completely:
82
- checkout: @utils.transition to @topic.order_checkout
81
+ # HANDOFF - child subagent takes over completely:
82
+ checkout: @utils.transition to @subagent.order_checkout
83
83
  description: "Proceed to checkout"
84
- # → @topic.order_checkout generates the user-facing response
84
+ # → @subagent.order_checkout generates the user-facing response
85
85
 
86
86
  # SUPERVISION - parent remains in control:
87
- get_advice: @topic.product_expert
87
+ get_advice: @subagent.product_expert
88
88
  description: "Consult product expert"
89
- # → @topic.product_expert returns, parent topic synthesizes final response
89
+ # → @subagent.product_expert returns, parent subagent synthesizes final response
90
90
  ```
91
91
 
92
92
  **KNOWN BUG**: Adding ANY new action in Canvas view may inadvertently change Supervision references to Handoff transitions.
@@ -111,16 +111,16 @@ outputs:
111
111
  is_used_by_planner: True # LLM can use for routing decisions
112
112
 
113
113
  # In Agent Script - LLM routes but cannot hallucinate:
114
- topic intent_router:
114
+ subagent intent_router:
115
115
  reasoning:
116
116
  instructions: ->
117
117
  run @actions.classify_intent
118
118
  set @variables.intent = @outputs.intent_classification
119
119
 
120
120
  if @variables.intent == "refund":
121
- transition to @topic.refunds
121
+ transition to @subagent.refunds
122
122
  if @variables.intent == "order_status":
123
- transition to @topic.orders
123
+ transition to @subagent.orders
124
124
  ```
125
125
 
126
126
  ## Action I/O Metadata Properties
@@ -187,26 +187,26 @@ KNOWN BUG: Chained actions with Prompt Templates don't properly map inputs using
187
187
 
188
188
  For prompt template action definitions, input binding syntax, and grounded data patterns, see [Action Prompt Templates](action-prompt-templates.md).
189
189
 
190
- ## Latch Variable Pattern for Topic Re-entry
190
+ ## Latch Variable Pattern for Subagent Re-entry
191
191
 
192
- Topic selector doesn't properly re-evaluate after user provides missing input. Use a "latch" variable to force re-entry:
192
+ Subagent router doesn't properly re-evaluate after user provides missing input. Use a "latch" variable to force re-entry:
193
193
 
194
194
  ```yaml
195
195
  variables:
196
196
  verification_in_progress: mutable boolean = False
197
197
 
198
- start_agent topic_selector:
198
+ start_agent agent_router:
199
199
  reasoning:
200
200
  instructions: ->
201
201
  if @variables.verification_in_progress == True:
202
- transition to @topic.verification
202
+ transition to @subagent.verification
203
203
  | How can I help you today?
204
204
  actions:
205
- start_verify: @topic.verification
205
+ start_verify: @subagent.verification
206
206
  description: "Start identity verification"
207
207
  set @variables.verification_in_progress = True
208
208
 
209
- topic verification:
209
+ subagent verification:
210
210
  reasoning:
211
211
  instructions: ->
212
212
  | Please provide your email to verify your identity.
@@ -219,9 +219,9 @@ topic verification:
219
219
 
220
220
  ## Loop Protection Guardrail
221
221
 
222
- Agent Scripts have a built-in guardrail that limits iterations to approximately **3-4 loops** before breaking out and returning to the Topic Selector.
222
+ Agent Scripts have a built-in guardrail that limits iterations to approximately **3-4 loops** before breaking out and returning to the Subagent Router.
223
223
 
224
- **Best Practice**: Map out your execution paths and test for unintended circular references between topics.
224
+ **Best Practice**: Map out your execution paths and test for unintended circular references between subagents.
225
225
 
226
226
  ## Token & Size Limits
227
227
 
@@ -78,8 +78,8 @@ For each finding, assign severity: **BLOCK** (stops pipeline), **WARN** (flags f
78
78
  | Check | Severity | What to Look For |
79
79
  |-------|----------|------------------|
80
80
  | Missing scope definition | WARN | No "do not" or "only handle" clause |
81
- | Overly broad scope | WARN | No topic boundaries, no escalation path |
82
- | Missing escalation | WARN | Complex/sensitive topics without human transfer |
81
+ | Overly broad scope | WARN | No subagent boundaries, no escalation path |
82
+ | Missing escalation | WARN | Complex/sensitive subagents without human transfer |
83
83
  | Missing error handling | INFO | No instructions for when agent can't help |
84
84
 
85
85
  ## Output Format
@@ -6,11 +6,11 @@ Score every generated agent against this rubric before presenting to the user.
6
6
 
7
7
  | Category | Points | Key Criteria |
8
8
  |----------|--------|--------------|
9
- | Structure & Syntax | 15 | All required blocks present (`system`, `config`, `start_agent`, at least one `topic`). Correct block order (`system` → `config` → `variables` → ...). Proper nesting. Consistent 4-space indentation. Valid field names. All string values double-quoted. |
9
+ | Structure & Syntax | 15 | All required blocks present (`system`, `config`, `start_agent`, at least one `subagent`). Correct block order (`system` → `config` → `variables` → ...). Proper nesting. Consistent 4-space indentation. Valid field names. All string values double-quoted. |
10
10
  | Safety & Responsible AI | 15 | Evaluated via safety review (7 categories): AI disclosure present, no impersonation/deception/manipulation, responsible data handling, no harmful content (including euphemisms), no discrimination (direct or proxy), clear scope boundaries, escalation paths for sensitive topics. Deduct 15 for any BLOCK finding, 5 per WARN finding. |
11
- | Deterministic Logic | 20 | `after_reasoning` patterns for post-action routing. FSM transitions with no dead-end topics. `available when` guards for security-sensitive actions. Post-action checks at TOP of `instructions: ->`. |
11
+ | Deterministic Logic | 20 | `after_reasoning` patterns for post-action routing. FSM transitions with no dead-end subagents. `available when` guards for security-sensitive actions. Post-action checks at TOP of `instructions: ->`. |
12
12
  | Instruction Resolution | 20 | Clear, actionable instructions. Procedural mode (`->`) where conditionals are needed. Literal mode (`\|`) where static text suffices. Variable injection where dynamic. Conditional instructions based on state. |
13
- | FSM Architecture | 10 | Hub-and-spoke or verification gate pattern. Every topic reachable. Every topic has an exit (transition or escalation). No orphan topics. Start topic routes correctly. |
13
+ | FSM Architecture | 10 | Hub-and-spoke or verification gate pattern. Every subagent reachable. Every subagent has an exit (transition or escalation). No orphan subagents. Start subagent routes correctly. |
14
14
  | Action Configuration | 10 | Proper Level 1 definitions with targets and I/O schemas. Correct Level 2 invocations with `with`/`set`. Slot-filling (`...`) for conversational inputs. Output capture into variables. Correct type mapping for action I/O (use `object` + `complex_data_type_name` for SObjects and custom Lightning types). |
15
15
  | Deployment Readiness | 10 | Valid `default_agent_user`. `developer_name` matches folder. `bundle-meta.xml` present with `<bundleType>AGENT</bundleType>`. Linked variables for service agents (`EndUserId`, `RoutableId`, `ContactId`). |
16
16
 
@@ -20,6 +20,7 @@ Use this skill when you need to:
20
20
  Custom Lightning Types (CLTs) are JSON Schema-based type definitions used by the Lightning Platform (including Einstein Agent actions) to describe structured inputs/outputs and drive editor/renderer experiences.
21
21
 
22
22
  ## Configuration
23
+ - **Choose referenced CLT pattern for nested objects** - When you need a **reusable** or **separately deployed** nested type, create a CLT for that shape and reference it with `"lightning:type": "c__<CLTName>"`. That string is the referenced type’s **`lightning:type` value / FQN / registered identifier** — not the JSON Schema `title`.
23
24
  - **Choose standard Lightning types** when the structure is simple and can be expressed with properties and supported primitive `lightning:type` identifiers.
24
25
  - **Choose Apex class types** (`@apexClassType/...`) when the structure already exists server-side and you want the Apex class to define the shape.
25
26
  - **Include editor/renderer config** only when you need custom UI behavior (custom LWC input/output components). Otherwise, omit.
@@ -33,7 +34,7 @@ Custom Lightning Types (CLTs) are JSON Schema-based type definitions used by the
33
34
  - `"unevaluatedProperties"` is enforced as `false` by the CLT metaschema. Do not set it to `true`.
34
35
  - **Root object schemas MUST NOT include** `"examples"` when `"unevaluatedProperties": false` is set.
35
36
  - **Nested objects (inside `properties`) MUST NOT set** `"lightning:type": "lightning__objectType"`.
36
- - Nested objects should be plain JSON Schema objects (`type`, `properties`, optional `required`, optional `unevaluatedProperties`).
37
+ - Nested objects can be: references to other CLTs using `c__<CLTName>` syntax.
37
38
  - **List/array properties are highly restricted by the CLT metaschema**:
38
39
  - **CRITICAL LIMITATION**: the CLT metaschema may reject the `items` keyword entirely. Treat `items` as **disallowed by default**.
39
40
  - **Root-level arrays** (direct children of the root `properties`):
@@ -96,8 +97,13 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
96
97
  2. **Draft `schema.json`**
97
98
  - Start with the root object structure (required root fields).
98
99
  - Add `properties` using valid primitive `lightning:type` identifiers.
99
- - For nested objects: omit `lightning:type` and keep keywords minimal.
100
+ - For nested-object properties, use **CLT Reference pattern**:
101
+ - `"lightning:type": "c__<CLTName>"` to reference another CLT
102
+ - The referenced CLT must be deployed to the org before the parent CLT.
103
+ - For Apex-based nested objects: Use `@apexClassType/...` when structure exists server-side.
104
+ - If the prompt explicitly requires true nested object output, prefer an **Apex-based CLT** (`@apexClassType/...`) for deploy-safe nested structures.
100
105
  - For arrays: follow the strict list rules (avoid `items`; avoid `lightning:type` on nested arrays).
106
+ - Before deployment, verify exact `lightning:type` spellings (for example, use `lightning__richTextType`, not misspelled variants).
101
107
  3. **(Optional) Draft `editor.json`** (only if custom UI is required)
102
108
  - **Supported shape:** Top-level `editor` object with `editor.componentOverrides` and `editor.layout`.
103
109
  - Top-level `editor` object.
@@ -159,6 +165,7 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
159
165
  </LightningComponentBundle>
160
166
  ```
161
167
  7. **Deploy and validate**
168
+ - Run a final schema sanity check before deploy: valid `lightning:type` names, required fields present, and no disallowed keywords.
162
169
  - Deploy the bundle using your org's standard metadata deployment flow (e.g. Salesforce CLI or IDE). The MCP client or tooling in use should provide or integrate with the appropriate deploy/retrieve commands for Lightning Type bundles.
163
170
  - Validate incrementally: if deployment fails, remove disallowed keywords first (especially `examples`, `items`, nested `lightning:type`).
164
171
 
@@ -166,7 +173,9 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
166
173
  | Error / Symptom | Likely Cause | Fix |
167
174
  |---|---|---|
168
175
  | Schema validation fails due to unknown keyword | `unevaluatedProperties: false` + disallowed keyword (commonly `examples`, `items`) | Remove the offending keyword; keep schema minimal |
169
- | Nested object validation failure | Nested object includes `lightning:type: lightning__objectType` | Remove `lightning:type` from nested objects |
176
+ | Nested object validation failure | Org/channel validation rejects nested object typing in `LightningTypeBundle` | Use CLT reference (`c__<CLTName>`) or Apex class types |
177
+ | Invalid CLT reference | Referenced CLT doesn't exist in org or incorrect syntax | Deploy the referenced CLT first; `c__<CLTName>` must match the referenced type’s **`lightning:type` value / FQN / registered identifier**, not `title` |
178
+ | Invalid or misspelled `lightning:type` (for example, `lightning__richtextType` instead of `lightning__richTextType`) | Incorrect generated type name | Cross-check all `lightning:type` values against supported type names and correct them before deployment |
170
179
  | Array property rejected | Use of `items` (or `lightning:type` in nested arrays) rejected by validator | For nested arrays: keep only `type: "array"`. For root arrays: use minimal structure; remove `items` if rejected |
171
180
  | Apex-based CLT rejected | Extra fields added (e.g., `type`, `properties`) | Use only `title`, optional `description`, and `lightning:type` |
172
181
  | Editor config rejected | Use of invalid patterns (`es_property_editors/inputList`, `itemSchema`) or unrecognized top-level keys | Use `editor.componentOverrides` and `editor.layout`; keep config minimal |
@@ -99,8 +99,8 @@ fi
99
99
  Read the `.agent` file and verify it has proper Agent Script structure:
100
100
  - `system:` block with `instructions:`
101
101
  - `config:` block with `developer_name:`
102
- - `start_agent` or `topic` blocks with `reasoning: instructions:`
103
- - Each topic should have distinct `instructions:` content (not identical across topics)
102
+ - `start_agent` or `subagent` blocks with `reasoning: instructions:`
103
+ - Each subagent should have distinct `instructions:` content (not identical across subagents)
104
104
 
105
105
  Store the resolved path as `AGENT_FILE` for Phase 3.
106
106
 
@@ -187,7 +187,7 @@ sf agent test results --json --job-id "$JOB_ID" --result-format json -o <org>
187
187
 
188
188
  ### 1-ALT.2 Derive test utterances from .agent file (if no test suite)
189
189
 
190
- If no test suite exists, derive utterances: one per non-entry topic (from `description:` keywords), one per key action, one guardrail test, one multi-turn test.
190
+ If no test suite exists, derive utterances: one per non-entry subagent (from `description:` keywords), one per key action, one guardrail test, one multi-turn test.
191
191
 
192
192
  ### 1-ALT.3 Preview with `--authoring-bundle` (local traces)
193
193
 
@@ -209,13 +209,13 @@ sf agent preview end --json --session-id "$SESSION_ID" --authoring-bundle <Bundl
209
209
 
210
210
  | Issue type | Trace command |
211
211
  |---|---|
212
- | Topic misroute | `jq -r '.plan[] \| select(.type=="NodeEntryStateStep") \| .data.agent_name' "$TRACE"` |
212
+ | Subagent misroute | `jq -r '.plan[] \| select(.type=="NodeEntryStateStep") \| .data.agent_name' "$TRACE"` |
213
213
  | Action not called | `jq -r '.plan[] \| select(.type=="EnabledToolsStep") \| .data.enabled_tools[]' "$TRACE"` |
214
214
  | LOW adherence | `jq -r '.plan[] \| select(.type=="ReasoningStep") \| {category, reason}' "$TRACE"` |
215
215
  | Variable capture fail | `jq -r '.plan[] \| select(.type=="VariableUpdateStep") \| .data.variable_updates[]' "$TRACE"` |
216
216
  | Vague instructions | `jq -r '.plan[] \| select(.type=="LLMStep") \| .data.messages_sent[0].content' "$TRACE"` |
217
217
 
218
- **DefaultTopic trace quirk:** With `--authoring-bundle`, the root `.topic` field often shows `"DefaultTopic"` even when routing works. Always use `NodeEntryStateStep.data.agent_name` for the real topic chain.
218
+ **DefaultTopic trace quirk:** With `--authoring-bundle`, the root `.topic` field often shows `"DefaultTopic"` even when routing works. Always use `NodeEntryStateStep.data.agent_name` for the real subagent chain.
219
219
 
220
220
  **Entry answering directly (SMALL_TALK pattern):** If `start_agent` trace shows `SMALL_TALK` grounding and transition tools visible but none invoked, add "You are a router only. Do NOT answer questions directly." to `start_agent` instructions.
221
221
 
@@ -271,7 +271,7 @@ Render turn-by-turn timeline from `ConversationData` JSON for each session.
271
271
 
272
272
  > Full issue pattern table and classification categories: see `references/issue-classification.md`
273
273
 
274
- Check each session for: action errors, topic misroutes, missing actions, wrong inputs, variable capture failures, no transitions, slow actions, LOW adherence, abandoned sessions, dead topics, publish drift, dead hub anti-pattern, entry answering directly, and safety issues.
274
+ Check each session for: action errors, subagent misroutes, missing actions, wrong inputs, variable capture failures, no transitions, slow actions, LOW adherence, abandoned sessions, dead subagents, publish drift, dead hub anti-pattern, entry answering directly, and safety issues.
275
275
 
276
276
  Priority: P1 = action errors, misroutes, LOW adherence; P2 = missing actions, variable bugs, knowledge gaps; P3 = performance, abandoned sessions.
277
277
 
@@ -281,7 +281,7 @@ Present sessions analyzed, issues grouped by root cause category, and uplift est
281
281
 
282
282
  > Full structural analysis checks, cross-reference procedures, and publish drift detection: see `references/issue-classification.md`
283
283
 
284
- Retrieve the `.agent` file from the org, run automated checks (topic count vs action blocks, dead hub detection, orphan actions, cross-topic variable dependencies), and cross-reference STDM symptoms against the file structure.
284
+ Retrieve the `.agent` file from the org, run automated checks (subagent count vs action blocks, dead hub detection, orphan actions, cross-subagent variable dependencies), and cross-reference STDM symptoms against the file structure.
285
285
 
286
286
  ---
287
287
 
@@ -325,7 +325,7 @@ Map each confirmed issue to a fix location in the `.agent` file (description, in
325
325
 
326
326
  ### 3.4 Regression prevention
327
327
 
328
- Establish baseline before editing. Make minimal edits. Test immediately after each edit. One fix per publish cycle. Check cross-topic dependencies. Test adjacent topics.
328
+ Establish baseline before editing. Make minimal edits. Test immediately after each edit. One fix per publish cycle. Check cross-subagent dependencies. Test adjacent subagents.
329
329
 
330
330
  ### 3.5 Apply fixes
331
331
 
@@ -80,7 +80,7 @@ public with sharing class AgentforceOptimizeService {
80
80
  */
81
81
  public class TurnData {
82
82
  public String interaction_id;
83
- /** Topic API name — null/mismatch signals a misroute (P1) */
83
+ /** Subagent API name (stored as `topic` in STDM) — null/mismatch signals a misroute (P1) */
84
84
  public String topic;
85
85
  public String start_time;
86
86
  public String end_time;
@@ -1142,7 +1142,7 @@ public with sharing class AgentforceOptimizeService {
1142
1142
  @InvocableVariable(label='Agent API Name' required=false)
1143
1143
  public String agentApiName;
1144
1144
 
1145
- @InvocableVariable(label='Topic API Name' required=false)
1145
+ @InvocableVariable(label='Subagent API Name' required=false)
1146
1146
  public String topicApiName;
1147
1147
 
1148
1148
  @InvocableVariable(label='Lookback Days' required=false)
@@ -68,17 +68,17 @@ variables:
68
68
 
69
69
  start_agent: entry_topic
70
70
 
71
- topic entry_topic:
72
- label: "Entry Topic"
73
- description: "Routes users to specialized topics"
71
+ subagent entry_topic:
72
+ label: "Entry Subagent"
73
+ description: "Routes users to specialized subagents"
74
74
 
75
75
  reasoning:
76
76
  instructions: ->
77
77
  | Welcome the user warmly.
78
78
  | Ask how you can help today.
79
79
  actions:
80
- go_to_orders: @utils.transition to @topic.orders
81
- description: "Route to orders topic"
80
+ go_to_orders: @utils.transition to @subagent.orders
81
+ description: "Route to orders subagent"
82
82
  check_order: @actions.get_order_status
83
83
  description: "Look up order details"
84
84
  with order_id = @variables.order_id
@@ -86,10 +86,10 @@ topic entry_topic:
86
86
  ```
87
87
 
88
88
  **Critical mapping to Salesforce metadata:**
89
- - `topic.description` -> `GenAiPluginDefinition.Description` (topic routing signal)
90
- - `topic.reasoning.instructions` -> `GenAiPluginInstructionDef.Instruction` (verbatim LLM prompt text)
89
+ - `subagent.description` -> `GenAiPluginDefinition.Description` (subagent routing signal)
90
+ - `subagent.reasoning.instructions` -> `GenAiPluginInstructionDef.Instruction` (verbatim LLM prompt text)
91
91
  - `system.instructions` -> `GenAiPlannerDefinition.Description` (agent-level system prompt)
92
- - `reasoning.actions` with `@utils.transition` -> topic transitions
92
+ - `reasoning.actions` with `@utils.transition` -> subagent transitions
93
93
  - `reasoning.actions` with `@actions.*` -> action invocations with `with` (input) and `set` (output) bindings
94
94
 
95
95
  ---
@@ -98,17 +98,17 @@ topic entry_topic:
98
98
 
99
99
  | Root cause category | STDM signal | Fix target in .agent file | What to change |
100
100
  |---|---|---|---|
101
- | `Agent Configuration Gap` | Topic misroute | `topic <name>: description:` | Tighten description to exclude overlapping intents |
102
- | `Agent Configuration Gap` | Action not called | `topic <name>: reasoning: actions:` and `reasoning: instructions:` | Add action definition under `actions:` and mention it in `instructions:` |
101
+ | `Agent Configuration Gap` | Subagent misroute | `subagent <name>: description:` | Tighten description to exclude overlapping intents |
102
+ | `Agent Configuration Gap` | Action not called | `subagent <name>: reasoning: actions:` and `reasoning: instructions:` | Add action definition under `actions:` and mention it in `instructions:` |
103
103
  | `Agent Configuration Gap` | Wrong action input / error | `reasoning: actions: <action>: with` | Correct `with` bindings or action `target:` URI |
104
104
  | `Agent Configuration Gap` | Variable not captured | `reasoning: actions: <action>: set` | Add `set @variables.myVar = @outputs.field` binding |
105
- | `Agent Configuration Gap` | No post-action transition | `reasoning: actions:` | Add `@utils.transition to @topic.<next_topic>` action |
106
- | `Agent Configuration Gap` | LOW adherence / vague instructions | `topic <name>: reasoning: instructions:` | Rewrite using instruction principles below |
107
- | `Agent Configuration Gap` | Identical instructions across topics | All `topic: reasoning: instructions:` blocks | Give each topic distinct, actionable instructions |
108
- | `Knowledge Gap -- Infrastructure` | Knowledge question answered generically | Add knowledge action definition to the relevant topic | Define action with `retriever://` target |
105
+ | `Agent Configuration Gap` | No post-action transition | `reasoning: actions:` | Add `@utils.transition to @subagent.<next_subagent>` action |
106
+ | `Agent Configuration Gap` | LOW adherence / vague instructions | `subagent <name>: reasoning: instructions:` | Rewrite using instruction principles below |
107
+ | `Agent Configuration Gap` | Identical instructions across subagents | All `subagent: reasoning: instructions:` blocks | Give each subagent distinct, actionable instructions |
108
+ | `Knowledge Gap -- Infrastructure` | Knowledge question answered generically | Add knowledge action definition to the relevant subagent | Define action with `retriever://` target |
109
109
  | `Knowledge Gap -- Content` | Knowledge question -- wrong/missing answer | N/A (org data issue) | Add missing articles to knowledge space |
110
110
  | `Platform / Runtime Issue` | Action timeout / latency > 10s | Flow or Apex class (not .agent) | Optimize query/processing logic |
111
- | `Agent Configuration Gap` | Dead hub anti-pattern | Entire intermediate topic block | Move transitions to `start_agent > reasoning > actions:`, delete dead hub topic |
111
+ | `Agent Configuration Gap` | Dead hub anti-pattern | Entire intermediate subagent block | Move transitions to `start_agent > reasoning > actions:`, delete dead hub subagent |
112
112
 
113
113
  **Target resolution checklist:**
114
114
 
@@ -121,20 +121,20 @@ topic entry_topic:
121
121
 
122
122
  ---
123
123
 
124
- ## Principles for Effective Topic Instructions
124
+ ## Principles for Effective Subagent Instructions
125
125
 
126
- Good instructions are specific, imperative, and action-named. Poor instructions are persona descriptions or generic guidance reused across topics.
126
+ Good instructions are specific, imperative, and action-named. Poor instructions are persona descriptions or generic guidance reused across subagents.
127
127
 
128
128
  1. **Name the action explicitly** -- "Use `@actions.schedule_test_drive` to book the appointment" not "help the user book"
129
129
  2. **State the pre-condition** -- "Only handle scheduling after the customer's name and email have been collected"
130
130
  3. **State what to do after** -- "After scheduling completes, confirm the date/time and transition to follow_up"
131
- 4. **Scope tightly** -- "This topic handles test drive scheduling only. For vehicle specs or pricing, do not answer -- the user should be routed to general_support"
132
- 5. **Keep persona out of instructions** -- persona belongs in `system: instructions:` (agent-level), not per-topic reasoning instructions
133
- 6. **One responsibility per topic** -- if the instruction covers 3 distinct tasks, split into 3 topics
131
+ 4. **Scope tightly** -- "This subagent handles test drive scheduling only. For vehicle specs or pricing, do not answer -- the user should be routed to general_support"
132
+ 5. **Keep persona out of instructions** -- persona belongs in `system: instructions:` (agent-level), not per-subagent reasoning instructions
133
+ 6. **One responsibility per subagent** -- if the instruction covers 3 distinct tasks, split into 3 subagents
134
134
 
135
135
  **Before / after example** (identical instructions -> distinct instructions):
136
136
 
137
- *Before (generic persona text, same across all topics):*
137
+ *Before (generic persona text, same across all subagents):*
138
138
  ```
139
139
  reasoning:
140
140
  instructions: |
@@ -142,7 +142,7 @@ reasoning:
142
142
  help them with their needs, and guide them toward scheduling a test drive.
143
143
  ```
144
144
 
145
- *After (for `identity_collection` topic specifically):*
145
+ *After (for `identity_collection` subagent specifically):*
146
146
  ```
147
147
  reasoning:
148
148
  instructions: ->
@@ -154,7 +154,7 @@ reasoning:
154
154
  description: "Capture customer contact details"
155
155
  set @variables.customer_name = @outputs.name
156
156
  set @variables.customer_email = @outputs.email
157
- proceed: @utils.transition to @topic.schedule_test_drive
157
+ proceed: @utils.transition to @subagent.schedule_test_drive
158
158
  description: "Move to test drive scheduling after info collected"
159
159
  available when @variables.customer_name != ""
160
160
  ```
@@ -163,7 +163,7 @@ reasoning:
163
163
 
164
164
  ## Regression Prevention
165
165
 
166
- When editing topic instructions, follow these principles:
166
+ When editing subagent instructions, follow these principles:
167
167
 
168
168
  1. **Establish a baseline BEFORE editing** -- Run the test utterance 3 times before making changes. Record the pass rate.
169
169
 
@@ -172,35 +172,35 @@ When editing topic instructions, follow these principles:
172
172
  3. **Avoid instruction expansion** -- Adding more text to instructions does NOT always help. Prefer:
173
173
  - Adding a single action reference: "Use `@actions.X` to look up..."
174
174
  - Adding a single constraint: "Do not proceed until the customer provides..."
175
- - Adding a single routing directive: "After completing, transition to @topic.Y"
175
+ - Adding a single routing directive: "After completing, transition to @subagent.Y"
176
176
 
177
177
  4. **Test immediately after each edit** -- Run the same test utterances. If pass rate drops, revert the change immediately.
178
178
 
179
179
  5. **One fix per publish cycle** -- Do not batch multiple instruction changes into a single publish.
180
180
 
181
- 6. **Check cross-topic dependencies before editing** -- Before changing Topic A, identify variable dependencies, transition chains, and shared variable mutations:
181
+ 6. **Check cross-subagent dependencies before editing** -- Before changing Subagent A, identify variable dependencies, transition chains, and shared variable mutations:
182
182
  ```bash
183
183
  grep -n 'set @variables\.' "$AGENT_FILE"
184
184
  grep -n 'with .* = @variables\.' "$AGENT_FILE"
185
- grep -n '@utils.transition to @topic\.' "$AGENT_FILE"
185
+ grep -n '@utils.transition to @subagent\.' "$AGENT_FILE"
186
186
  ```
187
187
 
188
- 7. **Test adjacent topics after each fix** -- Include at least one cross-topic test to confirm the fix didn't cause spillover routing.
188
+ 7. **Test adjacent subagents after each fix** -- Include at least one cross-subagent test to confirm the fix didn't cause spillover routing.
189
189
 
190
- 8. **Verify start_agent routing after topic removal** -- If removing a dead hub or merging topics, verify `start_agent > reasoning > actions:` still has transition actions to all remaining topics.
190
+ 8. **Verify start_agent routing after subagent removal** -- If removing a dead hub or merging subagents, verify `start_agent > reasoning > actions:` still has transition actions to all remaining subagents.
191
191
 
192
192
  ---
193
193
 
194
194
  ## Apply Fixes
195
195
 
196
- **Step 1 -- Read the current .agent file** using the Read tool. Locate the specific `topic` block that needs changes.
196
+ **Step 1 -- Read the current .agent file** using the Read tool. Locate the specific `subagent` block that needs changes.
197
197
 
198
198
  **Step 2 -- Edit the .agent file directly** using the Edit tool. Edit only the specific lines that need to change. Common edit patterns:
199
199
 
200
- - **Topic description** (for misroute fixes): Change `description:` text
201
- - **Topic instructions** (for LOW adherence): Replace `reasoning: instructions:` block
200
+ - **Subagent description** (for misroute fixes): Change `description:` text
201
+ - **Subagent instructions** (for LOW adherence): Replace `reasoning: instructions:` block
202
202
  - **Adding an action**: Add definition under `reasoning: actions:`
203
- - **Adding a transition**: Add `@utils.transition to @topic.<name>` action
203
+ - **Adding a transition**: Add `@utils.transition to @subagent.<name>` action
204
204
  - **Adding an `available when` guard**: Add guard condition to action definition
205
205
 
206
206
  IMPORTANT: Agent Script uses **tabs** for indentation, not spaces.
@@ -238,7 +238,7 @@ sf project deploy start --json --metadata "AiAuthoringBundle:<AGENT_API_NAME>" -
238
238
  sf agent activate --json --api-name <AGENT_API_NAME> -o <org>
239
239
  ```
240
240
 
241
- > **Warning: deploy + activate is an incomplete fallback.** `sf project deploy start` stores the bundle metadata but does **NOT** propagate topic-level `reasoning: actions:` blocks to live `GenAiPluginDefinition` records. Always verify with `--authoring-bundle` preview.
241
+ > **Warning: deploy + activate is an incomplete fallback.** `sf project deploy start` stores the bundle metadata but does **NOT** propagate subagent-level `reasoning: actions:` blocks to live `GenAiPluginDefinition` records. Always verify with `--authoring-bundle` preview.
242
242
 
243
243
  **Never use the Tooling API to patch `GenAiPluginInstructionDef` or other BPO objects directly.**
244
244
 
@@ -266,7 +266,7 @@ sf agent preview end --json --session-id "$SESSION_ID" --authoring-bundle <Bundl
266
266
 
267
267
  **Trace-based verification checklist:**
268
268
  ```bash
269
- # 1. Correct topic routing
269
+ # 1. Correct subagent routing
270
270
  jq -r '.topic' "$TRACE"
271
271
  # 2. Grounding passed (no UNGROUNDED)
272
272
  jq -r '.plan[] | select(.type == "ReasoningStep") | .category' "$TRACE"
@@ -282,7 +282,7 @@ jq -r '.plan[] | select(.type == "VariableUpdateStep") | .data.variable_updates[
282
282
 
283
283
  | Metric | What to look for after fix |
284
284
  |---|---|
285
- | Topics seen in STDM | Dead topics should now appear in session data |
285
+ | Subagents seen in STDM | Dead subagents should now appear in session data |
286
286
  | `TRUST_GUARDRAILS_STEP` value | `LOW` occurrences should drop or disappear |
287
287
  | Action invocation per turn | Actions should now fire for the intents they cover |
288
288
  | `action_error_count` | Should not increase (regression check) |
@@ -295,7 +295,7 @@ jq -r '.plan[] | select(.type == "VariableUpdateStep") | .data.variable_updates[
295
295
  After applying fixes, re-run safety review on the modified `.agent` file. Optimization fixes can inadvertently introduce safety regressions:
296
296
 
297
297
  - Relaxing `available when` guards may expose actions that should be gated
298
- - Expanding topic descriptions may cause the agent to handle out-of-scope requests
298
+ - Expanding subagent descriptions may cause the agent to handle out-of-scope requests
299
299
  - Changing instructions to be more permissive may weaken guardrails
300
300
  - Adding literal instructions with tool names may bypass safety boundaries
301
301
 
@@ -304,7 +304,7 @@ After applying fixes, re-run safety review on the modified `.agent` file. Optimi
304
304
  1. **Scope boundaries** -- Did the fix widen the agent's scope beyond what's appropriate?
305
305
  2. **Guard conditions** -- Did relaxing `available when` expose sensitive actions?
306
306
  3. **Instruction safety** -- Do new/modified instructions maintain appropriate guardrails?
307
- 4. **Escalation paths** -- Are escalation paths still intact after topic restructuring?
307
+ 4. **Escalation paths** -- Are escalation paths still intact after subagent restructuring?
308
308
 
309
309
  **If any new BLOCK finding is introduced by the fix:** revert and find an alternative fix. Do NOT deploy an agent with new safety violations.
310
310
 
@@ -322,12 +322,12 @@ subjectName: <AgentApiName>
322
322
 
323
323
  testCases:
324
324
  - utterance: "<exact utterance from Phase 2 scenario>"
325
- expectedTopic: <topic_that_should_handle_this>
325
+ expectedTopic: <subagent_that_should_handle_this>
326
326
  expectedActions:
327
327
  - <action_that_should_fire>
328
328
 
329
329
  - utterance: "<another failing utterance>"
330
- expectedTopic: <expected_topic>
330
+ expectedTopic: <expected_subagent>
331
331
  expectedOutcome: "Agent should <expected behavior description>"
332
332
  ```
333
333