@salesforce/afv-skills 1.1.0 → 1.2.0

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 (103) hide show
  1. package/package.json +4 -4
  2. package/skills/agentforce-development/SKILL.md +427 -0
  3. package/skills/agentforce-development/assets/README-legacy.md +89 -0
  4. package/skills/agentforce-development/assets/agent-spec-template.md +90 -0
  5. package/skills/agentforce-development/assets/agents/README.md +45 -0
  6. package/skills/agentforce-development/assets/agents/hello-world.agent +60 -0
  7. package/skills/agentforce-development/assets/agents/multi-topic.agent +105 -0
  8. package/skills/agentforce-development/assets/agents/production-faq.agent +101 -0
  9. package/skills/agentforce-development/assets/agents/production-faq.bundle-meta.xml +4 -0
  10. package/skills/agentforce-development/assets/agents/simple-qa.agent +72 -0
  11. package/skills/agentforce-development/assets/apex/models-api-queueable.cls +225 -0
  12. package/skills/agentforce-development/assets/bundle-meta.xml +23 -0
  13. package/skills/agentforce-development/assets/components/apex-action.agent +52 -0
  14. package/skills/agentforce-development/assets/components/error-handling.agent +58 -0
  15. package/skills/agentforce-development/assets/components/escalation-setup.agent +169 -0
  16. package/skills/agentforce-development/assets/components/flow-action.agent +66 -0
  17. package/skills/agentforce-development/assets/components/n-ary-conditions.agent +110 -0
  18. package/skills/agentforce-development/assets/components/topic-with-actions.agent +40 -0
  19. package/skills/agentforce-development/assets/deterministic-routing.agent +166 -0
  20. package/skills/agentforce-development/assets/escalation-pattern.agent +209 -0
  21. package/skills/agentforce-development/assets/flow-action-lookup.agent +115 -0
  22. package/skills/agentforce-development/assets/hub-and-spoke.agent +104 -0
  23. package/skills/agentforce-development/assets/invocable-apex-template.cls +187 -0
  24. package/skills/agentforce-development/assets/local-info-agent-annotated.agent +355 -0
  25. package/skills/agentforce-development/assets/metadata/basic-prompt-template.promptTemplate-meta.xml +109 -0
  26. package/skills/agentforce-development/assets/metadata/genai-function-apex.xml +92 -0
  27. package/skills/agentforce-development/assets/metadata/genai-function-flow.xml +57 -0
  28. package/skills/agentforce-development/assets/metadata/genai-plugin.xml +72 -0
  29. package/skills/agentforce-development/assets/metadata/http-callout-flow.flow-meta.xml +348 -0
  30. package/skills/agentforce-development/assets/metadata/record-grounded-prompt.promptTemplate-meta.xml +136 -0
  31. package/skills/agentforce-development/assets/minimal-starter.agent +42 -0
  32. package/skills/agentforce-development/assets/patterns/README.md +254 -0
  33. package/skills/agentforce-development/assets/patterns/action-callbacks.agent +178 -0
  34. package/skills/agentforce-development/assets/patterns/advanced-input-bindings.agent +141 -0
  35. package/skills/agentforce-development/assets/patterns/bidirectional-routing.agent +156 -0
  36. package/skills/agentforce-development/assets/patterns/critical-input-collection.agent +244 -0
  37. package/skills/agentforce-development/assets/patterns/delegation-routing.agent +89 -0
  38. package/skills/agentforce-development/assets/patterns/lifecycle-events.agent +127 -0
  39. package/skills/agentforce-development/assets/patterns/llm-controlled-actions.agent +184 -0
  40. package/skills/agentforce-development/assets/patterns/multi-step-workflow.agent +282 -0
  41. package/skills/agentforce-development/assets/patterns/open-gate-routing.agent +286 -0
  42. package/skills/agentforce-development/assets/patterns/procedural-instructions.agent +273 -0
  43. package/skills/agentforce-development/assets/patterns/prompt-template-action.agent +188 -0
  44. package/skills/agentforce-development/assets/patterns/system-instruction-overrides.agent +293 -0
  45. package/skills/agentforce-development/assets/prompt-rag-search.agent +131 -0
  46. package/skills/agentforce-development/assets/template-multi-topic.agent +160 -0
  47. package/skills/agentforce-development/assets/template-single-topic.agent +81 -0
  48. package/skills/agentforce-development/assets/verification-gate.agent +208 -0
  49. package/skills/agentforce-development/references/action-prompt-templates.md +164 -0
  50. package/skills/agentforce-development/references/actions-reference.md +592 -0
  51. package/skills/agentforce-development/references/agent-access-guide.md +72 -0
  52. package/skills/agentforce-development/references/agent-design-and-spec-creation.md +1010 -0
  53. package/skills/agentforce-development/references/agent-metadata-and-lifecycle.md +575 -0
  54. package/skills/agentforce-development/references/agent-script-core-language.md +1218 -0
  55. package/skills/agentforce-development/references/agent-topic-map-diagrams.md +323 -0
  56. package/skills/agentforce-development/references/agent-user-setup.md +526 -0
  57. package/skills/agentforce-development/references/agent-validation-and-debugging.md +803 -0
  58. package/skills/agentforce-development/references/known-issues.md +353 -0
  59. package/skills/agentforce-development/references/minimal-examples.md +67 -0
  60. package/skills/agentforce-development/references/production-gotchas.md +279 -0
  61. package/skills/agentforce-development/references/salesforce-cli-for-agents.md +393 -0
  62. package/skills/agentforce-development/references/version-history.md +23 -0
  63. package/skills/generate-permission-set/SKILL.md +174 -0
  64. package/skills/salesforce-custom-application/SKILL.md +1 -2
  65. package/skills/salesforce-custom-field/SKILL.md +0 -4
  66. package/skills/salesforce-custom-tab/SKILL.md +84 -8
  67. package/skills/salesforce-experience-lwr-site/SKILL.md +196 -0
  68. package/skills/salesforce-experience-lwr-site/docs/bootstrap-template-byo-lwr.md +224 -0
  69. package/skills/salesforce-experience-lwr-site/docs/configure-content-brandingSet.md +131 -0
  70. package/skills/salesforce-experience-lwr-site/docs/configure-content-route.md +232 -0
  71. package/skills/salesforce-experience-lwr-site/docs/configure-content-themeLayout.md +141 -0
  72. package/skills/salesforce-experience-lwr-site/docs/configure-content-view.md +233 -0
  73. package/skills/salesforce-experience-lwr-site/docs/configure-guest-sharing-rules.md +42 -0
  74. package/skills/salesforce-experience-lwr-site/docs/handle-component-and-region-ids.md +27 -0
  75. package/skills/salesforce-experience-lwr-site/docs/handle-ui-components.md +215 -0
  76. package/skills/salesforce-flow/SKILL.md +2 -2
  77. package/skills/salesforce-fragment/SKILL.md +85 -10
  78. package/skills/salesforce-lightning-app-build/SKILL.md +102 -10
  79. package/skills/apex-class/SKILL.md +0 -253
  80. package/skills/apex-class/examples/AccountDeduplicationBatch.cls +0 -148
  81. package/skills/apex-class/examples/AccountSelector.cls +0 -193
  82. package/skills/apex-class/examples/AccountService.cls +0 -201
  83. package/skills/apex-class/templates/abstract.cls +0 -128
  84. package/skills/apex-class/templates/batch.cls +0 -125
  85. package/skills/apex-class/templates/domain.cls +0 -102
  86. package/skills/apex-class/templates/dto.cls +0 -108
  87. package/skills/apex-class/templates/exception.cls +0 -51
  88. package/skills/apex-class/templates/interface.cls +0 -25
  89. package/skills/apex-class/templates/queueable.cls +0 -92
  90. package/skills/apex-class/templates/schedulable.cls +0 -75
  91. package/skills/apex-class/templates/selector.cls +0 -92
  92. package/skills/apex-class/templates/service.cls +0 -69
  93. package/skills/apex-class/templates/utility.cls +0 -97
  94. package/skills/apex-test-class/SKILL.md +0 -101
  95. package/skills/apex-test-class/references/assertion-patterns.md +0 -209
  96. package/skills/apex-test-class/references/async-testing.md +0 -276
  97. package/skills/apex-test-class/references/mocking-patterns.md +0 -219
  98. package/skills/apex-test-class/references/test-data-factory.md +0 -176
  99. package/skills/deployment-readiness-check/SKILL.md +0 -257
  100. package/skills/deployment-readiness-check/assets/deployment_checklist.md +0 -286
  101. package/skills/deployment-readiness-check/references/rollback_procedures.md +0 -308
  102. package/skills/deployment-readiness-check/scripts/check_metadata.sh +0 -207
  103. package/skills/salesforce-experience-site/SKILL.md +0 -178
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/afv-skills",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Salesforce skills for Agentforce Vibes",
5
5
  "license": "CC-BY-NC-4.0",
