@salesforce/afv-skills 1.6.8 → 1.7.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 (93) hide show
  1. package/package.json +3 -3
  2. package/skills/developing-agentforce/README.md +112 -0
  3. package/skills/{agentforce-development → developing-agentforce}/SKILL.md +109 -16
  4. package/skills/{agentforce-development → developing-agentforce}/assets/agents/README.md +2 -2
  5. package/skills/developing-agentforce/assets/agents/order-service.agent +272 -0
  6. package/skills/developing-agentforce/assets/agents/verification-gate.agent +280 -0
  7. package/skills/{agentforce-development → developing-agentforce}/assets/bundle-meta.xml +1 -1
  8. package/skills/{agentforce-development → developing-agentforce}/references/actions-reference.md +20 -0
  9. package/skills/{agentforce-development → developing-agentforce}/references/agent-design-and-spec-creation.md +1 -1
  10. package/skills/{agentforce-development → developing-agentforce}/references/agent-metadata-and-lifecycle.md +3 -3
  11. package/skills/{agentforce-development → developing-agentforce}/references/agent-script-core-language.md +40 -3
  12. package/skills/{agentforce-development → developing-agentforce}/references/agent-user-setup.md +60 -57
  13. package/skills/{agentforce-development → developing-agentforce}/references/agent-validation-and-debugging.md +22 -20
  14. package/skills/developing-agentforce/references/architecture-patterns.md +158 -0
  15. package/skills/developing-agentforce/references/complex-data-types.md +57 -0
  16. package/skills/developing-agentforce/references/deploy-reference.md +134 -0
  17. package/skills/developing-agentforce/references/discover-reference.md +102 -0
  18. package/skills/developing-agentforce/references/examples.md +350 -0
  19. package/skills/developing-agentforce/references/feature-validity.md +43 -0
  20. package/skills/developing-agentforce/references/instruction-resolution.md +545 -0
  21. package/skills/{agentforce-development → developing-agentforce}/references/known-issues.md +18 -18
  22. package/skills/{agentforce-development → developing-agentforce}/references/production-gotchas.md +24 -3
  23. package/skills/developing-agentforce/references/safety-review-reference.md +145 -0
  24. package/skills/{agentforce-development → developing-agentforce}/references/salesforce-cli-for-agents.md +9 -7
  25. package/skills/developing-agentforce/references/scaffold-reference.md +153 -0
  26. package/skills/developing-agentforce/references/scoring-rubric.md +24 -0
  27. package/skills/{agentforce-development → developing-agentforce}/references/version-history.md +2 -2
  28. package/skills/generating-ui-bundle-site/SKILL.md +3 -3
  29. package/skills/observing-agentforce/SKILL.md +368 -0
  30. package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls +1262 -0
  31. package/skills/observing-agentforce/apex/AgentforceOptimizeService.cls-meta.xml +5 -0
  32. package/skills/observing-agentforce/references/improve-reference.md +359 -0
  33. package/skills/observing-agentforce/references/issue-classification.md +220 -0
  34. package/skills/observing-agentforce/references/reproduce-reference.md +131 -0
  35. package/skills/observing-agentforce/references/stdm-queries.md +381 -0
  36. package/skills/observing-agentforce/references/stdm-schema.md +189 -0
  37. package/skills/testing-agentforce/SKILL.md +335 -0
  38. package/skills/testing-agentforce/assets/basic-test-spec.yaml +59 -0
  39. package/skills/testing-agentforce/assets/guardrail-test-spec.yaml +101 -0
  40. package/skills/testing-agentforce/assets/standard-test-spec.yaml +123 -0
  41. package/skills/testing-agentforce/references/action-execution.md +241 -0
  42. package/skills/testing-agentforce/references/batch-testing.md +274 -0
  43. package/skills/testing-agentforce/references/preview-testing.md +353 -0
  44. package/skills/testing-agentforce/references/test-report-format.md +160 -0
  45. package/skills/testing-agentforce/references/troubleshooting.md +73 -0
  46. /package/skills/{agentforce-development → developing-agentforce}/assets/README-legacy.md +0 -0
  47. /package/skills/{agentforce-development → developing-agentforce}/assets/agent-spec-template.md +0 -0
  48. /package/skills/{agentforce-development → developing-agentforce}/assets/agents/hello-world.agent +0 -0
  49. /package/skills/{agentforce-development → developing-agentforce}/assets/agents/multi-topic.agent +0 -0
  50. /package/skills/{agentforce-development → developing-agentforce}/assets/agents/production-faq.agent +0 -0
  51. /package/skills/{agentforce-development → developing-agentforce}/assets/agents/production-faq.bundle-meta.xml +0 -0
  52. /package/skills/{agentforce-development → developing-agentforce}/assets/agents/simple-qa.agent +0 -0
  53. /package/skills/{agentforce-development → developing-agentforce}/assets/apex/models-api-queueable.cls +0 -0
  54. /package/skills/{agentforce-development → developing-agentforce}/assets/components/apex-action.agent +0 -0
  55. /package/skills/{agentforce-development → developing-agentforce}/assets/components/error-handling.agent +0 -0
  56. /package/skills/{agentforce-development → developing-agentforce}/assets/components/escalation-setup.agent +0 -0
  57. /package/skills/{agentforce-development → developing-agentforce}/assets/components/flow-action.agent +0 -0
  58. /package/skills/{agentforce-development → developing-agentforce}/assets/components/n-ary-conditions.agent +0 -0
  59. /package/skills/{agentforce-development → developing-agentforce}/assets/components/topic-with-actions.agent +0 -0
  60. /package/skills/{agentforce-development → developing-agentforce}/assets/deterministic-routing.agent +0 -0
  61. /package/skills/{agentforce-development → developing-agentforce}/assets/escalation-pattern.agent +0 -0
  62. /package/skills/{agentforce-development → developing-agentforce}/assets/flow-action-lookup.agent +0 -0
  63. /package/skills/{agentforce-development → developing-agentforce}/assets/hub-and-spoke.agent +0 -0
  64. /package/skills/{agentforce-development → developing-agentforce}/assets/invocable-apex-template.cls +0 -0
  65. /package/skills/{agentforce-development → developing-agentforce}/assets/local-info-agent-annotated.agent +0 -0
  66. /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/basic-prompt-template.promptTemplate-meta.xml +0 -0
  67. /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-function-apex.xml +0 -0
  68. /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-function-flow.xml +0 -0
  69. /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/genai-plugin.xml +0 -0
  70. /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/http-callout-flow.flow-meta.xml +0 -0
  71. /package/skills/{agentforce-development → developing-agentforce}/assets/metadata/record-grounded-prompt.promptTemplate-meta.xml +0 -0
  72. /package/skills/{agentforce-development → developing-agentforce}/assets/minimal-starter.agent +0 -0
  73. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/README.md +0 -0
  74. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/action-callbacks.agent +0 -0
  75. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/advanced-input-bindings.agent +0 -0
  76. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/bidirectional-routing.agent +0 -0
  77. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/critical-input-collection.agent +0 -0
  78. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/delegation-routing.agent +0 -0
  79. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/lifecycle-events.agent +0 -0
  80. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/llm-controlled-actions.agent +0 -0
  81. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/multi-step-workflow.agent +0 -0
  82. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/open-gate-routing.agent +0 -0
  83. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/procedural-instructions.agent +0 -0
  84. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/prompt-template-action.agent +0 -0
  85. /package/skills/{agentforce-development → developing-agentforce}/assets/patterns/system-instruction-overrides.agent +0 -0
  86. /package/skills/{agentforce-development → developing-agentforce}/assets/prompt-rag-search.agent +0 -0
  87. /package/skills/{agentforce-development → developing-agentforce}/assets/template-multi-topic.agent +0 -0
  88. /package/skills/{agentforce-development → developing-agentforce}/assets/template-single-topic.agent +0 -0
  89. /package/skills/{agentforce-development → developing-agentforce}/assets/verification-gate.agent +0 -0
  90. /package/skills/{agentforce-development → developing-agentforce}/references/action-prompt-templates.md +0 -0
  91. /package/skills/{agentforce-development → developing-agentforce}/references/agent-access-guide.md +0 -0
  92. /package/skills/{agentforce-development → developing-agentforce}/references/agent-topic-map-diagrams.md +0 -0
  93. /package/skills/{agentforce-development → developing-agentforce}/references/minimal-examples.md +0 -0
