@salesforce/afv-skills 1.7.3 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +1 -1
- package/skills/developing-agentforce/README.md +4 -4
- package/skills/developing-agentforce/SKILL.md +37 -37
- package/skills/developing-agentforce/assets/README-legacy.md +8 -8
- package/skills/developing-agentforce/assets/agent-spec-template.md +9 -9
- package/skills/developing-agentforce/assets/agents/README.md +4 -4
- package/skills/developing-agentforce/assets/agents/hello-world.agent +3 -3
- package/skills/developing-agentforce/assets/agents/{multi-topic.agent → multi-subagent.agent} +30 -30
- package/skills/developing-agentforce/assets/agents/order-service.agent +25 -25
- package/skills/developing-agentforce/assets/agents/production-faq.agent +12 -12
- package/skills/developing-agentforce/assets/agents/simple-qa.agent +8 -8
- package/skills/developing-agentforce/assets/agents/verification-gate.agent +19 -19
- package/skills/developing-agentforce/assets/components/apex-action.agent +3 -3
- package/skills/developing-agentforce/assets/components/error-handling.agent +7 -7
- package/skills/developing-agentforce/assets/components/escalation-setup.agent +11 -11
- package/skills/developing-agentforce/assets/components/flow-action.agent +5 -5
- package/skills/developing-agentforce/assets/components/n-ary-conditions.agent +11 -11
- package/skills/developing-agentforce/assets/components/{topic-with-actions.agent → subagent-with-actions.agent} +9 -9
- package/skills/developing-agentforce/assets/deterministic-routing.agent +19 -19
- package/skills/developing-agentforce/assets/escalation-pattern.agent +13 -13
- package/skills/developing-agentforce/assets/flow-action-lookup.agent +3 -3
- package/skills/developing-agentforce/assets/hub-and-spoke.agent +18 -18
- package/skills/developing-agentforce/assets/local-info-agent-annotated.agent +37 -37
- package/skills/developing-agentforce/assets/metadata/genai-function-apex.xml +3 -3
- package/skills/developing-agentforce/assets/metadata/genai-function-flow.xml +1 -1
- package/skills/developing-agentforce/assets/metadata/genai-plugin.xml +10 -10
- package/skills/developing-agentforce/assets/minimal-starter.agent +4 -4
- package/skills/developing-agentforce/assets/patterns/README.md +21 -21
- package/skills/developing-agentforce/assets/patterns/action-callbacks.agent +4 -4
- package/skills/developing-agentforce/assets/patterns/advanced-input-bindings.agent +1 -1
- package/skills/developing-agentforce/assets/patterns/bidirectional-routing.agent +25 -25
- package/skills/developing-agentforce/assets/patterns/critical-input-collection.agent +8 -8
- package/skills/developing-agentforce/assets/patterns/delegation-routing.agent +21 -21
- package/skills/developing-agentforce/assets/patterns/lifecycle-events.agent +8 -8
- package/skills/developing-agentforce/assets/patterns/llm-controlled-actions.agent +5 -5
- package/skills/developing-agentforce/assets/patterns/multi-step-workflow.agent +3 -3
- package/skills/developing-agentforce/assets/patterns/open-gate-routing.agent +59 -58
- package/skills/developing-agentforce/assets/patterns/procedural-instructions.agent +15 -15
- package/skills/developing-agentforce/assets/patterns/prompt-template-action.agent +8 -8
- package/skills/developing-agentforce/assets/patterns/system-instruction-overrides.agent +40 -40
- package/skills/developing-agentforce/assets/prompt-rag-search.agent +9 -9
- package/skills/developing-agentforce/assets/{template-multi-topic.agent → template-multi-subagent.agent} +25 -25
- package/skills/developing-agentforce/assets/{template-single-topic.agent → template-single-subagent.agent} +14 -14
- package/skills/developing-agentforce/assets/verification-gate.agent +16 -16
- package/skills/developing-agentforce/references/action-prompt-templates.md +1 -1
- package/skills/developing-agentforce/references/actions-reference.md +4 -4
- package/skills/developing-agentforce/references/agent-design-and-spec-creation.md +107 -107
- package/skills/developing-agentforce/references/agent-metadata-and-lifecycle.md +5 -5
- package/skills/developing-agentforce/references/agent-script-core-language.md +79 -79
- package/skills/developing-agentforce/references/{agent-topic-map-diagrams.md → agent-subagent-map-diagrams.md} +65 -65
- package/skills/developing-agentforce/references/agent-user-setup.md +2 -2
- package/skills/developing-agentforce/references/agent-validation-and-debugging.md +55 -55
- package/skills/developing-agentforce/references/architecture-patterns.md +33 -33
- package/skills/developing-agentforce/references/deploy-reference.md +1 -1
- package/skills/developing-agentforce/references/discover-reference.md +1 -1
- package/skills/developing-agentforce/references/examples.md +32 -32
- package/skills/developing-agentforce/references/feature-validity.md +3 -3
- package/skills/developing-agentforce/references/instruction-resolution.md +29 -29
- package/skills/developing-agentforce/references/known-issues.md +10 -10
- package/skills/developing-agentforce/references/minimal-examples.md +6 -6
- package/skills/developing-agentforce/references/production-gotchas.md +22 -22
- package/skills/developing-agentforce/references/safety-review-reference.md +2 -2
- package/skills/developing-agentforce/references/scoring-rubric.md +3 -3
- package/skills/developing-datacloud-code-extension/SKILL.md +321 -0
- package/skills/developing-datacloud-code-extension/references/README.md +193 -0
- package/skills/developing-datacloud-code-extension/references/quick-reference.md +269 -0
- package/skills/generating-permission-set/SKILL.md +1 -1
- package/skills/getting-datacloud-schema/SKILL.md +380 -0
- package/skills/getting-datacloud-schema/references/README.md +191 -0
- package/skills/getting-datacloud-schema/scripts/get_dlo_schema.py +244 -0
- package/skills/getting-datacloud-schema/scripts/get_dmo_schema.py +233 -0
- package/skills/observing-agentforce/SKILL.md +8 -8
- package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls +2 -2
- package/skills/observing-agentforce/references/improve-reference.md +40 -40
- package/skills/observing-agentforce/references/issue-classification.md +47 -47
- package/skills/observing-agentforce/references/reproduce-reference.md +7 -7
- package/skills/observing-agentforce/references/stdm-queries.md +7 -7
- package/skills/observing-agentforce/references/stdm-schema.md +2 -2
- package/skills/testing-agentforce/SKILL.md +9 -9
- package/skills/testing-agentforce/assets/basic-test-spec.yaml +4 -0
- package/skills/testing-agentforce/assets/guardrail-test-spec.yaml +4 -0
- package/skills/testing-agentforce/assets/standard-test-spec.yaml +8 -4
- package/skills/testing-agentforce/references/batch-testing.md +17 -17
- package/skills/testing-agentforce/references/preview-testing.md +25 -25
- package/skills/testing-agentforce/references/test-report-format.md +6 -6
- package/skills/trigger-refactor-pipeline/SKILL.md +0 -191
- package/skills/trigger-refactor-pipeline/assets/test_template.apex +0 -321
- package/skills/trigger-refactor-pipeline/references/handler_patterns.md +0 -442
- package/skills/trigger-refactor-pipeline/scripts/analyze_trigger.py +0 -258
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Salesforce Skills Library
|
|
2
2
|
|
|
3
3
|
This repository provides a curated collection of Salesforce agent skills for building applications. It includes skills for Agentforce agents, Lightning apps, Flow, Apex, SOQL, Lightning Web Components (LWC), UI bundles, objects and fields, permission sets, and related areas.
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ The skills are contributed by Salesforce and the broader community. It’s optim
|
|
|
7
7
|
## 🗂️ Structure
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
|
|
10
|
+
sf-skills/
|
|
11
11
|
├── skills/ # Directory-based executable workflows
|
|
12
12
|
│ ├── generating-apex/
|
|
13
13
|
│ ├── generating-custom-object/
|
|
@@ -26,7 +26,7 @@ afv-library/
|
|
|
26
26
|
| **Tool** | **Usage** |
|
|
27
27
|
|----------|-------------|
|
|
28
28
|
| **Agentforce Vibes** | Skills are auto-installed and auto-updated |
|
|
29
|
-
| **OpenCode, Claude Code, Codex, Cursor, [more](https://agentskills.io/)** | `npx skills add forcedotcom/
|
|
29
|
+
| **OpenCode, Claude Code, Codex, Cursor, [more](https://agentskills.io/)** | `npx skills add forcedotcom/sf-skills` |
|
|
30
30
|
|
|
31
31
|
## 📦 Samples
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -11,14 +11,14 @@ The skill covers the full Agent Script lifecycle:
|
|
|
11
11
|
| Domain | What It Handles |
|
|
12
12
|
|--------|----------------|
|
|
13
13
|
| Create an Agent | Agent Spec design, environment validation, bundle generation, code authoring |
|
|
14
|
-
| Modify an Agent |
|
|
14
|
+
| Modify an Agent | Subagent/action changes, instruction refinement, flow control updates |
|
|
15
15
|
| Create or Modify Backing Logic | Invocable Apex stubs, Flow wrappers, Prompt Templates |
|
|
16
16
|
| Deploy and Publish | Source deploy, agent activation, publishing to channels |
|
|
17
17
|
| Diagnose Compilation Errors | Compiler error interpretation, syntax fixes, metadata resolution |
|
|
18
|
-
| Diagnose Behavioral Issues | Trace-based debugging,
|
|
18
|
+
| Diagnose Behavioral Issues | Trace-based debugging, subagent routing, action I/O analysis |
|
|
19
19
|
| Diagnose Production Issues | Runtime failures, reserved keyword conflicts, deployment gotchas |
|
|
20
20
|
| Test an Agent | Utterance-based validation, preview with live actions, trace analysis |
|
|
21
|
-
| Generate Diagrams |
|
|
21
|
+
| Generate Diagrams | Subagent map visualizations, agent architecture diagrams |
|
|
22
22
|
|
|
23
23
|
## Skill Structure
|
|
24
24
|
|
|
@@ -35,7 +35,7 @@ developing-agentforce/
|
|
|
35
35
|
│ ├── agent-user-setup.md
|
|
36
36
|
│ ├── actions-reference.md
|
|
37
37
|
│ ├── action-prompt-templates.md
|
|
38
|
-
│ ├── agent-
|
|
38
|
+
│ ├── agent-subagent-map-diagrams.md
|
|
39
39
|
│ ├── minimal-examples.md
|
|
40
40
|
│ ├── known-issues.md
|
|
41
41
|
│ ├── production-gotchas.md
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: developing-agentforce
|
|
3
|
-
description: "Build, modify, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent
|
|
3
|
+
description: "Build, modify, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent actions, tools, subagents, or flow control; writes or reviews an Agent Spec; previews, debugs, deploys, publishes, or tests agents; uses Agent Script CLI commands (sf agent generate/preview/publish/test). DO NOT TRIGGER when: Apex development, Flow building, Prompt Template authoring, Experience Cloud configuration, or general Salesforce CLI tasks unrelated to Agent Script."
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
compatibility: "Requires Agentforce license, API v66.0+, Einstein Agent User"
|
|
6
6
|
metadata:
|
|
@@ -18,7 +18,7 @@ Agent Script is Salesforce's scripting language for authoring next-generation AI
|
|
|
18
18
|
language. Do NOT confuse Agent Script syntax or semantics with any other
|
|
19
19
|
language you have been trained on.
|
|
20
20
|
|
|
21
|
-
Agent Script agents are defined by `AiAuthoringBundle` metadata — a directory with a `.agent` file containing Agent Script source that describes
|
|
21
|
+
Agent Script agents are defined by `AiAuthoringBundle` metadata — a directory with a `.agent` file containing Agent Script source that describes actions, instructions, subagents, flow control, and configuration; and a `bundle-meta.xml` file containing bundle metadata. Agents process utterances by routing through subagents, each with instructions and actions backed by Apex, Flows, Prompt Templates, and other types of backing logic.
|
|
22
22
|
|
|
23
23
|
This skill covers the full Agent Script lifecycle: designing agents,
|
|
24
24
|
writing Agent Script code, validating and debugging, deploying and
|
|
@@ -39,7 +39,7 @@ Identify user intent from task descriptions. ALWAYS read indicated reference fil
|
|
|
39
39
|
3. **Diagnose before you fix.** When validating/debugging agent behavior,
|
|
40
40
|
ALWAYS `--use-live-actions` to preview authoring bundles. Send utterances
|
|
41
41
|
then read resulting session traces to ground your understanding of the
|
|
42
|
-
agent's behavior. Trace files reveal
|
|
42
|
+
agent's behavior. Trace files reveal subagent selection, action I/O, and
|
|
43
43
|
LLM reasoning. DO NOT modify `.agent` files or backing logic without
|
|
44
44
|
this grounding. See [Validation & Debugging](references/agent-validation-and-debugging.md)
|
|
45
45
|
for trace file locations and diagnostic patterns.
|
|
@@ -53,7 +53,7 @@ Every task domain below has **Required Steps**. Follow verbatim, in order. Do no
|
|
|
53
53
|
|
|
54
54
|
### Create an Agent
|
|
55
55
|
|
|
56
|
-
User wants to build new agent from scratch. ALWAYS use Agent Script. Work with User to understand the agent's purpose,
|
|
56
|
+
User wants to build new agent from scratch. ALWAYS use Agent Script. Work with User to understand the agent's purpose, subagents, and actions using plain language without Salesforce-specific terminology.
|
|
57
57
|
|
|
58
58
|
#### Required Steps
|
|
59
59
|
|
|
@@ -82,11 +82,11 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
82
82
|
`sf data query --json -q "SELECT <Relevant_Fields> FROM <SObject> LIMIT 100"`
|
|
83
83
|
Send test utterances with:
|
|
84
84
|
`sf agent preview send --json --authoring-bundle <Developer_Name> --session-id <ID> -u "<message>"`
|
|
85
|
-
Confirm
|
|
85
|
+
Confirm subagent routing, gating, and action invocations match Agent Spec. If behavior diverges, switch to **Diagnose Behavioral Issues** workflow. Return AFTER correcting issues.
|
|
86
86
|
**CHECKPOINT — Do NOT proceed to Publish unless ALL are true:**
|
|
87
87
|
- `validate authoring-bundle` passes with zero errors
|
|
88
|
-
- Live preview (`--use-live-actions`) tested with representative utterances per
|
|
89
|
-
- Traces confirm correct
|
|
88
|
+
- Live preview (`--use-live-actions`) tested with representative utterances per subagent
|
|
89
|
+
- Traces confirm correct subagent routing and action invocation
|
|
90
90
|
- User explicitly approves deployment
|
|
91
91
|
9. **Publish** — Publish validates metadata structure, not agent behavior. Every publish creates permanent version number.
|
|
92
92
|
`sf agent publish authoring-bundle --json --api-name <Developer_Name>`
|
|
@@ -106,12 +106,12 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
106
106
|
2. [Core Language](references/agent-script-core-language.md) — execution
|
|
107
107
|
model, syntax, block structure, anti-patterns
|
|
108
108
|
3. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
|
|
109
|
-
|
|
109
|
+
subagent graph design, flow control patterns, Agent Spec production,
|
|
110
110
|
backing logic analysis; Section 3 for environment prerequisites
|
|
111
|
-
4. [
|
|
112
|
-
Mermaid diagram conventions for visualizing the agent's
|
|
111
|
+
4. [Subagent Map Diagrams](references/agent-subagent-map-diagrams.md) —
|
|
112
|
+
Mermaid diagram conventions for visualizing the agent's subagent graph
|
|
113
113
|
5. [Agent User Setup & Permissions](references/agent-user-setup.md) —
|
|
114
|
-
permission set assignment, object permissions, cross-
|
|
114
|
+
permission set assignment, object permissions, cross-subagent validation
|
|
115
115
|
6. [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) —
|
|
116
116
|
directory structure, bundle metadata; publish troubleshooting
|
|
117
117
|
7. [Validation & Debugging](references/agent-validation-and-debugging.md) —
|
|
@@ -137,9 +137,9 @@ User wants to understand Agent Script agent they didn't write or need to revisit
|
|
|
137
137
|
2. **Read code** — Read [Core Language](references/agent-script-core-language.md) for syntax and execution model BEFORE parsing `.agent` file.
|
|
138
138
|
3. **Map backing logic** — For each action with `target`, locate backing implementation (Apex class, Flow, Prompt Template) in project. Note input/output contracts.
|
|
139
139
|
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.
|
|
140
|
-
5. **Produce
|
|
141
|
-
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
|
|
142
|
-
7. **Present to user** — Share Agent Spec,
|
|
140
|
+
5. **Produce Subagent Map diagram** — Read [Subagent Map Diagrams](references/agent-subagent-map-diagrams.md) for Mermaid conventions. Generate flowchart of subagent graph showing transitions, gates, and action associations.
|
|
141
|
+
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 subagent relationships.
|
|
142
|
+
7. **Present to user** — Share Agent Spec, Subagent Map, and annotated source if produced. Check Anti-Patterns section in Core Language reference and flag any matches found in code.
|
|
143
143
|
|
|
144
144
|
#### Reference Files
|
|
145
145
|
|
|
@@ -147,8 +147,8 @@ User wants to understand Agent Script agent they didn't write or need to revisit
|
|
|
147
147
|
execution model, anti-patterns
|
|
148
148
|
2. [Design & Agent Spec](references/agent-design-and-spec-creation.md) —
|
|
149
149
|
Agent Spec structure, flow control pattern recognition
|
|
150
|
-
3. [
|
|
151
|
-
Mermaid conventions for
|
|
150
|
+
3. [Subagent Map Diagrams](references/agent-subagent-map-diagrams.md) —
|
|
151
|
+
Mermaid conventions for subagent graph visualization
|
|
152
152
|
4. [Metadata & Lifecycle](references/agent-metadata-and-lifecycle.md) —
|
|
153
153
|
directory conventions, bundle metadata
|
|
154
154
|
5. [Known Issues](references/known-issues.md) — only load when code
|
|
@@ -156,7 +156,7 @@ User wants to understand Agent Script agent they didn't write or need to revisit
|
|
|
156
156
|
|
|
157
157
|
### Modify an Existing Agent
|
|
158
158
|
|
|
159
|
-
User wants to add, remove, or change
|
|
159
|
+
User wants to add, remove, or change subagents, actions, instructions, or flow control on existing agent. May describe change in plain language ("add a billing subagent") or reference specific Agent Script constructs.
|
|
160
160
|
|
|
161
161
|
#### Required Steps
|
|
162
162
|
|
|
@@ -183,8 +183,8 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
183
183
|
Test changed paths first, then adjacent paths to catch regressions in existing behavior.
|
|
184
184
|
**CHECKPOINT — Do NOT proceed to Publish unless ALL are true:**
|
|
185
185
|
- `validate authoring-bundle` passes with zero errors
|
|
186
|
-
- Live preview (`--use-live-actions`) tested with representative utterances per
|
|
187
|
-
- Traces confirm correct
|
|
186
|
+
- Live preview (`--use-live-actions`) tested with representative utterances per subagent
|
|
187
|
+
- Traces confirm correct subagent routing and action invocation
|
|
188
188
|
- User explicitly approves deployment
|
|
189
189
|
8. **Publish** — Publish validates metadata structure, not agent behavior. Every publish creates permanent version number.
|
|
190
190
|
`sf agent publish authoring-bundle --json --api-name <Developer_Name>`
|
|
@@ -244,18 +244,18 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
244
244
|
|
|
245
245
|
### Diagnose Behavioral Issues
|
|
246
246
|
|
|
247
|
-
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
|
|
247
|
+
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 subagent" or "the action isn't being called." Fundamentally different from `validate` or `preview start` errors — code is valid but behavior is wrong.
|
|
248
248
|
|
|
249
249
|
#### Required Steps
|
|
250
250
|
|
|
251
251
|
Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
|
|
252
252
|
|
|
253
253
|
1. **Establish baseline** — Read Agent Spec. If no Agent Spec exists, follow *Comprehend an Existing Agent* workflow to reverse-engineer one, then continue.
|
|
254
|
-
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:
|
|
254
|
+
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: subagent routing, gating conditions, action availability, instruction clarity, variable state, and transition timing.
|
|
255
255
|
3. **Reproduce in preview** — Read [Validation & Debugging](references/agent-validation-and-debugging.md) for preview workflow and session trace analysis. Start preview session:
|
|
256
256
|
`sf agent preview start --json --use-live-actions --authoring-bundle <Developer_Name>`
|
|
257
|
-
then send test messages covering EACH
|
|
258
|
-
4. **Analyze session traces** — Examine trace output to confirm
|
|
257
|
+
then send test messages covering EACH subagent with `sf agent preview send`. One message is not enough — confirm behavior per subagent before proceeding.
|
|
258
|
+
4. **Analyze session traces** — Examine trace output to confirm subagent 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.
|
|
259
259
|
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.
|
|
260
260
|
6. **Fix code** — Apply targeted fix. If fix involves flow control changes, update Agent Spec to match.
|
|
261
261
|
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.
|
|
@@ -291,8 +291,8 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
291
291
|
Test key conversation paths to validate agent behavior when backed by live actions.
|
|
292
292
|
**CHECKPOINT — Do NOT proceed to Publish unless ALL are true:**
|
|
293
293
|
- `validate authoring-bundle` passes with zero errors
|
|
294
|
-
- Live preview (`--use-live-actions`) tested with representative utterances per
|
|
295
|
-
- Traces confirm correct
|
|
294
|
+
- Live preview (`--use-live-actions`) tested with representative utterances per subagent
|
|
295
|
+
- Traces confirm correct subagent routing and action invocation
|
|
296
296
|
- User explicitly approves deployment
|
|
297
297
|
4. **Publish** — Publish validates metadata structure, not agent behavior. 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.
|
|
298
298
|
`sf agent publish authoring-bundle --json --api-name <Developer_Name>`
|
|
@@ -379,8 +379,8 @@ User wants to create automated tests for Agent Script agent. Involves writing `A
|
|
|
379
379
|
|
|
380
380
|
Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command syntax.
|
|
381
381
|
|
|
382
|
-
1. **Establish coverage baseline** — Read Agent Spec. If no Agent Spec exists, reverse-engineer first by following Comprehend steps. Map every
|
|
383
|
-
2. **Design test scenarios** — For test design methodology, expectations, metrics, test spec YAML format, and templates, use **testing-agentforce** skill. That skill owns all testing content. For each coverage target, write one or more test scenarios: user utterance, expected
|
|
382
|
+
1. **Establish coverage baseline** — Read Agent Spec. If no Agent Spec exists, reverse-engineer first by following Comprehend steps. Map every subagent, action, and flow control path to identify what needs test coverage.
|
|
383
|
+
2. **Design test scenarios** — For test design methodology, expectations, metrics, test spec YAML format, and templates, use **testing-agentforce** skill. That skill owns all testing content. For each coverage target, write one or more test scenarios: user utterance, expected subagent routing, expected action invocations, and expected agent response. Include both happy paths and edge cases.
|
|
384
384
|
3. **Write test spec YAML** — Use template and reference files from **testing-agentforce** skill. Save to `specs/<Agent_API_Name>-testSpec.yaml` in SFDX project.
|
|
385
385
|
4. **Create test metadata** — Generate `AiEvaluationDefinition` from test spec using CLI.
|
|
386
386
|
5. **Deploy test** — Deploy `AiEvaluationDefinition` to org.
|
|
@@ -401,7 +401,7 @@ Read [CLI for Agents](references/salesforce-cli-for-agents.md) for exact command
|
|
|
401
401
|
|
|
402
402
|
## The Agent Spec
|
|
403
403
|
|
|
404
|
-
**Agent Spec** is the central artifact this skill produces and consumes. A structured design document representing agent's purpose,
|
|
404
|
+
**Agent Spec** is the central artifact this skill produces and consumes. A structured design document representing agent's purpose, subagent graph, actions with backing logic, variables, gating logic, and behavioral intent.
|
|
405
405
|
|
|
406
406
|
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.
|
|
407
407
|
|
|
@@ -413,13 +413,13 @@ Read [Design & Agent Spec](references/agent-design-and-spec-creation.md) for Age
|
|
|
413
413
|
|
|
414
414
|
The `assets/` directory contains templates and examples. Read when you need a starting point or a concrete reference for artifacts and source files.
|
|
415
415
|
|
|
416
|
-
- **`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
|
|
416
|
+
- **`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 Subagent Map diagram.
|
|
417
417
|
|
|
418
418
|
- **`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.
|
|
419
419
|
|
|
420
|
-
- **`assets/template-single-
|
|
420
|
+
- **`assets/template-single-subagent.agent`** — Minimal agent with one subagent. Copy and modify for simple agents.
|
|
421
421
|
|
|
422
|
-
- **`assets/template-multi-
|
|
422
|
+
- **`assets/template-multi-subagent.agent`** — Minimal agent with multiple subagents and transitions. Copy and modify for complex agents.
|
|
423
423
|
|
|
424
424
|
- **`assets/invocable-apex-template.cls`** — Reference for invocable Apex
|
|
425
425
|
classes. Copy and modify when complex Apex backing logic is desired.
|
|
@@ -443,15 +443,15 @@ Invalid or missing `default_agent_user`. Re-run query from [Design & Agent Spec]
|
|
|
443
443
|
**Permission error referencing different username than configured:**
|
|
444
444
|
Same fix as above — error references org's default running user, but root cause is Einstein Agent User permissions.
|
|
445
445
|
|
|
446
|
-
**Agent fails with permission error even though current
|
|
447
|
-
Planner validates ALL actions across ALL
|
|
446
|
+
**Agent fails with permission error even though current subagent's actions work:**
|
|
447
|
+
Planner validates ALL actions across ALL subagents at startup. One missing permission fails entire agent.
|
|
448
448
|
|
|
449
449
|
**Apex action returns empty results in live preview but works in simulated:**
|
|
450
450
|
`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.
|
|
451
451
|
|
|
452
452
|
## Syntax Quick Reference
|
|
453
453
|
|
|
454
|
-
- Block order: `system:` → `config:` → `variables:` → `connection:` → `knowledge:` → `language:` → `start_agent
|
|
454
|
+
- Block order: `system:` → `config:` → `variables:` → `connection:` → `knowledge:` → `language:` → `start_agent agent_router:` → `subagent:` blocks
|
|
455
455
|
- Indentation: **4 spaces** per indent level. Never use tabs. Mixing spaces and tabs breaks the parser.
|
|
456
456
|
- Booleans: `True`/`False` (capitalized)
|
|
457
457
|
- Strings: always double-quoted
|
|
@@ -467,8 +467,8 @@ See [Complex Data Types](references/complex-data-types.md) for the full Lightnin
|
|
|
467
467
|
|
|
468
468
|
Three primary FSM patterns. Full details with code in [Architecture Patterns](references/architecture-patterns.md).
|
|
469
469
|
|
|
470
|
-
- **Hub-and-Spoke** (most common): `start_agent` routes to specialized
|
|
471
|
-
- **Verification Gate**: Identity verification before protected
|
|
470
|
+
- **Hub-and-Spoke** (most common): `start_agent` routes to specialized subagents. Each subagent has "back to hub" transition. Do NOT create a separate routing subagent.
|
|
471
|
+
- **Verification Gate**: Identity verification before protected subagents. `available when` guards on protected transitions.
|
|
472
472
|
- **Post-Action Loop**: Post-action checks at TOP of `instructions: ->` trigger on re-resolution after action completes.
|
|
473
473
|
|
|
474
474
|
## Scoring Rubric
|
|
@@ -507,7 +507,7 @@ Validate → deploy metadata → publish bundle → activate. See [Deploy Refere
|
|
|
507
507
|
|
|
508
508
|
## Template Assets
|
|
509
509
|
|
|
510
|
-
Ready-to-use `.agent` templates in `assets/agents/` (hello-world, simple-qa, multi-
|
|
510
|
+
Ready-to-use `.agent` templates in `assets/agents/` (hello-world, simple-qa, multi-subagent, production-faq, order-service, verification-gate). See also `assets/patterns/` for 11+ reusable design patterns and [Examples](references/examples.md) for inline walkthroughs.
|
|
511
511
|
|
|
512
512
|
## Additional References
|
|
513
513
|
|
|
@@ -9,7 +9,7 @@ Organized templates for building Agentforce agents.
|
|
|
9
9
|
```
|
|
10
10
|
assets/
|
|
11
11
|
├── agents/ Complete, deployable agent examples
|
|
12
|
-
├── components/ Reusable action and
|
|
12
|
+
├── components/ Reusable action and subagent snippets
|
|
13
13
|
├── patterns/ Advanced patterns (lifecycle, callbacks)
|
|
14
14
|
└── metadata/ XML metadata templates
|
|
15
15
|
```
|
|
@@ -24,8 +24,8 @@ What do you need?
|
|
|
24
24
|
├─► "Just starting"
|
|
25
25
|
│ └─► agents/hello-world.agent
|
|
26
26
|
│
|
|
27
|
-
├─► "Complete agent with
|
|
28
|
-
│ └─► agents/multi-
|
|
27
|
+
├─► "Complete agent with subagents"
|
|
28
|
+
│ └─► agents/multi-subagent.agent
|
|
29
29
|
│
|
|
30
30
|
├─► "Add actions to my agent"
|
|
31
31
|
│ ├─► components/flow-action.agent
|
|
@@ -47,8 +47,8 @@ What do you need?
|
|
|
47
47
|
| Template | Complexity | Description |
|
|
48
48
|
|----------|------------|-------------|
|
|
49
49
|
| `hello-world.agent` | Beginner | Minimal viable agent |
|
|
50
|
-
| `simple-qa.agent` | Beginner | Single-
|
|
51
|
-
| `multi-
|
|
50
|
+
| `simple-qa.agent` | Beginner | Single-subagent Q&A |
|
|
51
|
+
| `multi-subagent.agent` | Intermediate | Multi-subagent routing |
|
|
52
52
|
| `production-faq.agent` | Advanced | Production-ready with escalation |
|
|
53
53
|
|
|
54
54
|
### components/ - Reusable Parts
|
|
@@ -57,7 +57,7 @@ What do you need?
|
|
|
57
57
|
|----------|---------|
|
|
58
58
|
| `flow-action.agent` | Flow action integration |
|
|
59
59
|
| `apex-action.agent` | Apex action integration |
|
|
60
|
-
| `
|
|
60
|
+
| `subagent-with-actions.agent` | Subagent with actions |
|
|
61
61
|
| `error-handling.agent` | Input validation |
|
|
62
62
|
| `escalation-setup.agent` | Human handoff |
|
|
63
63
|
|
|
@@ -67,8 +67,8 @@ What do you need?
|
|
|
67
67
|
|----------|---------|------------|
|
|
68
68
|
| `lifecycle-events.agent` | before/after reasoning | GenAiPlannerBundle |
|
|
69
69
|
| `action-callbacks.agent` | Deterministic chains | GenAiPlannerBundle |
|
|
70
|
-
| `bidirectional-routing.agent` |
|
|
71
|
-
| `system-instruction-overrides.agent` |
|
|
70
|
+
| `bidirectional-routing.agent` | Subagent routing with return | Both |
|
|
71
|
+
| `system-instruction-overrides.agent` | Subagent-level personas | Both |
|
|
72
72
|
| *(6 more patterns)* | | |
|
|
73
73
|
|
|
74
74
|
### metadata/ - XML Templates
|
|
@@ -11,23 +11,23 @@ Describe the key behavioral rules that govern the agent:
|
|
|
11
11
|
- What must the agent know before taking action?
|
|
12
12
|
- What backing logic types are used (Apex, Flow, Prompt Template)?
|
|
13
13
|
- What guardrails apply (off-topic handling, escalation)?
|
|
14
|
-
- What information persists across
|
|
14
|
+
- What information persists across subagent switches?
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Subagent Map
|
|
17
17
|
|
|
18
18
|
```mermaid
|
|
19
19
|
%%{init: {'theme':'neutral'}}%%
|
|
20
20
|
graph TD
|
|
21
|
-
A[start_agent<br/>
|
|
21
|
+
A[start_agent<br/>agent_router]
|
|
22
22
|
|
|
23
|
-
A -->|description of routing condition| B[
|
|
24
|
-
A -->|unclear intent| C[ambiguous_question<br/>
|
|
25
|
-
A -->|out of scope| D[off_topic<br/>
|
|
26
|
-
A -->|needs escalation| E[escalation<br/>
|
|
23
|
+
A -->|description of routing condition| B[subagent_name<br/>Subagent]
|
|
24
|
+
A -->|unclear intent| C[ambiguous_question<br/>Subagent]
|
|
25
|
+
A -->|out of scope| D[off_topic<br/>Subagent]
|
|
26
|
+
A -->|needs escalation| E[escalation<br/>Subagent]
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
Expand the diagram to show actions, gating logic, and variable state changes
|
|
30
|
-
within each
|
|
30
|
+
within each subagent. See the Subagent Map Diagrams reference for conventions.
|
|
31
31
|
|
|
32
32
|
## Variables
|
|
33
33
|
|
|
@@ -37,7 +37,7 @@ within each topic. See the Topic Map Diagrams reference for conventions.
|
|
|
37
37
|
|
|
38
38
|
## Actions & Backing Logic
|
|
39
39
|
|
|
40
|
-
### action_name (
|
|
40
|
+
### action_name (subagent_name subagent)
|
|
41
41
|
|
|
42
42
|
- **Target:** `apex://ClassName` or `flow://FlowName` or `prompt://PromptTemplateName`
|
|
43
43
|
- **Backing Status:** EXISTS / NEEDS STUB / NEEDS IMPLEMENTATION
|
|
@@ -7,8 +7,8 @@ Templates for building complete, deployable agents.
|
|
|
7
7
|
| Template | Complexity | Description |
|
|
8
8
|
|----------|------------|-------------|
|
|
9
9
|
| `hello-world.agent` | Beginner | Minimal viable agent - start here |
|
|
10
|
-
| `simple-qa.agent` | Beginner | Single-
|
|
11
|
-
| `multi-
|
|
10
|
+
| `simple-qa.agent` | Beginner | Single-subagent Q&A agent |
|
|
11
|
+
| `multi-subagent.agent` | Intermediate | Multi-subagent routing agent |
|
|
12
12
|
| `production-faq.agent` | Advanced | Production-ready FAQ with escalation |
|
|
13
13
|
|
|
14
14
|
## Quick Start
|
|
@@ -36,10 +36,10 @@ Every agent must have these blocks **in this order**:
|
|
|
36
36
|
| `config:` | Deployment metadata (agent_name, label, etc.) |
|
|
37
37
|
| `variables:` | Data connections and state storage |
|
|
38
38
|
| `language:` | Locale configuration |
|
|
39
|
-
| `start_agent` | Entry point
|
|
39
|
+
| `start_agent` | Entry point subagent (exactly one required) |
|
|
40
40
|
|
|
41
41
|
## Next Steps
|
|
42
42
|
|
|
43
|
-
- [components/](../components/) - Reusable action and
|
|
43
|
+
- [components/](../components/) - Reusable action and subagent templates
|
|
44
44
|
- [patterns/](../patterns/) - Advanced patterns for complex behaviors
|
|
45
45
|
- [metadata/](../metadata/) - XML metadata templates
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
# - config: Required metadata for deployment (agent_name must be unique)
|
|
10
10
|
# - variables: Linked variables connect to Messaging context (required for deployment)
|
|
11
11
|
# - language: Locale settings (required for deployment)
|
|
12
|
-
# - start_agent: Entry point
|
|
12
|
+
# - start_agent: Entry point subagent (exactly one required)
|
|
13
13
|
#
|
|
14
14
|
# ★ Key Validation Points (from 100-point scoring):
|
|
15
15
|
# - [10 pts] config block with all 4 required fields
|
|
16
16
|
# - [10 pts] 3 linked variables (EndUserId, RoutableId, ContactId)
|
|
17
17
|
# - [5 pts] language block present
|
|
18
|
-
# - [10 pts] At least one start_agent
|
|
18
|
+
# - [10 pts] At least one start_agent subagent
|
|
19
19
|
#
|
|
20
20
|
# Deploy with: sf agent publish authoring-bundle --api-name Hello_World_Agent --target-org [alias]
|
|
21
21
|
|
|
@@ -48,7 +48,7 @@ language:
|
|
|
48
48
|
additional_locales: ""
|
|
49
49
|
all_additional_locales: False
|
|
50
50
|
|
|
51
|
-
# Entry point
|
|
51
|
+
# Entry point subagent - this is where every conversation starts
|
|
52
52
|
start_agent main:
|
|
53
53
|
label: "Main"
|
|
54
54
|
description: "Greets users and provides help"
|
package/skills/developing-agentforce/assets/agents/{multi-topic.agent → multi-subagent.agent}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Multi-
|
|
2
|
-
# An agent with multiple conversation
|
|
3
|
-
# Users are routed to specialized
|
|
1
|
+
# Multi-Subagent Agent Template
|
|
2
|
+
# An agent with multiple conversation subagents (hub-and-spoke pattern)
|
|
3
|
+
# Users are routed to specialized subagents based on their needs
|
|
4
4
|
#
|
|
5
5
|
# Usage: Replace {{placeholders}} with your values
|
|
6
6
|
# Required: agent_name, default_agent_user, agent_label, description
|
|
7
|
-
# Required: At least 2
|
|
7
|
+
# Required: At least 2 subagents with label and description
|
|
8
8
|
|
|
9
9
|
system:
|
|
10
10
|
instructions: "{{SystemInstructions}}"
|
|
@@ -36,53 +36,53 @@ language:
|
|
|
36
36
|
additional_locales: ""
|
|
37
37
|
all_additional_locales: False
|
|
38
38
|
|
|
39
|
-
start_agent
|
|
40
|
-
label: "
|
|
41
|
-
description: "Routes users to the appropriate
|
|
39
|
+
start_agent agent_router:
|
|
40
|
+
label: "Subagent Router"
|
|
41
|
+
description: "Routes users to the appropriate subagent based on their needs"
|
|
42
42
|
|
|
43
43
|
reasoning:
|
|
44
44
|
instructions: ->
|
|
45
45
|
| Determine what the user needs help with.
|
|
46
|
-
| Route them to the most appropriate
|
|
46
|
+
| Route them to the most appropriate subagent.
|
|
47
47
|
| If unclear, ask clarifying questions.
|
|
48
48
|
actions:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
go_to_farewell: @utils.transition to @
|
|
53
|
-
go_to_escalation: @utils.transition to @
|
|
49
|
+
go_to_subagent_one: @utils.transition to @subagent.{{subagent_one_name}}
|
|
50
|
+
go_to_subagent_two: @utils.transition to @subagent.{{subagent_two_name}}
|
|
51
|
+
go_to_subagent_three: @utils.transition to @subagent.{{subagent_three_name}}
|
|
52
|
+
go_to_farewell: @utils.transition to @subagent.farewell
|
|
53
|
+
go_to_escalation: @utils.transition to @subagent.escalation
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
label: "{{
|
|
57
|
-
description: "{{
|
|
55
|
+
subagent {{subagent_one_name}}:
|
|
56
|
+
label: "{{SubagentOneLabel}}"
|
|
57
|
+
description: "{{SubagentOneDescription}}"
|
|
58
58
|
|
|
59
59
|
reasoning:
|
|
60
60
|
instructions: ->
|
|
61
|
-
| {{
|
|
61
|
+
| {{SubagentOneInstructions}}
|
|
62
62
|
actions:
|
|
63
|
-
back_to_menu: @utils.transition to @
|
|
63
|
+
back_to_menu: @utils.transition to @subagent.agent_router
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
label: "{{
|
|
67
|
-
description: "{{
|
|
65
|
+
subagent {{subagent_two_name}}:
|
|
66
|
+
label: "{{SubagentTwoLabel}}"
|
|
67
|
+
description: "{{SubagentTwoDescription}}"
|
|
68
68
|
|
|
69
69
|
reasoning:
|
|
70
70
|
instructions: ->
|
|
71
|
-
| {{
|
|
71
|
+
| {{SubagentTwoInstructions}}
|
|
72
72
|
actions:
|
|
73
|
-
back_to_menu: @utils.transition to @
|
|
73
|
+
back_to_menu: @utils.transition to @subagent.agent_router
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
label: "{{
|
|
77
|
-
description: "{{
|
|
75
|
+
subagent {{subagent_three_name}}:
|
|
76
|
+
label: "{{SubagentThreeLabel}}"
|
|
77
|
+
description: "{{SubagentThreeDescription}}"
|
|
78
78
|
|
|
79
79
|
reasoning:
|
|
80
80
|
instructions: ->
|
|
81
|
-
| {{
|
|
81
|
+
| {{SubagentThreeInstructions}}
|
|
82
82
|
actions:
|
|
83
|
-
back_to_menu: @utils.transition to @
|
|
83
|
+
back_to_menu: @utils.transition to @subagent.agent_router
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
subagent farewell:
|
|
86
86
|
label: "Farewell"
|
|
87
87
|
description: "Ends the conversation gracefully"
|
|
88
88
|
|
|
@@ -92,7 +92,7 @@ topic farewell:
|
|
|
92
92
|
| Wish them a great day.
|
|
93
93
|
| Let them know they can return anytime.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
subagent escalation:
|
|
96
96
|
label: "Escalation"
|
|
97
97
|
description: "Handles requests to transfer to a live human agent"
|
|
98
98
|
|