6
6
  "files": [
@@ -11,9 +11,9 @@
11
11
  "registry": "https://registry.npmjs.org"
12
12
  },
13
13
  "devDependencies": {
14
- "tsx": "^4.21.0",
15
- "@salesforce/webapp-template-app-react-sample-b2e-experimental": "*",
16
- "@salesforce/webapp-template-app-react-sample-b2x-experimental": "*"
14
+ "@salesforce/webapp-template-app-react-sample-b2e-experimental": "^1.107.0",
15
+ "@salesforce/webapp-template-app-react-sample-b2x-experimental": "^1.107.0",
16
+ "tsx": "^4.21.0"
17
17
  },
18
18
  "scripts": {
19
19
  "validate:skills": "tsx scripts/validate-skills.ts",
@@ -0,0 +1,427 @@
1
+ ---
2
+ name: agentforce-development
3
+ description: "Use this skill when working with Salesforce Agent Script — the scripting language for authoring Agentforce agents using the Atlas Reasoning Engine. Triggers include: creating, modifying, or comprehending Agent Script agents; working with AiAuthoringBundle files or .agent files; designing topic graphs or flow control; producing or updating an Agent Spec; validating Agent Script or diagnosing compilation errors; previewing agents or debugging behavioral issues; deploying, publishing, activating, or deactivating agents; deleting or renaming agents; authoring AiEvaluationDefinition test specs or running agent tests. This skill teaches Agent Script from scratch — AI models have zero prior training data on this language. Do NOT use for Apex development, Flow building, Prompt Template authoring, Experience Cloud configuration, or general Salesforce CLI tasks unrelated to Agent Script."
4
+ license: Apache-2.0
5
+ compatibility: "Requires Agentforce license, API v66.0+, Einstein Agent User"
6
+ metadata:
7
+ version: "0.4.8"
8
+ last_updated: "2026-03-17"
9
+ ---
10
+
11
+ # Agent Script Skill
12
+
13
+ ## What This Skill Is For
14
+
15
+ Agent Script is Salesforce's scripting language for authoring next-generation AI agents on the Atlas Reasoning Engine. Introduced in 2025 with zero training data in any AI model. Everything needed to write, modify, diagnose, or deploy Agent Script agents is in this skill's reference files.
16
+
17
+ **⚠️CRITICAL:** Agent Script is NOT AppleScript, JavaScript, Python, or any other
18
+ language. Do NOT confuse Agent Script syntax or semantics with any other
19
+ language you have been trained on.
20
+
21
+ Agent Script agents are defined by `AiAuthoringBundle` metadata — a directory with a `.agent` file containing Agent Script source that describes topics, actions, instructions, flow control, and configuration; and a `bundle-meta.xml` file containing bundle metadata. Agents process utterances by routing through topics, each with instructions and actions backed by Apex, Flows, Prompt Templates, and other types of backing logic.
22
+
23
+ This skill covers the full Agent Script lifecycle: designing agents,
24
+ writing Agent Script code, validating and debugging, deploying and
25
+ publishing, and testing.
26
+
27
+ ## How to Use This Skill
28
+
29
+ This file maps user intent to task domains and relevant reference files in `references/`. Detailed knowledge includes syntax rules, design patterns, CLI commands, debugging workflows, and more.
30
+
31
+ Identify user intent from task descriptions. ALWAYS read indicated reference files BEFORE starting work.
32
+
33
+ ## Rules That Always Apply
34
+
35
+ 1. **Always `--json`.** ALWAYS include `--json` on EVERY `sf` CLI command.
36
+
37
+ 2. **Diagnose before you fix.** When validating/debugging agent behavior,
38
+ ALWAYS `--use-live-actions` to preview authoring bundles. Send utterances
39
+ then read resulting session traces to ground your understanding of the
40
+ agent's behavior. Trace files reveal topic selection, action I/O, and
41
+ LLM reasoning. DO NOT modify `.agent` files or backing logic without
42
+ this grounding. See [Validation & Debugging](references/agent-validation-and-debugging.md)
43
+ for trace file locations and diagnostic patterns.
44
+
45
+ 3. **Spec approval is a hard gate.** Never proceed past Agent Spec
46
+ creation without explicit user approval.
47
+
48
+ ## Task Domains
49
+
50
+ Every task domain below has **Required Steps**. Follow verbatim, in order. Do not substitute your own plan or skip steps.
51
+
52
+ ### Create an Agent
53
+
54
+ User wants to build new agent from scratch. ALWAYS use Agent Script. Work with User to understand the agent's purpose, topics, and actions using plain language without Salesforce-specific terminology.
55
+
56
+ #### Required Steps
57
+
58
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
59
+
60
+ 1. **Design** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) to draft an Agent Spec. Always ask if you should scan for existing backing logic. Unless instructed otherwise, scan by reading `sfdx-project.json` to identify package directories, then search each for `@InvocableMethod` in `classes/`, `AutoLaunchedFlow` in `flows/`, and template metadata in `promptTemplates/`. Mark matches `EXISTS`; unmatched actions `NEEDS STUB`. **Always save Agent Spec as file.**
61
+ 2. **STOP for user approval of Agent Spec.** Present to user. Ask for approval or feedback. **Do not proceed** without approval. Once approved, proceed without stopping unless a step fails.
62
+ 3. **Validate environment prerequisites** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md), Section 3 (Environment Prerequisites). Based on agent type from design, validate org environment:
63
+ - **Employee agent**: Confirm config block does NOT include `default_agent_user`. Remove if present.
64
+ - **Service agent**: Query org for Einstein Agent User. If one exists, confirm username with user. If none, guide user through creation. See [CLI for Agents](references/salesforce-cli-for-agents.md), Section 12 for creation steps and [Agent User Setup](references/agent-user-setup.md) for required permissions.
65
+ **Do not proceed to code generation until environment is validated.**
66
+ 4. **Generate authoring bundle** —
67
+ `sf agent generate authoring-bundle --json --no-spec --name "<Label>" --api-name <Developer_Name>`
68
+ 5. **Write code** — Read [Core Language](references/agent-script-core-language.md) for syntax, block structure, and anti-patterns. Edit generated `.agent` file using reference files and templates. Do not create `.agent` or `bundle-meta.xml` files manually.
69
+ 6. **Validate compilation** —
70
+ `sf agent validate authoring-bundle --json --api-name <Developer_Name>`
71
+ If validation fails, read [Validation & Debugging](references/agent-validation-and-debugging.md) to diagnose and fix, then re-validate. ALWAYS fix syntax and structural errors before generating backing logic.
72
+ 7. **Generate backing logic** — For each action marked NEEDS STUB:
73
+ `sf template generate apex class --name <ClassName> --output-dir <PACKAGE_DIR>/main/default/classes`
74
+ Replace class body with invocable pattern from [Design & Agent Spec](references/agent-design-and-spec-creation.md). ALWAYS deploy:
75
+ `sf project deploy start --json --metadata ApexClass:<ClassName>`
76
+ ALWAYS fix deploy errors BEFORE generating and deploying next stub.
77
+ 8. **Validate behavior** — Read [Validation & Debugging](references/agent-validation-and-debugging.md) for preview workflow and session trace analysis.
78
+ `sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
79
+ If actions query data, ground test utterances with:
80
+ `sf data query --json -q "SELECT <Relevant_Fields> FROM <SObject> LIMIT 100"`
81
+ Send test utterances with:
82
+ `sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
83
+ Confirm topic routing, gating, and action invocations match Agent Spec. If behavior diverges, switch to **Diagnose Behavioral Issues** workflow. Return AFTER correcting issues.
84
+ 9. **Publish** — **DO NOT proceed until step 8 passes.** Publish validates metadata structure, not agent behavior. ALWAYS validate behavior before publishing. Every publish creates permanent version number.
85
+ `sf agent publish authoring-bundle --json --api-name <Developer_Name>`
86
+ If publish fails, follow troubleshooting checklist in [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md), Section 5 before retrying.
87
+ 10. **Activate** — Makes new version available to users.
88
+ `sf agent activate --json --api-name <Developer_Name>`
89
+ 11. **Verify published agent** — Preview user-facing behavior AFTER activation with
90
+ `sf agent preview start --json --api-name <Developer_Name>`
91
+ Use `--api-name`, not `--authoring-bundle`.
92
+ 12. **Configure end-user access** — ONLY for employee agents. Read [Agent Access Guide](references/agent-access-guide.md) to configure perms and assign access.
93
+
94
+ #### Reference Files
95
+
96
+ 1. [CLI for Agents](references/salesforce-cli-for-agents.md) — exact
97
+ command syntax for generate, validate, deploy, publish, activate;
98
+ Section 12 for Einstein Agent User creation
99
+ 2. [Core Language](references/agent-script-core-language.md) — execution
100
+ model, syntax, block structure, anti-patterns
101
+ 3. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
102
+ topic graph design, flow control patterns, Agent Spec production,
103
+ backing logic analysis; Section 3 for environment prerequisites
104
+ 4. [Topic Map Diagrams](references/agent-topic-map-diagrams.md) —
105
+ Mermaid diagram conventions for visualizing the agent's topic graph
106
+ 5. [Agent User Setup & Permissions](references/agent-user-setup.md) —
107
+ permission set assignment, object permissions, cross-topic validation
108
+ 6. [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) —
109
+ directory structure, bundle metadata; publish troubleshooting
110
+ 7. [Validation & Debugging](references/agent-validation-and-debugging.md) —
111
+ validate the agent compiles, preview to confirm behavior
112
+ 8. [Agent Access Guide](references/agent-access-guide.md) — end-user
113
+ access permissions, visibility troubleshooting
114
+ 9. [Known Issues](references/known-issues.md) — only load when errors
115
+ persist after code fixes
116
+
117
+ ### Comprehend an Existing Agent
118
+
119
+ User wants to understand Agent Script agent they didn't write or need to revisit. May point to `AiAuthoringBundle` directory or ask "what does this agent do?" or "I need to fix this agent but I don't understand how it works.".
120
+
121
+ #### Required Steps
122
+
123
+ 1. **Locate agent** — Read `sfdx-project.json` to identify package directories. Find `AiAuthoringBundle` directory within them. Read `.agent` file and `bundle-meta.xml`.
124
+ 2. **Read code** — Read [Core Language](references/agent-script-core-language.md) for syntax and execution model BEFORE parsing `.agent` file.
125
+ 3. **Map backing logic** — For each action with `target`, locate backing implementation (Apex class, Flow, Prompt Template) in project. Note input/output contracts.
126
+ 4. **Reverse-engineer Agent Spec** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) for Agent Spec structure. Produce Agent Spec from code and save as file.
127
+ 5. **Produce Topic Map diagram** — Read [Topic Map Diagrams](references/agent-topic-map-diagrams.md) for Mermaid conventions. Generate flowchart of topic graph showing transitions, gates, and action associations.
128
+ 6. **Annotate source** — Ask if user wants Agent Script source annotated with explanations. If requested, add inline comments to `.agent` file explaining flow control decisions, gating rationale, and topic relationships.
129
+ 7. **Present to user** — Share Agent Spec, Topic Map, and annotated source if produced. Check Anti-Patterns section in Core Language reference and flag any matches found in code.
130
+
131
+ #### Reference Files
132
+
133
+ 1. [Core Language](references/agent-script-core-language.md) — syntax,
134
+ execution model, anti-patterns
135
+ 2. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
136
+ Agent Spec structure, flow control pattern recognition
137
+ 3. [Topic Map Diagrams](references/agent-topic-map-diagrams.md) —
138
+ Mermaid conventions for topic graph visualization
139
+ 4. [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) —
140
+ directory conventions, bundle metadata
141
+ 5. [Known Issues](references/known-issues.md) — only load when code
142
+ contains unexplained workaround patterns
143
+
144
+ ### Modify an Existing Agent
145
+
146
+ User wants to add, remove, or change topics, actions, instructions, or flow control on existing agent. May describe change in plain language ("add a billing topic") or reference specific Agent Script constructs.
147
+
148
+ #### Required Steps
149
+
150
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
151
+
152
+ 1. **Comprehend** — If no Agent Spec exists, reverse-engineer first by following "Comprehend an Existing Agent" workflow above.
153
+ 2. **Update Agent Spec** — Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) for flow control patterns and backing logic analysis. Modify Agent Spec to reflect intended changes. For new actions, always ask if you should scan for existing backing logic. Unless instructed otherwise, scan by reading `sfdx-project.json` to identify package directories, then search each for `@InvocableMethod` in `classes/`, `AutoLaunchedFlow` in `flows/`, and template metadata in `promptTemplates/`. Mark matches `EXISTS`; unmatched actions `NEEDS STUB`. **Always save updated Agent Spec as file.**
154
+ 3. **STOP for user approval of updated Agent Spec.** Present to user. Ask for approval or feedback. **Do not proceed** without approval. Once approved, proceed without stopping unless a step fails.
155
+ 4. **Edit code** — Read [Core Language](references/agent-script-core-language.md) for syntax and anti-patterns. Edit `.agent` file to implement approved changes.
156
+ 5. **Validate compilation** —
157
+ `sf agent validate authoring-bundle --json --api-name <Developer_Name>`
158
+ If validation fails, read [Validation & Debugging](references/agent-validation-and-debugging.md) to diagnose and fix, then re-validate.
159
+ 6. **Generate new backing logic** — For each new action marked NEEDS STUB:
160
+ `sf template generate apex class --name <ClassName> --output-dir <PACKAGE_DIR>/main/default/classes`
161
+ Replace class body with invocable pattern from [Design & Agent Spec](references/agent-design-and-spec-creation.md). ALWAYS deploy:
162
+ `sf project deploy start --json --metadata ApexClass:<ClassName>`
163
+ ALWAYS fix deploy errors BEFORE generating and deploying next stub. Skip if no new actions added.
164
+ 7. **Validate behavior** — Read [Validation & Debugging](references/agent-validation-and-debugging.md) for preview workflow and session trace analysis.
165
+ `sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
166
+ If actions query data, ground test utterances with:
167
+ `sf data query --json -q "SELECT <Relevant_Fields> FROM <SObject> LIMIT 100"`
168
+ Send test utterances with:
169
+ `sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
170
+ Test changed paths first, then adjacent paths to catch regressions in existing behavior.
171
+ 8. **Publish** — **DO NOT proceed until step 7 passes.** Publish validates metadata structure, not agent behavior. ALWAYS validate behavior before publishing. Every publish creates permanent version number.
172
+ `sf agent publish authoring-bundle --json --api-name <Developer_Name>`
173
+ If publish fails, follow troubleshooting checklist in [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md), Section 5 before retrying.
174
+ 9. **Activate** — Makes new version available to users.
175
+ `sf agent activate --json --api-name <Developer_Name>`
176
+ 10. **Verify published agent** — Preview user-facing behavior AFTER activation with
177
+ `sf agent preview start --json --api-name <Developer_Name>`
178
+ Use `--api-name`, not `--authoring-bundle`.
179
+
180
+ #### Reference Files
181
+
182
+ 1. [CLI for Agents](references/salesforce-cli-for-agents.md) — exact
183
+ command syntax for validate, deploy, preview, publish, activate
184
+ 2. [Core Language](references/agent-script-core-language.md) — syntax,
185
+ anti-patterns
186
+ 3. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
187
+ Agent Spec updates, backing logic analysis
188
+ 4. [Validation & Debugging](references/agent-validation-and-debugging.md) —
189
+ compilation diagnosis, preview workflow, session trace analysis
190
+ 5. [Known Issues](references/known-issues.md) — only load when errors
191
+ persist after code fixes
192
+
193
+ ### Diagnose Compilation Errors
194
+
195
+ User has Agent Script that won't compile. Errors surface from `sf agent validate` or `sf agent preview start`, or User describes symptoms like "I'm getting a validation error."
196
+
197
+ #### Required Steps
198
+
199
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
200
+
201
+ 1. **Reproduce error** — Run
202
+ `sf agent validate authoring-bundle --json --api-name <Developer_Name>`
203
+ to capture basic compile errors. If no errors, run
204
+ `sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
205
+ to capture complex compile errors. If user provides specific error output, ALWAYS reproduce to confirm.
206
+ 2. **Classify error** — Read [Validation & Debugging](references/agent-validation-and-debugging.md) for error taxonomy. Map each error message to root cause category.
207
+ 3. **Locate fault** — Read [Core Language](references/agent-script-core-language.md) to understand correct syntax. Find specific line(s) in `.agent` file that cause each error.
208
+ 4. **Fix code** — Apply targeted fixes. Check Anti-Patterns section in Core Language reference to ensure you're not introducing known bad pattern.
209
+ 5. **Re-validate** — Run
210
+ `sf agent validate authoring-bundle --json --api-name <Developer_Name>`
211
+ then run
212
+ `sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
213
+ Repeat steps 2–5 if errors persist.
214
+ 6. **Explain fix** — Tell user what was wrong and what you changed. Explain root cause in terms of *Core Language* agent execution model.
215
+
216
+ #### Reference Files
217
+
218
+ 1. [Core Language](references/agent-script-core-language.md) — syntax,
219
+ block structure, anti-patterns
220
+ 2. [Validation & Debugging](references/agent-validation-and-debugging.md) —
221
+ error taxonomy, error-to-root-cause mapping
222
+ 3. [Known Issues](references/known-issues.md) — only load when error
223
+ doesn't match user code; may be a platform bug
224
+ 4. [Production Gotchas](references/production-gotchas.md) — only load
225
+ when error involves reserved keywords or lifecycle hook syntax
226
+
227
+ ### Diagnose Behavioral Issues
228
+
229
+ Agent compiles, preview can start and `--use-live-actions`, but agent does not behave as expected. User describes symptoms like "the agent keeps going to the wrong topic" or "the action isn't being called." Fundamentally different from `validate` or `preview start` errors — code is valid but behavior is wrong.
230
+
231
+ #### Required Steps
232
+
233
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
234
+
235
+ 1. **Establish baseline** — Read Agent Spec. If no Agent Spec exists, follow *Comprehend an Existing Agent* workflow to reverse-engineer one, then continue.
236
+ 2. **Form hypotheses** — Read [Core Language](references/agent-script-core-language.md) for execution model. Based on user's description, list candidate root causes. Think through: topic routing, gating conditions, action availability, instruction clarity, variable state, and transition timing.
237
+ 3. **Reproduce in preview** — Read [Validation & Debugging](references/agent-validation-and-debugging.md) for preview workflow and session trace analysis. Start preview session:
238
+ `sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
239
+ then send test messages covering EACH topic with `sf agent preview send`. One message is not enough — confirm behavior per topic before proceeding.
240
+ 4. **Analyze session traces** — Examine trace output to confirm topic selection, action availability/execution, LLM reasoning, and where behavior diverges from Agent Spec. Do NOT skip this step — preview output alone is insufficient for diagnosis.
241
+ 5. **Identify root cause** — Match trace evidence to hypotheses. Consult *Core Language reference and Gating Patterns* in [Design & Agent Spec](references/agent-design-and-spec-creation.md) reference to confirm absence of anti-patterns.
242
+ 6. **Fix code** — Apply targeted fix. If fix involves flow control changes, update Agent Spec to match.
243
+ 7. **Re-validate and re-preview** — Repeat steps 3–6 until behavior matches Agent Spec or you confirm a platform limitation. Run `validate authoring-bundle`, then `preview start --use-live-actions` to verify fix using same utterances. Then test adjacent paths that might be affected by your changes.
244
+ 8. **Explain fix** — Tell user what was wrong and what you changed. Explain root cause in terms of *Core Language* agent execution model.
245
+
246
+ #### Reference Files
247
+
248
+ 1. [Core Language](references/agent-script-core-language.md) — execution
249
+ model, anti-patterns
250
+ 2. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
251
+ Agent Spec as behavioral baseline, gating patterns
252
+ 3. [Validation & Debugging](references/agent-validation-and-debugging.md) —
253
+ preview workflow, session trace analysis
254
+ 4. [Known Issues](references/known-issues.md) — only load when behavior
255
+ is wrong but code logic is correct
256
+
257
+ ### Deploy, Publish, and Activate
258
+
259
+ User wants to take working agent from local development to running state in Salesforce org. Involves deploying `AiAuthoringBundle` and its dependencies, publishing to commit version, then activating to make it live.
260
+
261
+ #### Required Steps
262
+
263
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
264
+
265
+ 1. **Validate compilation** —
266
+ `sf agent validate authoring-bundle --json --api-name <Developer_Name>`
267
+ Do not proceed if validation fails.
268
+ 2. **Deploy bundle and dependencies** — Read [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) for dependency management and deploy commands. Deploy `AiAuthoringBundle` and all backing logic (Apex classes, Flows, Prompt Templates) and dependencies to org.
269
+ 3. **Live preview** — Read [Validation & Debugging](references/agent-validation-and-debugging.md) for preview workflow and session trace analysis.
270
+ `sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
271
+ then send test utterances with:
272
+ `sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
273
+ Test key conversation paths to validate agent behavior when backed by live actions. **Do not proceed to Publish until preview passes.**
274
+ 4. **Publish** — **Publish validates metadata structure, not agent behavior.** ALWAYS validate behavior with live preview BEFORE publishing. DO NOT publish as part of a dev/test inner loop. ONLY publish as the FINAL step prior to activating the agent and surfacing it to end users.
275
+ `sf agent publish authoring-bundle --json --api-name <Developer_Name>`
276
+ If publish fails, follow *Troubleshooting Publish Failures* in [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) before retrying.
277
+ 5. **Activate** — Makes new version available to users.
278
+ `sf agent activate --json --api-name <Developer_Name>`
279
+ 6. **Verify published agent** — Preview user-facing behavior AFTER activation with
280
+ `sf agent preview start --json --api-name <Developer_Name>`
281
+ Use `--api-name`, not `--authoring-bundle`.
282
+ 7. **Configure end-user access** — ONLY for employee agents. Read [Agent Access Guide](references/agent-access-guide.md) to configure perms and assign access.
283
+
284
+ #### Reference Files
285
+
286
+ 1. [CLI for Agents](references/salesforce-cli-for-agents.md) — exact
287
+ command syntax for deploy, publish, activate, deactivate
288
+ 2. [Validation & Debugging](references/agent-validation-and-debugging.md) —
289
+ compilation validation, preview workflow
290
+ 3. [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) —
291
+ dependency management, deploy commands; publish troubleshooting
292
+ 4. [Agent Access Guide](references/agent-access-guide.md) — end-user
293
+ access permissions, visibility troubleshooting
294
+ 5. [Known Issues](references/known-issues.md) — only load when deploy
295
+ hangs, publish fails, or activate fails unexpectedly
296
+
297
+ ### Diagnose Production Issues
298
+
299
+ User's agent is published and active but experiencing issues not caught during preview. Includes credit overconsumption, token or size limit failures, loop guardrail interruptions, reserved keyword runtime errors, VS Code sync failures, or unexpected behavioral differences between preview and production.
300
+
301
+ #### Required Steps
302
+
303
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
304
+
305
+ 1. **Classify issue** — Determine whether this is billing/cost concern, runtime limit, naming conflict, tooling issue, or behavioral difference between preview and production.
306
+ 2. **Check known production gotchas** — Read [Production Gotchas](references/production-gotchas.md) for credit consumption, token limits, loop guardrails, reserved keywords, lifecycle hooks, and VS Code workarounds.
307
+ 3. **Compare preview vs production behavior** — If issue is behavioral, preview published agent with
308
+ `sf agent preview start --json --api-name <Developer_Name>`
309
+ (not `--authoring-bundle`). Compare against live-actions authoring bundle preview `--authoring-bundle <Developer_Name> --use-live-actions` to isolate preview-vs-production differences.
310
+ 4. **Check known issues** — Read [Known Issues](references/known-issues.md) for platform bugs that may explain production-only failures.
311
+ 5. **Fix and republish** — Apply fixes, validate, re-preview, publish, activate, verify. Follow Deploy, Publish, and Activate steps.
312
+ 6. **Explain diagnosis** — Tell user what was happening and what you changed. Explain root cause.
313
+
314
+ #### Reference Files
315
+
316
+ 1. [Production Gotchas](references/production-gotchas.md) — credit
317
+ consumption, token limits, loop guardrails, reserved keywords,
318
+ lifecycle hooks, VS Code workarounds
319
+ 2. [CLI for Agents](references/salesforce-cli-for-agents.md) — command
320
+ syntax for preview, publish, activate
321
+ 3. [Validation & Debugging](references/agent-validation-and-debugging.md) —
322
+ preview workflow, session trace analysis
323
+ 4. [Known Issues](references/known-issues.md) — only load when issue may
324
+ be a platform bug
325
+
326
+ ### Delete or Rename an Agent
327
+
328
+ User wants to remove agent or change its name. Maintenance tasks complicated by `AiAuthoringBundle` versioning and published version dependencies.
329
+
330
+ #### Required Steps
331
+
332
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
333
+
334
+ 1. **Understand current state** — Read [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) for versioning, delete mechanics, and rename mechanics. Identify whether agent has been published, how many versions exist, and whether it's currently active.
335
+ 2. **Deactivate if active** —
336
+ `sf agent deactivate --json --api-name <Developer_Name>`
337
+ Active agent cannot be deleted or renamed.
338
+ 3. **Execute operation** — For delete: follow delete mechanics in Metadata & Lifecycle reference. For rename: follow rename mechanics in same reference.
339
+ 4. **Clean up orphans** — Check for and remove orphaned metadata: Bot, BotVersion, GenAiPlannerBundle, GenAiPlugin, GenAiFunction. Metadata & Lifecycle reference details what to look for.
340
+ 5. **Validate** — Confirm operation completed cleanly. For rename, validate new bundle compiles and preview to confirm behavior.
341
+
342
+ #### Reference Files
343
+
344
+ 1. [CLI for Agents](references/salesforce-cli-for-agents.md) — exact
345
+ command syntax for delete, deactivate, retrieve
346
+ 2. [Validation & Debugging](references/agent-validation-and-debugging.md) —
347
+ compilation validation, preview workflow
348
+ 3. [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) —
349
+ delete mechanics, rename mechanics, orphan cleanup
350
+
351
+ ### Test an Agent
352
+
353
+ User wants to create automated tests for Agent Script agent. Involves writing `AiEvaluationDefinition` test specs in YAML format that define test scenarios, expected behaviors, and quality metrics.
354
+
355
+ #### Required Steps
356
+
357
+ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
358
+
359
+ 1. **Establish coverage baseline** — Read Agent Spec. If no Agent Spec exists, reverse-engineer first by following Comprehend steps. Map every topic, action, and flow control path to identify what needs test coverage.
360
+ 2. **Design test scenarios** — For test design methodology, expectations, metrics, test spec YAML format, and templates, use **agentforce-testing** skill. That skill owns all testing content. For each coverage target, write one or more test scenarios: user utterance, expected topic routing, expected action invocations, and expected agent response. Include both happy paths and edge cases.
361
+ 3. **Write test spec YAML** — Use template and reference files from **agentforce-testing** skill. Save to `specs/<Agent_API_Name>-testSpec.yaml` in SFDX project.
362
+ 4. **Create test metadata** — Generate `AiEvaluationDefinition` from test spec using CLI.
363
+ 5. **Deploy test** — Deploy `AiEvaluationDefinition` to org.
364
+ 6. **Run tests** — Execute test run using CLI. Capture results.
365
+ 7. **Analyze results** — Compare actual outcomes against expectations. For failures, identify whether issue is in agent code, backing logic, or test spec itself.
366
+ 8. **Iterate** — Fix agent code or test spec as needed, redeploy, and re-run until coverage targets are met.
367
+
368
+ #### Reference Files
369
+
370
+ 1. [CLI for Agents](references/salesforce-cli-for-agents.md) — exact
371
+ command syntax for test create, test run, test results
372
+ 2. [Core Language](references/agent-script-core-language.md) — agent
373
+ structure for designing meaningful tests
374
+ 3. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
375
+ Agent Spec as test coverage baseline
376
+ 4. **agentforce-testing** skill — test spec YAML format, expectations,
377
+ metrics, test design methodology, and test spec template
378
+
379
+ ## The Agent Spec
380
+
381
+ **Agent Spec** is the central artifact this skill produces and consumes. A structured design document representing agent's purpose, topic graph, actions with backing logic, variables, gating logic, and behavioral intent.
382
+
383
+ Agent Specs evolve with the agent. Sparse during agent creation (purpose, topics, directional notes). Fleshed out during agent build (flowchart, backing logic mapped, gating documented). Reverse-engineered when comprehending existing agents. Critical for advanced troubleshooting, providing reference to compare expected vs. actual behavior. During testing, test coverage maps against it.
384
+
385
+ Always produce or update Agent Spec as first step of any operation that changes or analyzes agent. It is consistent grounding to work from, and a durable artifact a developer can review.
386
+
387
+ Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) for Agent Spec structure and production methodology.
388
+
389
+ ## Assets
390
+
391
+ The `assets/` directory contains templates and examples. Read when you need a starting point or a concrete reference for artifacts and source files.
392
+
393
+ - **`assets/agent-spec-template.md`** — Agent Spec template with all sections and placeholder content. Copy to `<AgentName>-AgentSpec.md` in project directory, then fill in during design. Save Agent Spec as file — significant design artifact that benefits from proper rendering, especially Mermaid Topic Map diagram.
394
+
395
+ - **`assets/local-info-agent-annotated.agent`** — Complete annotated example based on Local Info Agent, showing all major Agent Script constructs in context with inline comments explaining why each construct is used. Read when you need concrete reference for how concepts compose into working agent, or as fallback when focused examples in reference files aren't sufficient.
396
+
397
+ - **`assets/template-single-topic.agent`** — Minimal agent with one topic. Copy and modify for simple agents.
398
+
399
+ - **`assets/template-multi-topic.agent`** — Minimal agent with multiple topics and transitions. Copy and modify for complex agents.
400
+
401
+ - **`assets/invocable-apex-template.cls`** — Reference for invocable Apex
402
+ classes. Copy and modify when complex Apex backing logic is desired.
403
+
404
+ ## Important Constraints
405
+
406
+ - **Use only Salesforce CLI and Salesforce org.** Do not reference or depend on other skills, MCP servers, or external tooling. All commands use `sf` (Salesforce CLI).
407
+
408
+ - **Only certain backing logic types are valid for actions.** For example, only invocable Apex (not arbitrary Apex classes) can back action. Similar constraints may apply to Flows and Prompt Templates. When wiring actions to backing logic, consult Design & Agent Spec reference file for valid types and stubbing methodology.
409
+
410
+ - **`sf agent generate test-spec` is not for agentic use.** It is interactive, REPL-style command designed for humans. When creating test specs, start from boilerplate template in assets instead.
411
+
412
+ ## Common Issues Quick Reference
413
+
414
+ **`Internal Error, try again later` during publish:**
415
+ Invalid or missing `default_agent_user`. Re-run query from [Design & Agent Spec](references/agent-design-and-spec-creation.md), Section 3. Do not invent username.
416
+
417
+ **`Unable to access Salesforce Agent APIs...` during preview:**
418
+ `default_agent_user` lacks permissions. See [Agent User Setup & Permissions](references/agent-user-setup.md). Do NOT publish as fix — `--use-live-actions` does not require published agent.
419
+
420
+ **Permission error referencing different username than configured:**
421
+ Same fix as above — error references org's default running user, but root cause is Einstein Agent User permissions.
422
+
423
+ **Agent fails with permission error even though current topic's actions work:**
424
+ Planner validates ALL actions across ALL topics at startup. One missing permission fails entire agent.
425
+
426
+ **Apex action returns empty results in live preview but works in simulated:**
427
+ `WITH USER_MODE` + missing object permissions = silent failure (0 rows, no error). See [Agent User Setup & Permissions](references/agent-user-setup.md), Section 6.2.
@@ -0,0 +1,89 @@
1
+ # Agent Script Templates
2
+
3
+ Organized templates for building Agentforce agents.
4
+
5
+ ---
6
+
7
+ ## Directory Structure
8
+
9
+ ```
10
+ assets/
11
+ ├── agents/ Complete, deployable agent examples
12
+ ├── components/ Reusable action and topic snippets
13
+ ├── patterns/ Advanced patterns (lifecycle, callbacks)
14
+ └── metadata/ XML metadata templates
15
+ ```
16
+
17
+ ---
18
+
19
+ ## Quick Start
20
+
21
+ ```
22
+ What do you need?
23
+
24
+ ├─► "Just starting"
25
+ │ └─► agents/hello-world.agent
26
+
27
+ ├─► "Complete agent with topics"
28
+ │ └─► agents/multi-topic.agent
29
+
30
+ ├─► "Add actions to my agent"
31
+ │ ├─► components/flow-action.agent
32
+ │ └─► components/apex-action.agent
33
+
34
+ ├─► "Advanced patterns"
35
+ │ └─► patterns/ (see patterns/README.md)
36
+
37
+ └─► "XML metadata"
38
+ └─► metadata/
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Template Inventory
44
+
45
+ ### agents/ - Complete Agents
46
+
47
+ | Template | Complexity | Description |
48
+ |----------|------------|-------------|
49
+ | `hello-world.agent` | Beginner | Minimal viable agent |
50
+ | `simple-qa.agent` | Beginner | Single-topic Q&A |
51
+ | `multi-topic.agent` | Intermediate | Multi-topic routing |
52
+ | `production-faq.agent` | Advanced | Production-ready with escalation |
53
+
54
+ ### components/ - Reusable Parts
55
+
56
+ | Template | Purpose |
57
+ |----------|---------|
58
+ | `flow-action.agent` | Flow action integration |
59
+ | `apex-action.agent` | Apex action integration |
60
+ | `topic-with-actions.agent` | Topic with actions |
61
+ | `error-handling.agent` | Input validation |
62
+ | `escalation-setup.agent` | Human handoff |
63
+
64
+ ### patterns/ - Advanced (see patterns/README.md)
65
+
66
+ | Template | Purpose | Deployment |
67
+ |----------|---------|------------|
68
+ | `lifecycle-events.agent` | before/after reasoning | GenAiPlannerBundle |
69
+ | `action-callbacks.agent` | Deterministic chains | GenAiPlannerBundle |
70
+ | `bidirectional-routing.agent` | Topic routing with return | Both |
71
+ | `system-instruction-overrides.agent` | Topic-level personas | Both |
72
+ | *(6 more patterns)* | | |
73
+
74
+ ### metadata/ - XML Templates
75
+
76
+ | Template | Purpose |
77
+ |----------|---------|
78
+ | `bundle-meta.xml` | AiAuthoringBundle metadata |
79
+ | `genai-function-*.xml` | Action metadata |
80
+ | `genai-plugin.xml` | Plugin grouping |
81
+ | `*-prompt-template.xml` | PromptTemplate |
82
+ | `http-callout-flow.xml` | Flow template |
83
+
84
+ ---
85
+
86
+ ## Related Documentation
87
+
88
+ - [SKILL.md](../SKILL.md) - Main skill reference
89
+ - [references/](../references/) - Detailed documentation
@@ -0,0 +1,90 @@
1
+ # Agent Spec: Agent_API_Name
2
+
3
+ ## Purpose & Scope
4
+
5
+ Describe the agent's purpose in 1-2 sentences. What does it help users do?
6
+ What domain does it operate in?
7
+
8
+ ## Behavioral Intent
9
+
10
+ Describe the key behavioral rules that govern the agent:
11
+ - What must the agent know before taking action?
12
+ - What backing logic types are used (Apex, Flow, Prompt Template)?
13
+ - What guardrails apply (off-topic handling, escalation)?
14
+ - What information persists across topic switches?
15
+
16
+ ## Topic Map
17
+
18
+ ```mermaid
19
+ %%{init: {'theme':'neutral'}}%%
20
+ graph TD
21
+ A[start_agent<br/>topic_selector]
22
+
23
+ A -->|description of routing condition| B[topic_name<br/>Topic]
24
+ A -->|unclear intent| C[ambiguous_question<br/>Topic]
25
+ A -->|out of scope| D[off_topic<br/>Topic]
26
+ A -->|needs escalation| E[escalation<br/>Topic]
27
+ ```
28
+
29
+ Expand the diagram to show actions, gating logic, and variable state changes
30
+ within each topic. See the Topic Map Diagrams reference for conventions.
31
+
32
+ ## Variables
33
+
34
+ - `variable_name` (mutable type = default) — What this variable tracks.
35
+ Set by: which action or utility. Read by: which topics for gating or
36
+ conditional instructions.
37
+
38
+ ## Actions & Backing Logic
39
+
40
+ ### action_name (topic_name topic)
41
+
42
+ - **Target:** `apex://ClassName` or `flow://FlowName` or `prompt://PromptTemplateName`
43
+ - **Backing Status:** EXISTS / NEEDS STUB / NEEDS IMPLEMENTATION
44
+
45
+ #### Inputs
46
+
47
+ | Name | Type | Required | Source |
48
+ |------|------|----------|--------|
49
+ | property_id | string | Yes | User input |
50
+ | max_results | integer | No | Defaults to 10 |
51
+
52
+ #### Outputs
53
+
54
+ | Name | Type | Visible to User? | Source | Notes |
55
+ |------|------|-------------------|--------|-------|
56
+ | property | object | Yes | `Property__c` | Complete property details |
57
+ | related_applications | list[object] | Yes | `Application__c` | Records for this property |
58
+ | active_listing | boolean | Yes | `Listing__c` | Listing status |
59
+ | hasData | boolean | No | Computed | Internal empty-result flag |
60
+
61
+ > **"Visible to User?"** maps to `filter_from_agent` in the `.agent` file: Yes → `filter_from_agent: False`, No → `filter_from_agent: True`.
62
+
63
+ #### Stubbing Requirement
64
+
65
+ If NEEDS STUB:
66
+
67
+ - Apex class name and inner class wrappers needed
68
+ - `complex_data_type_name` for each `object`/`list[object]` output
69
+ - Key queries or computation logic the stub must implement
70
+
71
+ Repeat for each action.
72
+
73
+ ## Gating Logic
74
+
75
+ - `action_name` visibility: `available when @variables.variable_name != ""`
76
+ — Rationale for why this gate exists.
77
+
78
+ List all gating conditions with their rationale.
79
+
80
+ ## Architecture Pattern
81
+
82
+ State the architecture pattern: hub-and-spoke, chain, hybrid, etc.
83
+ Describe the routing strategy and how topics relate to each other.
84
+
85
+ ## Agent Configuration
86
+
87
+ - **developer_name:** `Agent_API_Name`
88
+ - **agent_label:** `Agent Display Name`
89
+ - **agent_type:** `AgentforceEmployeeAgent` or `AgentforceServiceAgent` — state the reasoning based on prompt signals (e.g., "accessible by employees" → Employee, "customer-facing channel" → Service)
90
+ - **default_agent_user:** Required for `AgentforceServiceAgent`. Forbidden for `AgentforceEmployeeAgent`. If specified, MUST be **user name**. MUST NEVER be **user ID**. User MUST have `Einstein Agent` license.