@@ -0,0 +1,57 @@
1
+ <!-- Parent: adlc-author/SKILL.md -->
2
+
3
+ # `complex_data_type_name` Mapping Table
4
+
5
+ > **"#1 source of compile errors"** - Use this table when defining action inputs/outputs in Agentforce Assets.
6
+
7
+ ## Decision Tree: When Do I Need `complex_data_type_name`?
8
+
9
+ 1. **Variable** with `number`? → Use `number` directly, no complex type needed
10
+ 2. **Action I/O** with integer value, **Flow target** (`flow://`)? → Use `object` + `complex_data_type_name: "lightning__numberType"`
11
+ 3. **Action I/O** with integer value, **Apex target** (`apex://`)? → Use `object` + `complex_data_type_name: "lightning__integerType"`
12
+ 4. **Action input/output** with decimal value? → Use `object` + `complex_data_type_name: "lightning__doubleType"`
13
+ 5. **Variable** with any other primitive? → Use the type directly (`string`, `boolean`, `date`)
14
+ 6. **Action I/O** with non-primitive? → Use `object` + appropriate `complex_data_type_name` from table below
15
+
16
+ > **Key insight:** Bare `number` works in **variable declarations** but **fails at publish** in action inputs/outputs. This is the #1 cause of publish-fix-republish cycles.
17
+
18
+ > **CRITICAL: Target type matters!** The valid `complex_data_type_name` for integer values differs by target type:
19
+ > - **Flow targets** (`flow://`): Use `lightning__numberType` (NOT `lightning__integerType`)
20
+ > - **Apex targets** (`apex://`): Use `lightning__integerType` (NOT `lightning__numberType`)
21
+ > Using the wrong one causes a publish validation error.
22
+
23
+ ## Full Mapping Table
24
+
25
+ | Data Type | `complex_data_type_name` Value | Notes |
26
+ |-----------|-------------------------------|-------|
27
+ | `string` | *(none needed)* | Primitive type — works in both variables and action I/O |
28
+ | `number` (variable only) | *(none needed)* | **Variables only** — do NOT use bare `number` in action I/O |
29
+ | `boolean` | *(none needed)* | Primitive type |
30
+ | `object` (SObject) | `lightning__recordInfoType` | Use for Account, Contact, etc. |
31
+ | `list[string]` | `lightning__textType` | Collection of text values |
32
+ | `list[object]` | `lightning__textType` | Serialized as JSON text |
33
+ | Apex Inner Class | `@apexClassType/NamespacedClass__InnerClass` | Namespace required |
34
+ | Custom LWC Type | `lightning__c__CustomTypeName` | Custom component types |
35
+ | Currency field | `lightning__currencyType` | For monetary values |
36
+ | `datetime` | `lightning__dateTimeStringType` | DateTime values |
37
+ | `integer` | `lightning__integerType` | Integer numbers (action I/O only) |
38
+ | `double` / `number` | `lightning__doubleType` | Decimal/floating-point numbers (action I/O only) |
39
+ | `object` (structured) | `lightning__objectType` | Complex data structures (action I/O only) |
40
+ | `list` (generic) | `lightning__listType` | Arrays/lists (action I/O only) |
41
+
42
+ > **Naming variance**: Upstream documentation uses `lightning__dateTimeType` while testing confirms `lightning__dateTimeStringType`. Both may be valid depending on API version — use `lightning__dateTimeStringType` as the tested default.
43
+
44
+ ## Agent Script → Lightning Type Mapping
45
+
46
+ > Use this when troubleshooting type errors between Agent Script action I/O and Apex/Flow targets.
47
+
48
+ | Agent Script Type | Lightning Type | Apex Type | Notes |
49
+ |-------------------|---------------|-----------|-------|
50
+ | `string` | `lightning__textType` | `String` | No `complex_data_type_name` needed |
51
+ | `number` | `lightning__numberType` | `Decimal` / `Double` | No `complex_data_type_name` needed |
52
+ | `boolean` | `lightning__booleanType` | `Boolean` | No `complex_data_type_name` needed |
53
+ | `datetime` | `lightning__dateTimeStringType` | `DateTime` | **Actions only** — not valid for variables |
54
+ | `date` | `lightning__dateType` | `Date` | Valid for both variables and actions |
55
+ | `currency` | `lightning__currencyType` | `Decimal` | Annotated with currency type |
56
+
57
+ **Pro Tip**: Don't manually edit `complex_data_type_name` - use the UI dropdown in **Agentforce Assets > Action Definition**, then export/import the action definition.
@@ -0,0 +1,134 @@
1
+ # Deploy -- Bundle Publication Reference
2
+
3
+ > Extracted from SKILL.md Section 18. This file is loaded on demand when deployment details are needed.
4
+
5
+ ## Overview
6
+
7
+ Full deployment lifecycle for Agentforce agents: validate, deploy metadata, publish bundle, and activate.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ # Validate + publish
13
+ sf agent publish authoring-bundle --json --api-name MyAgent -o <org-alias>
14
+
15
+ # Activate after publish
16
+ sf agent activate --json --api-name MyAgent -o <org-alias>
17
+ ```
18
+
19
+ ## Deployment Phases
20
+
21
+ ### Phase 0: Safety Gate (Required)
22
+ Read the `.agent` file and run safety review (see `safety-review-reference.md`). If any BLOCK finding exists, STOP deployment. WARN findings must be reported and acknowledged by the user before proceeding.
23
+
24
+ ### Phase 1: Pre-Deployment Validation
25
+ ```bash
26
+ sf agent validate authoring-bundle --json --api-name MyAgent -o <org-alias>
27
+ ```
28
+
29
+ ### Phase 1b: Target Dependency Check
30
+ Verify all flow/apex targets exist in the org before publishing. If missing, scaffold and deploy them first.
31
+
32
+ ### Phase 2: Deploy Supporting Metadata
33
+ ```bash
34
+ sf project deploy start --json --source-dir force-app -o <org-alias>
35
+ ```
36
+
37
+ ### Phase 3: Publish Agent Bundle
38
+ ```bash
39
+ sf agent publish authoring-bundle --json --api-name MyAgent -o <org-alias>
40
+ ```
41
+ 4-step process: Validate (~1-2s) -> Publish (~8-10s) -> Retrieve (~5-7s) -> Deploy (~4-6s)
42
+
43
+ ### Phase 4: Activate Agent
44
+ ```bash
45
+ sf agent activate --json --api-name MyAgent -o <org-alias>
46
+ ```
47
+ Note: `sf agent activate` may not support `--json` in all CLI versions. If it returns plain text, check for "successfully activated" in the output.
48
+
49
+ Publishing creates an **inactive** version. Without activation, preview fails with "No valid version available".
50
+
51
+ ## Deploy vs Publish
52
+
53
+ | What changes | `sf project deploy start` | `sf agent publish authoring-bundle` |
54
+ |---|---|---|
55
+ | Bundle metadata | Yes | Yes |
56
+ | `system: instructions:` | Yes (via activate) | Yes |
57
+ | `reasoning: actions:` (transitions + invocations) | **NO** | Yes |
58
+
59
+ **Always prefer `sf agent publish authoring-bundle`.** If you change `reasoning: actions:`, publish is required.
60
+
61
+ ## Common Errors
62
+
63
+ | Error | Cause | Fix |
64
+ |-------|-------|-----|
65
+ | `Required fields missing: [BundleType]` | Extra fields in bundle-meta.xml | Use minimal: only `<bundleType>AGENT</bundleType>` |
66
+ | `Internal Error, try again later` | Invalid default_agent_user or new agent platform bug | Query Einstein Agent Users; for new agents, create shell in Setup UI first |
67
+ | `Duplicate value found: GenAiPluginDefinition` | `start_agent` and `topic` share name | Use different names |
68
+ | `Flow not found` | Metadata not deployed | Deploy flows before publishing |
69
+ | `SetupEntityType is not supported for DML` | PermissionSet via Apex DML | Use Metadata API (`sf project deploy start`) |
70
+
71
+ ## Rollback
72
+
73
+ ```bash
74
+ sf agent deactivate --json --api-name MyAgent -o <org>
75
+ sf data query --json --query "SELECT Id, VersionNumber FROM BotVersion WHERE BotDefinition.DeveloperName = 'MyAgent' ORDER BY VersionNumber DESC LIMIT 2" -o <org>
76
+ sf agent activate --json --api-name MyAgent --version-number <previous> -o <org>
77
+ ```
78
+
79
+ ## CI/CD Integration
80
+
81
+ ```yaml
82
+ name: Deploy Agentforce Agent
83
+ on:
84
+ push:
85
+ branches: [main]
86
+ paths: ['force-app/**']
87
+
88
+ jobs:
89
+ deploy:
90
+ runs-on: ubuntu-latest
91
+ steps:
92
+ - uses: actions/checkout@v3
93
+ - name: Install SF CLI
94
+ run: npm install -g @salesforce/cli
95
+ - name: Auth
96
+ run: |
97
+ echo "${{ secrets.SFDX_AUTH_URL }}" > auth.txt
98
+ sf org login sfdx-url --sfdx-url-file auth.txt --alias production
99
+ - name: Validate
100
+ run: sf agent validate authoring-bundle --json --api-name ${{ vars.AGENT_NAME }} -o production
101
+ - name: Deploy Metadata
102
+ run: sf project deploy start --json --source-dir force-app -o production
103
+ - name: Publish
104
+ run: sf agent publish authoring-bundle --json --api-name ${{ vars.AGENT_NAME }} -o production
105
+ - name: Activate
106
+ if: github.ref == 'refs/heads/main'
107
+ run: sf agent activate --json --api-name ${{ vars.AGENT_NAME }} -o production
108
+ ```
109
+
110
+ ## Pre-Deployment Checklist
111
+
112
+ - [ ] All action targets exist in org (run discover first)
113
+ - [ ] Agent Script validated (no syntax errors)
114
+ - [ ] Einstein Agent User configured correctly
115
+ - [ ] Supporting metadata deployed
116
+ - [ ] Previous version backed up
117
+ - [ ] Rollback plan documented
118
+
119
+ ## Post-Deployment Testing
120
+
121
+ ```bash
122
+ sf agent preview start --json --use-live-actions --authoring-bundle MyAgent -o <org>
123
+ # Read sessionId from the JSON response, then:
124
+ sf agent preview send --json --authoring-bundle MyAgent --session-id <SESSION_ID> -u "Hello, I need help" -o <org>
125
+ sf agent preview end --json --authoring-bundle MyAgent --session-id <SESSION_ID> -o <org>
126
+ ```
127
+
128
+ ## Exit Codes
129
+
130
+ | Code | Meaning |
131
+ |------|---------|
132
+ | 0 | Success |
133
+ | 1 | Validation/deployment failed |
134
+ | 2 | Critical failure |
@@ -0,0 +1,102 @@
1
+ # Discover -- Target Discovery Reference
2
+
3
+ > Extracted from SKILL.md Section 16. This file is loaded on demand when target discovery details are needed.
4
+
5
+ ## Overview
6
+
7
+ Validates that Agent Script `.agent` file targets actually exist in a Salesforce org, providing fuzzy suggestions for missing targets.
8
+
9
+ ## Usage
10
+
11
+ ```bash
12
+ # List all active autolaunched flows (candidate action targets)
13
+ sf api request rest --json "/services/data/v63.0/tooling/query?q=SELECT+DeveloperName,ProcessType+FROM+Flow+WHERE+IsActive=true+AND+ProcessType='AutoLaunchedFlow'" -o <org-alias>
14
+
15
+ # List all @InvocableMethod Apex classes
16
+ sf api request rest --json "/services/data/v63.0/tooling/query?q=SELECT+Name+FROM+ApexClass+WHERE+Body+LIKE+'%25InvocableMethod%25'" -o <org-alias>
17
+ ```
18
+
19
+ ## What it does
20
+
21
+ ### 1. Target Extraction
22
+ - Finds all `.agent` files in the project
23
+ - Parses each file to extract action `target:` values
24
+ - Identifies target types: `flow://`, `apex://`, `retriever://`, `externalService://`, `generatePromptResponse://`
25
+
26
+ ### 2. Org Validation
27
+
28
+ | Target Type | SOQL Query | Object Checked |
29
+ |-------------|------------|----------------|
30
+ | `flow://FlowName` | `SELECT ApiName FROM FlowDefinitionView WHERE ApiName = 'FlowName' AND IsActive = true` | Active flows only |
31
+ | `apex://ClassName` | `SELECT Name FROM ApexClass WHERE Name = 'ClassName'` | Apex classes |
32
+ | `retriever://RetrieverName` | `SELECT DeveloperName FROM DataKnowledgeSpace WHERE DeveloperName = 'RetrieverName'` | Data Cloud retrievers |
33
+ | `externalService://ServiceName` | `SELECT DeveloperName FROM ExternalServiceRegistration WHERE DeveloperName = 'ServiceName'` | External services |
34
+ | `generatePromptResponse://TemplateName` | `SELECT DeveloperName FROM PromptTemplate WHERE DeveloperName = 'TemplateName' AND Status = 'Active'` | Active prompt templates |
35
+
36
+ ### 3. Fuzzy Matching
37
+ When a target is missing:
38
+ - Queries for similar names using SOQL `LIKE` patterns
39
+ - Calculates Levenshtein distance for close matches
40
+ - Suggests up to 3 alternatives sorted by similarity
41
+
42
+ ### 4. I/O Parameter Validation (--validate-io)
43
+ - **Flows:** Queries `/services/data/v63.0/actions/custom/flow/{FlowApiName}` for actual I/O schema
44
+ - **Apex:** Checks `@InvocableVariable` field names match expected inputs/outputs
45
+ - Results appear as non-blocking warnings
46
+
47
+ ### 5. Classification for Scaffold Pipeline
48
+
49
+ | Signal in Description | Classification | Scaffold Output |
50
+ |----------------------|---------------|-----------------|
51
+ | "API", "HTTP", "REST", "external", URL | `callout` | Apex with Http + Remote Site + Custom Metadata |
52
+ | SObject names, "query", "record", "SOQL" | `soql` | Apex with SOQL query logic |
53
+ | No special signals | `basic` | Standard placeholder Apex |
54
+
55
+ ## Output Format
56
+
57
+ ```
58
+ Agentforce ADLC Discovery Report
59
+
60
+ Agent: OrderManagement
61
+ Topic: order_inquiry
62
+ Action: get_order_status
63
+ Target: flow://Get_Order_Status Found
64
+ Action: track_shipment
65
+ Target: flow://Track_Shipment_Flow MISSING
66
+ Suggestions:
67
+ - Track_Shipping_Flow (distance: 2)
68
+
69
+ Summary: 2/3 targets found (66.7%)
70
+ ```
71
+
72
+ ## Next Steps
73
+
74
+ - Missing targets: Run scaffold to generate stubs (see `scaffold-reference.md`)
75
+ - All found: Deploy (`sf agent publish authoring-bundle --json --api-name <AgentName> -o <org-alias>`)
76
+
77
+ ## Error Handling
78
+
79
+ | Error | Cause | Resolution |
80
+ |-------|-------|------------|
81
+ | `No .agent files found` | Wrong directory | Check `--agent-file` path |
82
+ | `Invalid org alias` | Org not authenticated | Run `sf org login web --alias <org-alias>` |
83
+ | `SOQL query failed` | Missing permissions | Ensure read access to Flow, ApexClass, etc. |
84
+
85
+ ## Exit Codes
86
+
87
+ | Code | Meaning |
88
+ |------|---------|
89
+ | 0 | All targets found |
90
+ | 1 | Some targets missing |
91
+ | 2 | Critical failure |
92
+
93
+ ## Advanced (requires ADLC repo clone)
94
+
95
+ The `discover.py` script provides automated discovery with fuzzy matching and I/O validation. It is NOT bundled with the skill — requires cloning the ADLC repo.
96
+
97
+ ```bash
98
+ # From ADLC repo root:
99
+ python3 scripts/discover.py -o <org-alias> --agent-file <path-to-agent-file>
100
+ python3 scripts/discover.py -o <org-alias> --agent-dir force-app/main/default/aiAuthoringBundles
101
+ python3 scripts/discover.py -o <org-alias> --agent-file MyAgent.agent --validate-io
102
+ ```
@@ -0,0 +1,350 @@
1
+ # Complete Agent Examples
2
+
3
+ > Extracted from SKILL.md Sections 9 + 10. This file is loaded on demand when complete agent examples are needed.
4
+
5
+ ## Minimal Service Agent
6
+
7
+ This is the absolute minimum for a deployable service agent:
8
+
9
+ ```
10
+ system:
11
+ instructions: "You are a helpful customer service agent."
12
+ messages:
13
+ welcome: "Hello! How can I help you today?"
14
+ error: "Something went wrong. Please try again."
15
+
16
+ config:
17
+ developer_name: "MinimalAgent"
18
+ agent_label: "Minimal Agent"
19
+ description: "A minimal service agent"
20
+ default_agent_user: "agent@00dxx000001234.ext"
21
+
22
+ variables:
23
+ EndUserId: linked string
24
+ source: @MessagingSession.MessagingEndUserId
25
+ description: "Messaging End User ID"
26
+ visibility: "External"
27
+ RoutableId: linked string
28
+ source: @MessagingSession.Id
29
+ description: "Messaging Session ID"
30
+ visibility: "External"
31
+ ContactId: linked string
32
+ source: @MessagingEndUser.ContactId
33
+ description: "Contact ID"
34
+ visibility: "External"
35
+
36
+ language:
37
+ default_locale: "en_US"
38
+ additional_locales: ""
39
+ all_additional_locales: False
40
+
41
+ start_agent topic_selector:
42
+ description: "Begin the onboarding flow"
43
+
44
+ topic greeting:
45
+ label: "Greeting"
46
+ description: "Greet users and provide help"
47
+ reasoning:
48
+ instructions: ->
49
+ | Welcome the user warmly.
50
+ | Ask how you can help them today.
51
+ ```
52
+
53
+ Companion `bundle-meta.xml` (MUST be this exact content -- no extra fields):
54
+ ```xml
55
+ <?xml version="1.0" encoding="UTF-8"?>
56
+ <AiAuthoringBundle xmlns="http://soap.sforce.com/2006/04/metadata">
57
+ <bundleType>AGENT</bundleType>
58
+ </AiAuthoringBundle>
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Minimal Employee Agent
64
+
65
+ Employee agents differ from service agents in their config, variables, and connection blocks. This example shows a 2-topic IT Knowledge agent deployed to internal employees.
66
+
67
+ ```
68
+ system:
69
+ instructions: |
70
+ You are an AI-powered IT assistant for Acme Corp employees.
71
+ Help employees find answers to common IT questions and
72
+ look up knowledge articles.
73
+ You are an AI assistant, not a human.
74
+ messages:
75
+ welcome: "Hi! I'm the IT Help assistant. What can I help you with?"
76
+ error: "Something went wrong. Please try again."
77
+
78
+ config:
79
+ developer_name: "IT_Knowledge_Agent"
80
+ agent_label: "IT Knowledge Agent"
81
+ description: "Internal IT knowledge base assistant for employees"
82
+ agent_type: "AgentforceEmployeeAgent"
83
+ # NOTE: No default_agent_user — employee agents run as the logged-in user.
84
+ # No connection messaging: block — employee agents have no messaging channel.
85
+ # No MessagingSession linked variables — those are service-agent-only.
86
+
87
+ variables:
88
+ search_query: mutable string = ""
89
+ description: "Current search query"
90
+ article_id: mutable string = ""
91
+ description: "Selected knowledge article ID"
92
+
93
+ language:
94
+ default_locale: "en_US"
95
+ additional_locales: ""
96
+ all_additional_locales: False
97
+
98
+ start_agent topic_selector:
99
+ description: "Route employees to the right IT support topic"
100
+ reasoning:
101
+ instructions: |
102
+ You are a router only. Do NOT answer questions directly.
103
+ Always use a transition action to route immediately.
104
+ - IT questions, troubleshooting, how-to -> use to_knowledge
105
+ - Password reset, account access -> use to_account
106
+ actions:
107
+ to_knowledge: @utils.transition to @topic.knowledge_search
108
+ description: "Search IT knowledge base"
109
+ to_account: @utils.transition to @topic.account_support
110
+ description: "Account and password help"
111
+
112
+ topic knowledge_search:
113
+ label: "Knowledge Search"
114
+ description: "Search and retrieve IT knowledge articles"
115
+
116
+ actions:
117
+ search_articles:
118
+ description: "Search knowledge base for articles"
119
+ target: "apex://ITKnowledge.searchArticles"
120
+ inputs:
121
+ query: string
122
+ description: "Search query"
123
+ outputs:
124
+ articles: string
125
+ description: "Matching articles as JSON"
126
+ is_displayable: True
127
+
128
+ reasoning:
129
+ instructions: ->
130
+ if @variables.article_id != "":
131
+ | Found article {!@variables.article_id}. Here are the details.
132
+
133
+ | Search the knowledge base using the search_articles action.
134
+ | Present results clearly. Do not fabricate article content.
135
+
136
+ actions:
137
+ search: @actions.search_articles
138
+ description: "Search knowledge base"
139
+ with query = ...
140
+ set @variables.search_query = @outputs.articles
141
+
142
+ back: @utils.transition to @topic.topic_selector
143
+ description: "Route to a different topic"
144
+
145
+ topic account_support:
146
+ label: "Account Support"
147
+ description: "Help with password resets and account access"
148
+
149
+ actions:
150
+ reset_password:
151
+ description: "Initiate password reset for employee"
152
+ target: "flow://IT_Password_Reset"
153
+ inputs:
154
+ employee_email: string
155
+ description: "Employee email address"
156
+ outputs:
157
+ status: string
158
+ description: "Reset status"
159
+ is_displayable: True
160
+
161
+ reasoning:
162
+ instructions: ->
163
+ | I can help with password resets and account access.
164
+ | Ask for the employee's email, then use the reset_password action.
165
+
166
+ actions:
167
+ reset: @actions.reset_password
168
+ description: "Reset employee password"
169
+ with employee_email = ...
170
+
171
+ # NOTE: No @utils.escalate — employee agents cannot escalate to
172
+ # human agents via messaging. Use a transition or case-creation
173
+ # action instead.
174
+ back: @utils.transition to @topic.topic_selector
175
+ description: "Route to a different topic"
176
+ ```
177
+
178
+ **What's deliberately absent (vs. service agents):**
179
+ - No `default_agent_user` in config (agent runs as logged-in employee)
180
+ - No `connection messaging:` block (no messaging channel)
181
+ - No `EndUserId`/`RoutableId`/`ContactId` linked variables (no `@MessagingSession`)
182
+ - No `@utils.escalate` action (requires `connection messaging:`)
183
+
184
+ ---
185
+
186
+ ## Multi-Topic Agent with Actions
187
+
188
+ ```
189
+ system:
190
+ instructions: |
191
+ You are a customer service agent for TechCorp.
192
+ Be professional, concise, and solution-oriented.
193
+ Always verify the customer before sensitive operations.
194
+ messages:
195
+ welcome: "Welcome to TechCorp Support! How can I assist you?"
196
+ error: "I apologize for the issue. Please try again."
197
+
198
+ config:
199
+ developer_name: "TechCorpAgent"
200
+ agent_label: "TechCorp Support Agent"
201
+ description: "Handles order inquiries, returns, and general support"
202
+ default_agent_user: "einstein@00dxx000001234.ext"
203
+
204
+ variables:
205
+ EndUserId: linked string
206
+ source: @MessagingSession.MessagingEndUserId
207
+ description: "Messaging End User ID"
208
+ visibility: "External"
209
+ RoutableId: linked string
210
+ source: @MessagingSession.Id
211
+ description: "Messaging Session ID"
212
+ visibility: "External"
213
+ ContactId: linked string
214
+ source: @MessagingEndUser.ContactId
215
+ description: "Contact ID"
216
+ visibility: "External"
217
+ order_id: mutable string = ""
218
+ description: "Current order being discussed"
219
+ order_status: mutable string = ""
220
+ description: "Status of the current order"
221
+ is_verified: mutable boolean = False
222
+ description: "Customer verification status"
223
+ case_id: mutable string = ""
224
+ description: "Created case ID"
225
+
226
+ language:
227
+ default_locale: "en_US"
228
+ additional_locales: ""
229
+ all_additional_locales: False
230
+
231
+ start_agent topic_selector:
232
+ description: "Route customers to the right support topic"
233
+ reasoning:
234
+ instructions: |
235
+ You are a router only. Do NOT answer questions or provide help directly.
236
+ Always use a transition action to route to the correct topic immediately.
237
+ - Order status or tracking -> use to_orders
238
+ - Returns or refunds -> use to_returns
239
+ - General questions -> use to_general
240
+ Never attempt to help the customer yourself. Always route.
241
+ actions:
242
+ to_orders: @utils.transition to @topic.order_support
243
+ description: "Check order status or tracking"
244
+ to_returns: @utils.transition to @topic.return_support
245
+ description: "Process a return or refund"
246
+ to_general: @utils.transition to @topic.general_support
247
+ description: "General questions and support"
248
+
249
+ topic order_support:
250
+ label: "Order Support"
251
+ description: "Handle order status and tracking inquiries"
252
+
253
+ actions:
254
+ get_order:
255
+ description: "Look up order by ID"
256
+ target: "flow://Get_Order_Status"
257
+ inputs:
258
+ order_id: string
259
+ description: "Order ID"
260
+ outputs:
261
+ status: string
262
+ description: "Order status"
263
+ is_displayable: True
264
+ tracking_url: string
265
+ description: "Tracking URL"
266
+ is_displayable: True
267
+
268
+ reasoning:
269
+ instructions: ->
270
+ if @variables.order_status != "":
271
+ | Order {!@variables.order_id} status: {!@variables.order_status}
272
+
273
+ | What is your order number? I will look it up for you.
274
+ | Use the get_order action to retrieve order details.
275
+ | Do not guess order status -- always use the action result.
276
+
277
+ actions:
278
+ lookup: @actions.get_order
279
+ description: "Look up order"
280
+ with order_id = ...
281
+ set @variables.order_id = @outputs.order_id
282
+ set @variables.order_status = @outputs.status
283
+
284
+ back: @utils.transition to @topic.topic_selector
285
+ description: "Route to a different topic"
286
+
287
+ topic return_support:
288
+ label: "Return Support"
289
+ description: "Handle returns and refund requests"
290
+
291
+ actions:
292
+ initiate_return:
293
+ description: "Start a return process"
294
+ target: "flow://Initiate_Return"
295
+ inputs:
296
+ order_id: string
297
+ description: "Order ID for the return"
298
+ reason: string
299
+ description: "Reason for return"
300
+ outputs:
301
+ return_id: string
302
+ description: "Return authorization ID"
303
+ is_displayable: True
304
+
305
+ reasoning:
306
+ instructions: ->
307
+ | I can help with your return request.
308
+ | Please provide your order number and the reason for the return.
309
+ | Use the initiate_return action to start the process -- do not fabricate return IDs.
310
+
311
+ actions:
312
+ start_return: @actions.initiate_return
313
+ description: "Start a return"
314
+ with order_id = ...
315
+ with reason = ...
316
+ set @variables.case_id = @outputs.return_id
317
+
318
+ back: @utils.transition to @topic.topic_selector
319
+ description: "Route to a different topic"
320
+
321
+ after_reasoning:
322
+ if @variables.case_id != "":
323
+ transition to @topic.confirmation
324
+
325
+ topic general_support:
326
+ label: "General Support"
327
+ description: "Handle general support questions"
328
+ reasoning:
329
+ instructions: |
330
+ Help the customer with general questions.
331
+ If the question is about orders or returns, route appropriately.
332
+ actions:
333
+ escalate_now: @utils.escalate
334
+ description: "Transfer to human agent"
335
+ back: @utils.transition to @topic.topic_selector
336
+ description: "Route to a different topic"
337
+
338
+ topic confirmation:
339
+ label: "Confirmation"
340
+ description: "Confirm the completed action"
341
+ reasoning:
342
+ instructions: ->
343
+ | Your request has been processed. Reference: {!@variables.case_id}
344
+ | Is there anything else I can help with?
345
+ actions:
346
+ new_request: @utils.transition to @topic.topic_selector
347
+ description: "Start a new request"
348
+ end_chat: @actions.end_conversation
349
+ description: "End the conversation"
350
+ ```
@@ -0,0 +1,43 @@
1
+ <!-- Parent: adlc-author/SKILL.md -->
2
+
3
+ # Feature Validity by Context
4
+
5
+ > **Key distinction**: Many action metadata properties are valid on **action definitions with targets** (`flow://`, `apex://`) but NOT on **utility actions** (`@utils.transition`).
6
+
7
+ | Feature | On `@utils.transition` | On action definitions with `target:` | Notes |
8
+ |---------|------------------------|---------------------------------------|-------|
9
+ | `label:` on topics | ❌ | ✅ | Valid on topic blocks |
10
+ | `label:` on actions | ❌ | ✅ | Valid on Level 1 action definitions |
11
+ | `label:` on I/O fields | ❌ | ✅ | Valid on inputs/outputs |
12
+ | `require_user_confirmation:` | ❌ | ✅ | Compiles; runtime no-op |
13
+ | `include_in_progress_indicator:` | ❌ | ✅ | Shows spinner during action execution |
14
+ | `progress_indicator_message:` | ❌ | ✅ | Works on both `flow://` and `apex://` |
15
+ | `output_instructions:` | ❌ | ❓ Untested | Not tested on target-backed actions |
16
+ | `always_expect_input:` | ❌ | ❌ | NOT implemented anywhere |
17
+
18
+ **What works on `@utils.transition` actions:**
19
+ ```yaml
20
+ actions:
21
+ go_next: @utils.transition to @topic.next
22
+ description: "Navigate to next topic" # ✅ ONLY description works
23
+ ```
24
+
25
+ **What works on action definitions with `target:`:**
26
+ ```yaml
27
+ actions:
28
+ process_order:
29
+ label: "Process Order" # ✅ Display label
30
+ description: "Process the customer's order" # ✅ LLM description
31
+ require_user_confirmation: True # ✅ Compiles (runtime issue)
32
+ include_in_progress_indicator: True # ✅ Shows spinner
33
+ progress_indicator_message: "Processing..." # ✅ Custom spinner message
34
+ inputs:
35
+ order_id: string
36
+ label: "Order ID" # ✅ I/O display label
37
+ description: "The order identifier"
38
+ outputs:
39
+ status: string
40
+ label: "Order Status" # ✅ I/O display label
41
+ description: "Current order status"
42
+ target: "apex://OrderProcessor"
43
+ ```