@salesforce/afv-skills 1.68.0 → 1.69.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.
- package/package.json +1 -1
- package/skills/afcc-setup-coordinate/SKILL.md +348 -0
- package/skills/afcc-setup-coordinate/assets/console-app/AFCC_Service_Console.app-meta.xml +19 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Admin.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/console-app/Standard.profile-meta.xml +8 -0
- package/skills/afcc-setup-coordinate/assets/gap_report_template.md +35 -0
- package/skills/afcc-setup-coordinate/assets/org_profile_template.json +16 -0
- package/skills/afcc-setup-coordinate/references/gotchas.md +22 -0
- package/skills/afcc-setup-coordinate/scripts/audit_org.sh +159 -0
- package/skills/agentforce-bot-upgrade/SKILL.md +117 -66
- package/skills/agentforce-bot-upgrade/assets/_vendored/agent-spec-template.md +139 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-design-and-spec-creation.md +1211 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-script-core-language.md +1390 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-subagent-map-diagrams.md +341 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-user-setup.md +672 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agent-validation-and-debugging.md +904 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/agentscript-toolchain.md +112 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/architecture-patterns.md +277 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/common-control-flow-pitfalls.md +255 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-actions-sequencing.md +198 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/control-flow-lifecycle-side-effects.md +87 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/data-library-reference.md +891 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/instruction-resolution.md +658 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/org-setup-for-adl.md +551 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/patterns-by-requirement.md +88 -0
- package/skills/agentforce-bot-upgrade/references/_vendored/posture-and-determinism.md +215 -0
- package/skills/agentforce-bot-upgrade/references/extraction-blueprint.md +11 -4
- package/skills/agentforce-bot-upgrade/references/generate-agent-spec.md +19 -3
- package/skills/agentforce-bot-upgrade/references/handoff-output-format.md +82 -52
- package/skills/agentforce-bot-upgrade/references/input-contract.md +8 -8
- package/skills/agentforce-bot-upgrade/references/mapping-rules.md +19 -6
- package/skills/agentforce-bot-upgrade/references/post-conversion-enhancements-reference.md +65 -6
- package/skills/agentforce-bot-upgrade/references/quality-checklist.md +4 -4
- package/skills/agentforce-bot-upgrade/references/sf-cli-bot-reference.md +17 -3
- package/skills/agentforce-hyperclassifier-configure/README.md +24 -0
- package/skills/agentforce-hyperclassifier-configure/SKILL.md +111 -0
- package/skills/agentforce-hyperclassifier-configure/assets/customer-org.env.example +4 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_descriptions.json +8 -0
- package/skills/agentforce-hyperclassifier-configure/assets/sample_evals.csv +17 -0
- package/skills/agentforce-hyperclassifier-configure/references/api-contract.md +41 -0
- package/skills/agentforce-hyperclassifier-configure/references/authentication.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/evaluation.md +46 -0
- package/skills/agentforce-hyperclassifier-configure/references/installation.md +35 -0
- package/skills/agentforce-hyperclassifier-configure/references/onboarding.md +93 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/__init__.py +1 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/client.py +219 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/eca.py +178 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/evaluation.py +207 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/onboarding.py +191 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hcopt/optimizer.py +187 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/hyperclassifier.py +111 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/report_hyperclassifier.py +149 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/setup_hyperclassifier.py +74 -0
- package/skills/agentforce-hyperclassifier-configure/scripts/tests/test_hyperclassifier_skill.py +887 -0
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/judge.py +23 -31
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/messages.py +2 -1
- package/skills/agentforce-offline-experimentation-run/scripts/btlib/sfap.py +118 -2
- package/skills/agentforce-offline-experimentation-run/scripts/build_report.py +2 -2
- package/skills/agentforce-offline-experimentation-run/scripts/resolve-token.sh +9 -2
- package/skills/agentforce-offline-experimentation-run/scripts/sfap_replay.py +12 -1
- package/skills/commerce-react-storefront-create/SKILL.md +54 -21
- package/skills/dx-lifecycle-center/SKILL.md +24 -18
- package/skills/dx-lifecycle-center/examples/workflows.md +57 -34
- package/skills/dx-lifecycle-center/references/connect-api.md +33 -4
- package/skills/dx-lifecycle-center/references/connect-org.md +59 -28
- package/skills/dx-lifecycle-center/references/deploy.md +3 -3
- package/skills/dx-lifecycle-center/references/hub-org.md +19 -3
- package/skills/dx-lifecycle-center/references/list-orgs.md +50 -24
- package/skills/dx-lifecycle-center/references/troubleshooting.md +22 -1
- package/skills/dx-lifecycle-center/scripts/hub-get.sh +41 -0
- package/skills/dx-lifecycle-center/scripts/resolve-environment.sh +151 -4
- package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +63 -0
- package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +252 -0
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +2 -3
- package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +10 -7
- package/skills/dx-packaging-push-upgrade-configure/README.md +47 -0
- package/skills/dx-packaging-push-upgrade-configure/SKILL.md +355 -0
- package/skills/dx-packaging-push-upgrade-configure/references/best-practices.md +61 -0
- package/skills/dx-packaging-push-upgrade-configure/references/cli-reference.md +148 -0
- package/skills/dx-packaging-push-upgrade-configure/references/objects.md +106 -0
- package/skills/dx-packaging-push-upgrade-configure/references/soql-recipes.md +144 -0
- package/skills/experience-afv-analytics-query/SKILL.md +239 -0
- package/skills/experience-afv-analytics-query/references/references.md +176 -0
- package/skills/experience-app-mcp-delivery-generate/SKILL.md +142 -0
- package/skills/experience-app-mcp-delivery-generate/references/eca-consumer-key.md +26 -0
- package/skills/experience-app-mcp-delivery-generate/references/mcp-config-delivery.md +38 -0
- package/skills/experience-app-mcp-delivery-generate/references/plugin-format-and-publishing.md +80 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/discover_mcp_context.mjs +114 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_mcp_config.mjs +27 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/generate_plugin.mjs +184 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/mcp_config.mjs +57 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/preflight.mjs +109 -0
- package/skills/experience-app-mcp-delivery-generate/scripts/retrieve_eca_consumer_key.mjs +143 -0
- package/skills/experience-app-mcp-generate/SKILL.md +174 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.eca-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaGlblOauth-meta.xml +15 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauth-meta.xml +6 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME__.ecaOauthPlcy-meta.xml +12 -0
- package/skills/experience-app-mcp-generate/assets/__ECA_NAME___defaultPolicy.ecaPlcy-meta.xml +7 -0
- package/skills/experience-app-mcp-generate/assets/__MCP_SERVER_NAME__.mcpServerDefinition-meta.xml +5 -0
- package/skills/experience-app-mcp-generate/references/eca-fields.md +76 -0
- package/skills/experience-app-mcp-generate/references/mcp-objects.md +66 -0
- package/skills/experience-app-mcp-generate/references/tool-bindings.md +85 -0
- package/skills/experience-app-mcp-generate/references/troubleshooting.md +41 -0
- package/skills/experience-app-mcp-generate/references/ui-frameworks.md +19 -0
- package/skills/experience-app-mcp-generate/references/widget-resources.md +96 -0
- package/skills/experience-app-mcp-generate/scripts/activate_server.mjs +166 -0
- package/skills/experience-app-mcp-generate/scripts/check_setup_progress.mjs +212 -0
- package/skills/experience-app-mcp-generate/scripts/list_sites.mjs +211 -0
- package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +407 -0
- package/skills/experience-app-mcp-generate/scripts/preflight.mjs +127 -0
- package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +144 -0
- package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +64 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_prompts.mjs +145 -0
- package/skills/experience-app-mcp-generate/scripts/retrieve_existing_tools.mjs +72 -0
- package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +195 -0
- package/skills/experience-app-mcp-generate/scripts/utils/callback_url.mjs +36 -0
- package/skills/experience-app-mcp-generate/scripts/utils/developer_name.mjs +9 -0
- package/skills/experience-app-mcp-generate/scripts/utils/eca_check.mjs +156 -0
- package/skills/experience-app-mcp-generate/scripts/utils/metadata_path.mjs +13 -0
- package/skills/experience-app-mcp-generate/scripts/verify_server.mjs +118 -0
- package/skills/experience-cms-content-type-generate/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/SKILL.md +1 -1
- package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +52 -4
- package/skills/nonprofit-fundraising-configure/references/permission-targeting.md +19 -2
- package/skills/platform-custom-field-generate/SKILL.md +24 -16
- package/skills/platform-custom-metadata-type-generate/SKILL.md +1 -0
- package/skills/platform-custom-setting-generate/SKILL.md +1 -0
- package/skills/platform-dataspace-access-configure/SKILL.md +25 -10
- package/skills/platform-flexipage-generate/SKILL.md +7 -10
- package/skills/platform-flexipage-generate/references/mcp_action_examples.md +42 -38
- package/skills/platform-policy-rule-generate/SKILL.md +9 -7
- package/skills/platform-policy-rule-generate/references/condition-model.md +3 -3
- package/skills/platform-policy-rule-generate/references/conjunction-expression.md +9 -1
- package/skills/platform-policy-rule-generate/references/consumer-datacloud-ui.md +9 -1
- package/skills/platform-policy-rule-generate/references/examples/ExistsJoinRLS/policyRuleDefinitionSets/ExistsJoinRLS.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/FieldReadDeny/policyRuleDefinitionSets/FieldReadDeny.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/LastCharactersFieldMasking/policyRuleDefinitionSets/LastCharactersFieldMasking.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/PrincipalFieldMatchRLS/policyRuleDefinitionSets/PrincipalFieldMatchRLS.policyRuleDefinitionSet +1 -2
- package/skills/platform-policy-rule-generate/references/examples/TaggedObjectAccess/policyRuleDefinitionSets/TaggedObjectAccess.policyRuleDefinitionSet +1 -0
- package/skills/platform-policy-rule-generate/references/headless-transport.md +2 -2
- package/skills/platform-policy-rule-generate/references/policy-schema-full.md +1 -1
- package/skills/platform-policy-rule-generate/references/policy-shapes.md +33 -0
- package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
- package/skills/platform-policy-rule-generate/references/ui-compatibility.md +5 -5
- package/skills/platform-report-generate/SKILL.md +20 -1
- package/skills/platform-report-generate/references/summary-formulas-sorting-limits.md +118 -0
- package/skills/platform-report-generate/references/verification-checklist.md +12 -0
- package/skills/service-digital-engagement-channel-configure/SKILL.md +44 -107
- package/skills/service-digital-engagement-channel-configure/assets/messaging_channel_template.xml +2 -0
- package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +58 -0
- package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +2 -2
- package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +18 -14
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +16 -20
- package/skills/service-digital-engagement-channel-configure/references/prechat_params.md +10 -0
- package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +38 -0
- package/skills/service-digital-engagement-channel-configure/references/user_verification.md +9 -0
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +4 -4
- package/skills/service-digital-engagement-channel-configure/scripts/normalize-channel-name.sh +12 -7
- package/skills/service-e911-configure/SKILL.md +242 -0
- package/skills/service-itsm-agentic-setup-agent-runtime-access-assign/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-coordinate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-agentforce-studio-validate/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-employee-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-fulfiller-agent-configure/SKILL.md +1 -1
- package/skills/service-itsm-agentic-setup-incident-management/SKILL.md +47 -44
- package/skills/service-itsm-agentic-setup-incident-management/examples/output-templates.md +110 -83
- package/skills/service-itsm-agentic-setup-incident-management/references/manage-incidents-with-ai.md +7 -3
- package/skills/service-itsm-agentic-setup-incident-management/references/priority-matrix.md +7 -5
- package/skills/service-itsm-agentic-setup-incident-management/references/sla-milestones.md +2 -2
- package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +437 -0
- package/skills/service-itsm-agentic-setup-itsm-agentforce-permset-assign/SKILL.md +1 -1
- package/skills/agentforce-bot-upgrade/references/planner-workflow-reference.md +0 -78
- package/skills/dx-lifecycle-center/assets/widgets/connect-connected/connect-connected.json +0 -65
- package/skills/dx-lifecycle-center/assets/widgets/connect-connected/schema.json +0 -32
- package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/connect-sign-in.json +0 -57
- package/skills/dx-lifecycle-center/assets/widgets/connect-sign-in/schema.json +0 -21
- package/skills/dx-lifecycle-center/scripts/card-policy.jq +0 -71
- package/skills/dx-lifecycle-center/scripts/fill-widget.jq +0 -29
- package/skills/dx-lifecycle-center/scripts/widget.sh +0 -28
- package/skills/experience-content-media-image-generate/SKILL.md +0 -83
- package/skills/experience-content-media-image-generate/scripts/download-image.sh +0 -84
- package/skills/experience-content-media-stock-image-search/SKILL.md +0 -193
- package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +0 -102
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
# Org Setup for ADL
|
|
2
|
+
|
|
3
|
+
Configure a fresh Salesforce org so it's ready for Agentforce Data Library (ADL) usage — all three source types (SFDRIVE, KNOWLEDGE, RETRIEVER).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The ADLC `/agentforce-generate` skill assumes the org is already configured for ADL. A fresh org (even with correct licenses provisioned) still needs several setup steps before ADL can work. This skill automates those steps via SF CLI.
|
|
8
|
+
|
|
9
|
+
**What this skill sets up:**
|
|
10
|
+
- Lightning Knowledge (required for KNOWLEDGE source type)
|
|
11
|
+
- Data Cloud verification (required for all ADL source types)
|
|
12
|
+
- CRM Connector validation (required for Knowledge article ingestion)
|
|
13
|
+
- Sample Knowledge articles (optional, for testing)
|
|
14
|
+
- Einstein Agent User permissions (Data Cloud permset + Knowledge FLS)
|
|
15
|
+
- Language alignment verification (prevents silent empty results)
|
|
16
|
+
|
|
17
|
+
**After this skill completes**, you can run `/agentforce-generate` to create knowledge-grounded agents with any source type.
|
|
18
|
+
|
|
19
|
+
## Platform Notes
|
|
20
|
+
|
|
21
|
+
- Shell examples below use bash syntax. On Windows, use PowerShell equivalents or Git Bash.
|
|
22
|
+
- Replace `python3` with `python` on Windows.
|
|
23
|
+
- Replace `/tmp/` with `$env:TEMP\` (PowerShell) or `%TEMP%\` (cmd).
|
|
24
|
+
|
|
25
|
+
## Rules That Always Apply
|
|
26
|
+
|
|
27
|
+
1. **Always `--json`.** ALWAYS include `--json` on EVERY `sf` CLI command. Read the full JSON response directly.
|
|
28
|
+
|
|
29
|
+
2. **Verify target org.** Before any org interaction, run `sf config get target-org --json` to confirm a target org is set. If none configured, ask the user to set one with `sf config set target-org <alias> --global` (the `--global` flag is required when not inside an SFDX project directory).
|
|
30
|
+
|
|
31
|
+
3. **Stop on auth failure.** If org authentication fails, do NOT proceed. Ask the user to re-authenticate.
|
|
32
|
+
|
|
33
|
+
4. **Confirm destructive actions.** Before deploying metadata that changes org-wide settings (like enabling Lightning Knowledge), confirm with the user.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Prerequisites
|
|
38
|
+
|
|
39
|
+
Before starting, verify:
|
|
40
|
+
|
|
41
|
+
### 1. SF CLI is available
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
sf --version --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Minimum version: `@salesforce/cli 2.139.6`. If missing, offer install options but do NOT auto-install.
|
|
48
|
+
|
|
49
|
+
### 2. Org is authenticated
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
sf org display --target-org $TARGET_ORG --json
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Set the target-org alias as a shell variable for all subsequent steps:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
TARGET_ORG="<org-alias>"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Required licenses exist
|
|
62
|
+
|
|
63
|
+
Query for the add-on licenses needed:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Name, Status, TotalLicenses FROM UserLicense WHERE Name LIKE '%Einstein%' OR Name LIKE '%Knowledge%' OR Name LIKE '%Agent%'"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Expected licenses/add-ons:
|
|
70
|
+
|
|
71
|
+
| License/AddOn | Purpose | Required For |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| `EinsteinGPTCopilotAddOn` | Agentforce / Agent platform | All ADL types |
|
|
74
|
+
| `EinsteinGPTServiceAddOn` | BOTS VSaaS framework | All ADL types |
|
|
75
|
+
| `GenieDataPlatformStarter` (AddOn) | Data Cloud — triggers DC provisioning | All ADL types |
|
|
76
|
+
| `CDP Base User` (PSL) | Per-user Data Cloud access | Agent user runtime |
|
|
77
|
+
| `EinsteinGPTPromptBuilderAddOn` | Einstein Prompt Templates — for Prompt Builder UI (optional for ADL) | Optional — only needed if using Prompt Builder directly |
|
|
78
|
+
| `KnowledgeAddOn` | Knowledge feature | KNOWLEDGE source type only |
|
|
79
|
+
|
|
80
|
+
To verify Data Cloud is provisioned (not just licensed):
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT COUNT() FROM DataKnowledgeSpace"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If this returns `INVALID_TYPE`, Data Cloud is not provisioned. Check Setup → Data Cloud Setup — if it says "get a Data Cloud license," the `GenieDataPlatformStarter` add-on is missing.
|
|
87
|
+
|
|
88
|
+
If licenses are missing, STOP and inform the user. These must be provisioned at the org level (SKU assignment, contract update, or trial enablement). No CLI command can add licenses.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Step 0 -- Enable Platform Features and Assign Admin Permissions
|
|
93
|
+
|
|
94
|
+
The org needs Einstein and Agentforce platform features turned on, and the admin user needs permission sets assigned BEFORE they can access Data Cloud or Agentforce.
|
|
95
|
+
|
|
96
|
+
**Temp directory for deploys:** Commands below use `/tmp/adl-setup/` as a temp workspace. On Windows, substitute with `%TEMP%\adl-setup\` (cmd) or `$env:TEMP/adl-setup` (PowerShell). The key requirement is that `sfdx-project.json` must exist in the same directory tree, and `sf project deploy start` must run from within that directory.
|
|
97
|
+
|
|
98
|
+
### 0a. Enable Einstein GPT Platform
|
|
99
|
+
|
|
100
|
+
Deploy the EinsteinGpt settings to turn on Einstein:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
mkdir -p /tmp/adl-setup/main/default/settings
|
|
104
|
+
cat > /tmp/adl-setup/main/default/settings/EinsteinGpt.settings-meta.xml << 'EOF'
|
|
105
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
106
|
+
<EinsteinGptSettings xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
107
|
+
<enableEinsteinGptPlatform>true</enableEinsteinGptPlatform>
|
|
108
|
+
<enableEinsteinGptGlobalLangSupport>true</enableEinsteinGptGlobalLangSupport>
|
|
109
|
+
</EinsteinGptSettings>
|
|
110
|
+
EOF
|
|
111
|
+
cat > /tmp/adl-setup/sfdx-project.json << 'EOF'
|
|
112
|
+
{"packageDirectories":[{"path":"main/default","default":true}],"namespace":"","sourceApiVersion":"67.0"}
|
|
113
|
+
EOF
|
|
114
|
+
cd /tmp/adl-setup && sf project deploy start --source-dir main/default/settings/EinsteinGpt.settings-meta.xml --target-org $TARGET_ORG --json
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**IMPORTANT:** `sf project deploy start` must run from within a directory that has `sfdx-project.json`. Always `cd` into the temp directory before deploying.
|
|
118
|
+
|
|
119
|
+
If this fails with "object does not exist," the org may not have the `EinsteinGPTCopilotAddOn` license. STOP and inform the user.
|
|
120
|
+
|
|
121
|
+
### 0b. Enable Agentforce (Einstein Copilot)
|
|
122
|
+
|
|
123
|
+
Deploy the EinsteinCopilot settings to turn on Agentforce:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cat > /tmp/adl-setup/main/default/settings/EinsteinCopilot.settings-meta.xml << 'EOF'
|
|
127
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
128
|
+
<EinsteinCopilotSettings xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
129
|
+
<enableEinsteinGptCopilot>true</enableEinsteinGptCopilot>
|
|
130
|
+
</EinsteinCopilotSettings>
|
|
131
|
+
EOF
|
|
132
|
+
cd /tmp/adl-setup && sf project deploy start --source-dir main/default/settings/EinsteinCopilot.settings-meta.xml --target-org $TARGET_ORG --json
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
If this fails, the org may not have the Agentforce license (`EinsteinGPTCopilotAddOn`). STOP and inform the user.
|
|
136
|
+
|
|
137
|
+
### 0b2. Enable Agent Platform
|
|
138
|
+
|
|
139
|
+
ADL SFDRIVE creation requires the `AgentPlatformEnabled` org preference in addition to `EinsteinGPTPlatformEnabled`. Deploy the AgentPlatform settings:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
cat > /tmp/adl-setup/main/default/settings/AgentPlatform.settings-meta.xml << 'EOF'
|
|
143
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
144
|
+
<AgentPlatformSettings xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
145
|
+
<enableAgentPlatform>true</enableAgentPlatform>
|
|
146
|
+
</AgentPlatformSettings>
|
|
147
|
+
EOF
|
|
148
|
+
cd /tmp/adl-setup && sf project deploy start --source-dir main/default/settings/AgentPlatform.settings-meta.xml --target-org $TARGET_ORG --json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Without this, `sf agent adl create --source-type sfdrive` returns: `"To create a File data library, enable Agentforce in your org. Required org preferences: EinsteinGPTPlatformEnabled, AgentPlatformEnabled."`
|
|
152
|
+
|
|
153
|
+
### 0c. Find required permission sets
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id, Name, Label FROM PermissionSet WHERE Name IN ('GenieAdmin', 'CopilotSalesforceAdmin') ORDER BY Name"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Note:
|
|
160
|
+
- `GenieAdmin` has Label "Data Cloud Architect" in the UI (do NOT query by `Name = 'DataCloudArchitect'` — that doesn't exist)
|
|
161
|
+
- `CopilotSalesforceAdmin` has Label "Agentforce Default Admin" in the UI
|
|
162
|
+
|
|
163
|
+
**Optional:** `PromptTemplateManager` / `PromptTemplatePermSet` is only needed for Prompt Builder UI access. It is NOT required for ADL knowledge grounding — preview, publish, and runtime all work without it.
|
|
164
|
+
|
|
165
|
+
### 0d. Get the current user ID
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
sf org display --target-org $TARGET_ORG --json
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Extract `userId` from the response.
|
|
172
|
+
|
|
173
|
+
### 0e. Assign Data Cloud Architect
|
|
174
|
+
|
|
175
|
+
Required to view Data Cloud Setup pages, manage data streams, search indexes, and retrievers.
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
sf data create record --sobject PermissionSetAssignment --target-org $TARGET_ORG --json \
|
|
179
|
+
--values "AssigneeId='<adminUserId>' PermissionSetId='<DataCloudArchitectId>'"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 0f. (Optional) Assign Prompt Template Manager
|
|
183
|
+
|
|
184
|
+
Only needed if the admin wants to use Prompt Builder UI. NOT required for ADL knowledge grounding.
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Skip this step unless the user needs Prompt Builder access.
|
|
188
|
+
# Requires EinsteinGPTPromptBuilderAddOn license on the org.
|
|
189
|
+
sf data create record --sobject PermissionSetAssignment --target-org $TARGET_ORG --json \
|
|
190
|
+
--values "AssigneeId='<adminUserId>' PermissionSetId='<PromptTemplateManagerId>'"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 0g. Assign CopilotSalesforceAdmin (Agentforce Default Admin)
|
|
194
|
+
|
|
195
|
+
Required to access Agentforce Studio, agent APIs, and author/publish agents. Without this, `sf agent preview` and `sf agent publish` return 503.
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
sf data create record --sobject PermissionSetAssignment --target-org $TARGET_ORG --json \
|
|
199
|
+
--values "AssigneeId='<adminUserId>' PermissionSetId='<CopilotSalesforceAdminId>'"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 0h. Verify assignments
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT PermissionSet.Name FROM PermissionSetAssignment WHERE AssigneeId = '<adminUserId>' AND PermissionSet.Name IN ('GenieAdmin', 'CopilotSalesforceAdmin')"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
Both should appear in the results (plus `PromptTemplateManager` if 0f was run). If the org shows a "Data Cloud standard permission sets have changed" banner in Setup, acknowledge it — Salesforce periodically updates DC permset structures.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Step 1 -- Enable Knowledge User on Running User
|
|
213
|
+
|
|
214
|
+
The current authenticated user needs the Knowledge User permission before any Knowledge operations.
|
|
215
|
+
|
|
216
|
+
First, get the current user ID:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
sf org display --target-org $TARGET_ORG --json
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Extract `userId` from the response. Then enable the Knowledge User permission:
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
sf data update record --sobject User --record-id <userId> --values "UserPermissionsKnowledgeUser=true" --target-org $TARGET_ORG --json
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Verification:**
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id, Username, UserPermissionsKnowledgeUser FROM User WHERE Id = '<userId>'"
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Confirm `UserPermissionsKnowledgeUser` is `true`.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Step 2 -- Enable Lightning Knowledge via Metadata Deploy
|
|
239
|
+
|
|
240
|
+
Lightning Knowledge must be enabled org-wide. Deploy via KnowledgeSettings metadata.
|
|
241
|
+
|
|
242
|
+
### 2a. Create a temporary deployment directory
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
mkdir -p /tmp/knowledge-settings/main/default/settings
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### 2b. Write the KnowledgeSettings metadata file
|
|
249
|
+
|
|
250
|
+
Create `/tmp/knowledge-settings/main/default/settings/Knowledge.settings-meta.xml`:
|
|
251
|
+
|
|
252
|
+
```xml
|
|
253
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
254
|
+
<KnowledgeSettings xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
255
|
+
<enableKnowledge>true</enableKnowledge>
|
|
256
|
+
<enableLightningKnowledge>true</enableLightningKnowledge>
|
|
257
|
+
</KnowledgeSettings>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 2c. Write a minimal sfdx-project.json
|
|
261
|
+
|
|
262
|
+
Create `/tmp/knowledge-settings/sfdx-project.json`:
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"packageDirectories": [
|
|
267
|
+
{ "path": "main/default", "default": true }
|
|
268
|
+
],
|
|
269
|
+
"sourceApiVersion": "62.0"
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 2d. Deploy
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
sf project deploy start --source-dir /tmp/knowledge-settings/main/default/settings --target-org $TARGET_ORG --json
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
**Important:** This is an org-wide settings change. If it fails with a permissions error, the user may need to enable Knowledge via Setup UI first (Setup > Knowledge Settings > Enable Knowledge).
|
|
280
|
+
|
|
281
|
+
### 2e. Verify
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
sf org open --target-org $TARGET_ORG --path "/lightning/setup/KnowledgeSettings/home" --json
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Or query for the Knowledge article object:
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT QualifiedApiName FROM EntityDefinition WHERE QualifiedApiName = 'Knowledge__kav'"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
If the query returns a result, Lightning Knowledge is enabled.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Step 3 -- Verify CRM Connector is Active
|
|
298
|
+
|
|
299
|
+
The CRM Connector (Home org connection) is required for Knowledge article indexing. It auto-activates when Data Cloud provisioning completes — no manual step needed on fresh orgs.
|
|
300
|
+
|
|
301
|
+
Verify it's active:
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
sf org open --target-org $TARGET_ORG --path "/lightning/setup/CdpSalesforceCrm/home" --json
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Check that the "Home" connection shows Status = `Active`.
|
|
308
|
+
|
|
309
|
+
**If not active (rare):** Navigate to Setup > Data Cloud > Salesforce CRM and click "Activate." This should only happen on sandbox orgs or orgs with non-standard DC provisioning.
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Step 4 -- Create Sample Knowledge Articles (Optional)
|
|
314
|
+
|
|
315
|
+
Creating sample articles is recommended for testing ADL grounding. Skip this step if the user already has articles or passes `--skip-sample-articles`.
|
|
316
|
+
|
|
317
|
+
### 4a. Create articles
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
sf data create record --sobject Knowledge__kav --values "Title='Getting Started with Our Product' UrlName='getting-started' Summary='This article covers the basics of setting up and using our product for the first time.'" --target-org $TARGET_ORG --json
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
sf data create record --sobject Knowledge__kav --values "Title='Troubleshooting Common Issues' UrlName='troubleshooting-common' Summary='Solutions for the most frequently reported problems including login failures, sync errors, and performance issues.'" --target-org $TARGET_ORG --json
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
sf data create record --sobject Knowledge__kav --values "Title='Account Management FAQ' UrlName='account-management-faq' Summary='Answers to common questions about creating accounts, managing users, resetting passwords, and billing.'" --target-org $TARGET_ORG --json
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### 4b. Publish articles
|
|
332
|
+
|
|
333
|
+
Articles must be published to be indexed. Use the KnowledgeManagement API:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
sf apex run --target-org $TARGET_ORG --json -f /dev/stdin <<'EOF'
|
|
337
|
+
List<Knowledge__kav> drafts = [SELECT Id, KnowledgeArticleId FROM Knowledge__kav WHERE PublishStatus = 'Draft'];
|
|
338
|
+
for (Knowledge__kav article : drafts) {
|
|
339
|
+
KbManagement.PublishingService.publishArticle(article.KnowledgeArticleId, true);
|
|
340
|
+
}
|
|
341
|
+
System.debug('Published ' + drafts.size() + ' articles.');
|
|
342
|
+
EOF
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### 4c. Verify published articles
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id, Title, PublishStatus, Language FROM Knowledge__kav WHERE PublishStatus = 'Online'"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Step 5 -- Verify Data Cloud Provisioning
|
|
354
|
+
|
|
355
|
+
ADL requires Data Cloud. Verify it is provisioned and can see Knowledge data:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT COUNT() FROM DataKnowledgeSpace"
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
If this returns a count > 0, Data Cloud recognizes the Knowledge data space.
|
|
362
|
+
|
|
363
|
+
If it fails or returns 0, Data Cloud may not be fully provisioned. Direct the user to:
|
|
364
|
+
1. Setup > Data Cloud Setup
|
|
365
|
+
2. Ensure provisioning is complete
|
|
366
|
+
3. Wait for the CRM Connector sync to complete (can take 5-15 minutes after activation)
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## Step 6 -- Set Up Agent User Permissions (Runtime)
|
|
371
|
+
|
|
372
|
+
For the agent to retrieve Knowledge at runtime, the Einstein Agent User needs proper permissions.
|
|
373
|
+
|
|
374
|
+
### 6a. Find or Create the Einstein Agent User
|
|
375
|
+
|
|
376
|
+
```bash
|
|
377
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id, Username, Name FROM User WHERE Profile.Name = 'Einstein Agent User' LIMIT 1"
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
If no agent user exists, **create one now** — it's needed for preview/testing, not just activation:
|
|
381
|
+
|
|
382
|
+
```bash
|
|
383
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id FROM Profile WHERE Name = 'Einstein Agent User'"
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
sf data create record --sobject User --target-org $TARGET_ORG --json \
|
|
388
|
+
--values "FirstName='Digital' LastName='Agent' Username='digitalagent.<orgId>@salesforce.com' Email='noreply@salesforce.com' Alias='dagent' ProfileId='<profileId>' TimeZoneSidKey='America/Los_Angeles' LocaleSidKey='en_US' LanguageLocaleKey='en_US' EmailEncodingKey='UTF-8'"
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
Replace `<orgId>` with the org's 18-character ID (from `sf org display`). The username must be globally unique.
|
|
392
|
+
|
|
393
|
+
**IMPORTANT:** `default_agent_user` is required in the `.agent` file even for "employee" agents when using `AnswerQuestionsWithKnowledge` with `--use-live-actions`. The platform treats any agent using the knowledge action as requiring an Einstein Agent User context at runtime.
|
|
394
|
+
|
|
395
|
+
### 6b. Assign required permission sets to agent user
|
|
396
|
+
|
|
397
|
+
The agent user needs THREE permsets for knowledge grounding to work at preview/runtime:
|
|
398
|
+
|
|
399
|
+
```bash
|
|
400
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id, Name, Label FROM PermissionSet WHERE Name IN ('GenieUserEnhancedSecurity', 'AgentforceServiceAgentUser') ORDER BY Name"
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
Assign both:
|
|
404
|
+
|
|
405
|
+
```bash
|
|
406
|
+
# Data Cloud access (retriever queries)
|
|
407
|
+
sf data create record --sobject PermissionSetAssignment --values "AssigneeId='<agentUserId>' PermissionSetId='<GenieUserEnhancedSecurityId>'" --target-org $TARGET_ORG --json
|
|
408
|
+
|
|
409
|
+
# Agent runtime access (required for preview sessions)
|
|
410
|
+
sf data create record --sobject PermissionSetAssignment --values "AssigneeId='<agentUserId>' PermissionSetId='<AgentforceServiceAgentUserId>'" --target-org $TARGET_ORG --json
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
Without `AgentforceServiceAgentUser`, preview returns "Unable to access the Salesforce Agent APIs" even when all other permissions are correct.
|
|
414
|
+
|
|
415
|
+
### 6c. Assign Knowledge FLS permission set
|
|
416
|
+
|
|
417
|
+
The agent user needs:
|
|
418
|
+
- **`AllowViewKnowledge` user permission** — critical, without this Knowledge fields are inaccessible regardless of FLS grants
|
|
419
|
+
- **Object-level Read** on `Knowledge__kav`
|
|
420
|
+
- **Field-level Read** on ALL `contentFields` configured in the ADL (note: field permissions on Knowledge__kav may be silently stripped by the platform for Einstein Agent User license — the `AllowViewKnowledge` permission is what actually grants access)
|
|
421
|
+
|
|
422
|
+
Deploy a permission set that includes all of these:
|
|
423
|
+
|
|
424
|
+
Deploy the Knowledge access permission set:
|
|
425
|
+
|
|
426
|
+
```bash
|
|
427
|
+
mkdir -p /tmp/adl-setup/main/default/permissionsets
|
|
428
|
+
cat > /tmp/adl-setup/main/default/permissionsets/KnowledgeAgentAccess.permissionset-meta.xml << 'EOF'
|
|
429
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
430
|
+
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
431
|
+
<label>Knowledge Agent Access</label>
|
|
432
|
+
<userPermissions>
|
|
433
|
+
<enabled>true</enabled>
|
|
434
|
+
<name>AllowViewKnowledge</name>
|
|
435
|
+
</userPermissions>
|
|
436
|
+
<objectPermissions>
|
|
437
|
+
<allowRead>true</allowRead>
|
|
438
|
+
<object>Knowledge__kav</object>
|
|
439
|
+
<viewAllRecords>true</viewAllRecords>
|
|
440
|
+
</objectPermissions>
|
|
441
|
+
</PermissionSet>
|
|
442
|
+
EOF
|
|
443
|
+
cd /tmp/adl-setup && sf project deploy start --source-dir main/default/permissionsets --target-org $TARGET_ORG --json
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Then assign to the agent user:
|
|
447
|
+
|
|
448
|
+
```bash
|
|
449
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id FROM PermissionSet WHERE Name = 'KnowledgeAgentAccess'"
|
|
450
|
+
sf data create record --sobject PermissionSetAssignment --target-org $TARGET_ORG --json \
|
|
451
|
+
--values "AssigneeId='<agentUserId>' PermissionSetId='<KnowledgeAgentAccessId>'"
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
**CRITICAL:** The `AllowViewKnowledge` user permission is what actually grants Knowledge field access for the Einstein Agent User license. Raw field-level permissions get silently stripped by the platform for this license type. The `AllowViewKnowledge` + `viewAllRecords` combination grants access through a different mechanism that works.
|
|
455
|
+
|
|
456
|
+
### 6d. Verify language alignment
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Id, LanguageLocaleKey FROM User WHERE Name = 'Einstein Agent User'"
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
sf data query --target-org $TARGET_ORG --json -q "SELECT Language, COUNT(Id) cnt FROM Knowledge__kav WHERE PublishStatus = 'Online' GROUP BY Language"
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**CRITICAL -- Language Filter:** The retriever filters indexed chunks by language. The article `Language` field MUST match the agent user's language context. Even `en_US` vs `en_GB` causes a mismatch and returns zero results. Reference: W-21956266.
|
|
467
|
+
|
|
468
|
+
If there is a mismatch:
|
|
469
|
+
- Update article language to match the agent user locale, OR
|
|
470
|
+
- Update the agent user locale to match the articles
|
|
471
|
+
|
|
472
|
+
```bash
|
|
473
|
+
sf data update record --sobject User --record-id <agentUserId> --values "LanguageLocaleKey='en_US'" --target-org $TARGET_ORG --json
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
---
|
|
477
|
+
|
|
478
|
+
## Verification Checklist
|
|
479
|
+
|
|
480
|
+
After completing all steps, verify the full setup:
|
|
481
|
+
|
|
482
|
+
| Check | Command | Expected |
|
|
483
|
+
|-------|---------|----------|
|
|
484
|
+
| Knowledge User enabled | Query User.UserPermissionsKnowledgeUser | `true` |
|
|
485
|
+
| Lightning Knowledge active | Query EntityDefinition for Knowledge__kav | Row returned |
|
|
486
|
+
| CRM Connector active | Query DataSourceInstance WHERE Type='CRM' | Status = Active |
|
|
487
|
+
| Published articles exist | Query Knowledge__kav WHERE PublishStatus='Online' | Count > 0 |
|
|
488
|
+
| Data Cloud sees Knowledge | Query DataKnowledgeSpace | Count > 0 |
|
|
489
|
+
| Agent user has permissions | Query PermissionSetAssignment for agent user | DC + Knowledge permsets assigned |
|
|
490
|
+
| Language alignment | Compare User.LanguageLocaleKey vs article Language | Match |
|
|
491
|
+
|
|
492
|
+
---
|
|
493
|
+
|
|
494
|
+
## Troubleshooting
|
|
495
|
+
|
|
496
|
+
### "Knowledge is not enabled in this org"
|
|
497
|
+
|
|
498
|
+
- Ensure Step 2 metadata deploy succeeded
|
|
499
|
+
- Try enabling manually: Setup > Knowledge Settings > Enable Knowledge
|
|
500
|
+
- Some org editions require a specific license SKU
|
|
501
|
+
|
|
502
|
+
### "INVALID_FIELD: UserPermissionsKnowledgeUser"
|
|
503
|
+
|
|
504
|
+
- The org may not have the Knowledge feature license provisioned
|
|
505
|
+
- Check: `sf data query --target-org $TARGET_ORG --json -q "SELECT Id FROM UserLicense WHERE Name = 'Knowledge Only'"`
|
|
506
|
+
|
|
507
|
+
### Articles not appearing in ADL after indexing
|
|
508
|
+
|
|
509
|
+
- Verify articles are Published (not Draft)
|
|
510
|
+
- Check language alignment (most common cause -- see Step 6d)
|
|
511
|
+
- Verify CRM Connector sync completed
|
|
512
|
+
- Wait 5-15 minutes after publishing for Data Cloud sync
|
|
513
|
+
|
|
514
|
+
### "Insufficient access" when agent retrieves Knowledge
|
|
515
|
+
|
|
516
|
+
- Verify object-level Read on Knowledge__kav (not just field-level)
|
|
517
|
+
- Verify field-level Read on ALL configured contentFields
|
|
518
|
+
- Check the GenieUserEnhancedSecurity permset is assigned to the agent user
|
|
519
|
+
|
|
520
|
+
---
|
|
521
|
+
|
|
522
|
+
## Known Issues and Notes
|
|
523
|
+
|
|
524
|
+
- **Language filter (W-21956266)**: Retriever filters chunks by language. Even minor locale variants (en_US vs en_GB) cause zero results. Always verify alignment.
|
|
525
|
+
- **Knowledge FLS for Einstein Agent User**: Raw field-level permissions are silently stripped by the platform for the Einstein Agent license. The correct fix is `AllowViewKnowledge` user permission + `viewAllRecords: true` on Knowledge__kav. Do NOT attempt individual field grants.
|
|
526
|
+
- **CRM Connector**: Auto-activates when Data Cloud provisioning completes. No manual step needed on fresh orgs. Only check manually if DC provisioning completed but Knowledge indexing fails.
|
|
527
|
+
- **Intermittent DNS failures for api.salesforce.com**: The SF CLI's Node.js process (with @mswjs/interceptors) can intermittently fail DNS for `api.salesforce.com`. If `sf agent preview start` alternates between ENOTFOUND and 404 "Unable to access Agent APIs" — retry. The underlying DNS works (verifiable with `nslookup`), it's an MSW interception issue. Set `SF_DISABLE_MSW=1` if using a linked plugin.
|
|
528
|
+
- **Data Cloud provisioning time**: First-time DC provisioning can take 30 min – 2 hours. The skill cannot speed this up.
|
|
529
|
+
- **SFDRIVE doesn't need Knowledge**: Steps 1-4 (Knowledge enablement) are only required for KNOWLEDGE source type. SFDRIVE and RETRIEVER only need Data Cloud (Step 5) and agent user setup (Step 6).
|
|
530
|
+
- **default_agent_user required for knowledge agents**: Even "employee" type agents require `default_agent_user` in the `.agent` file when using `AnswerQuestionsWithKnowledge` with live actions. The platform treats it as needing an Einstein Agent User context at runtime.
|
|
531
|
+
- **Always specify contentFields explicitly**: When creating a KNOWLEDGE ADL, always pass `--content-fields "Summary,Answer__c"` (or your fields). If `contentFields` is empty, the retriever checks FLS on ALL Knowledge fields at query time — if even one non-required field is inaccessible, you get `INSUFFICIENT_ACCESS`.
|
|
532
|
+
- **Agentforce Studio URL**: The correct path is `/lightning/setup/EinsteinCopilot/home` (not `/lightning/setup/CopilotStudio/home`).
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## Next Steps
|
|
537
|
+
|
|
538
|
+
Once setup is complete, use `/agentforce-generate` to create a knowledge-grounded agent:
|
|
539
|
+
|
|
540
|
+
```text
|
|
541
|
+
You: Create a knowledge-grounded agent from ~/docs/manual.pdf on org myOrg
|
|
542
|
+
→ Skill routes to SFDRIVE, provisions ADL, wires into agent
|
|
543
|
+
|
|
544
|
+
You: Ground my agent on Knowledge articles on org myOrg
|
|
545
|
+
→ Skill routes to KNOWLEDGE, creates library, indexes articles
|
|
546
|
+
|
|
547
|
+
You: Use custom retriever 1CxXXX on org myOrg
|
|
548
|
+
→ Skill routes to RETRIEVER, wraps retriever, immediately ready
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
For all source types, the `/agentforce-generate` skill handles ADL creation, wiring, preview, and publish automatically — this setup skill just ensures the org is ready for it.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Patterns by Requirement
|
|
2
|
+
|
|
3
|
+
Use this guide to choose patterns based on product requirements, not topology labels.
|
|
4
|
+
|
|
5
|
+
Default shape:
|
|
6
|
+
|
|
7
|
+
- One `start_agent <domain>:` execution block and zero `subagent` blocks unless
|
|
8
|
+
a boundary changes objective, instructions, actions, authority, or escalation
|
|
9
|
+
behavior and cannot remain coherent in the current scope
|
|
10
|
+
- Router-first architecture only when multiple genuine domains require
|
|
11
|
+
current-intent classification
|
|
12
|
+
- Subagent-specific posture (scripted, mixed, agentic)
|
|
13
|
+
- Deterministic controls only where justified
|
|
14
|
+
|
|
15
|
+
Read this file first when deciding architecture and flow patterns. Then use:
|
|
16
|
+
|
|
17
|
+
- `references/architecture-patterns.md` for architecture mechanics and migration guidance
|
|
18
|
+
- `assets/patterns/` for concrete pattern snippets
|
|
19
|
+
|
|
20
|
+
## Quick Selection Table
|
|
21
|
+
|
|
22
|
+
| Requirement / Scenario | Recommended Pattern | Why | Reference Assets |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| Multiple genuine domains need different instructions, actions, authority, or escalation | Router-first architecture; consider HyperClassifier for a transition-only router when latency matters | Separates incompatible domain scopes and classifies current intent without turning a conversational node into a router | `references/architecture-patterns.md`, `assets/agents/router-first.agent`, `assets/agents/template-multi-subagent.agent` |
|
|
25
|
+
| Identity/trust gate before protected operations | Verification gate | Enforces trusted action output before sensitive actions; does not require a generic focus lock | `references/architecture-patterns.md` |
|
|
26
|
+
| Need deterministic follow-up after action | Action callbacks (`run`) | Guarantees ordered post-action execution | `assets/patterns/action-callbacks.agent` |
|
|
27
|
+
| Need deterministic setup/cleanup around a turn | Lifecycle events | Runs once before and once after the turn's reasoning loop | `assets/patterns/lifecycle-events.agent` |
|
|
28
|
+
| Need specialist consultation and return | Bidirectional routing/delegation | Keeps workflow continuity across subagents | `assets/patterns/bidirectional-routing.agent`, `assets/patterns/delegation-routing.agent` |
|
|
29
|
+
| Complex action input strategy required | Advanced input bindings | Mixes slot filling, variable binding, output chaining | `assets/patterns/advanced-input-bindings.agent`, `assets/patterns/critical-input-collection.agent` |
|
|
30
|
+
| Controlled output changes the prompt | Context-aware instruction layering | Resolves a branch from trusted action output or a named invariant | `assets/patterns/system-instruction-overrides.agent`, `assets/patterns/procedural-instructions.agent` |
|
|
31
|
+
| External process requires ordered successful actions | Outcome-driven gates | Makes the next action available only after the prior external action succeeds | `references/architecture-patterns.md`, `assets/patterns/multi-step-workflow.agent` |
|
|
32
|
+
| Prefer LLM-led flexibility with minimal pinning | LLM-controlled actions | Keeps implementation agentic by default | `assets/patterns/llm-controlled-actions.agent` |
|
|
33
|
+
| Prompt-template-backed action usage | Prompt template action pattern | Standardized prompt action wiring | `assets/patterns/prompt-template-action.agent` |
|
|
34
|
+
|
|
35
|
+
## Decision Rules
|
|
36
|
+
|
|
37
|
+
1. **Choose posture first (per subagent).**
|
|
38
|
+
- Start agentic.
|
|
39
|
+
- Move scripted only when required by regulation, authorization, confirmed
|
|
40
|
+
consequence, external ordering, or observed failure.
|
|
41
|
+
- See `references/posture-and-determinism.md`.
|
|
42
|
+
|
|
43
|
+
2. **Choose architecture second.**
|
|
44
|
+
- Start with one domain `start_agent` and zero `subagent` blocks.
|
|
45
|
+
- Never add a router that only transitions to that one domain.
|
|
46
|
+
- Add a router only for multiple genuine domains.
|
|
47
|
+
- Use HyperClassifier only when that router can remain transition-only; keep
|
|
48
|
+
an ordinary model when the entry node must converse or run other actions.
|
|
49
|
+
- Add verification gates for protected operations.
|
|
50
|
+
- Add workflow-local sequencing only for externally ordered outcomes.
|
|
51
|
+
|
|
52
|
+
3. **Choose implementation patterns third.**
|
|
53
|
+
- Add lifecycle/callback/input-binding patterns to solve concrete behavior gaps.
|
|
54
|
+
- Prefer the smallest pattern that satisfies the requirement.
|
|
55
|
+
|
|
56
|
+
## Common Compositions
|
|
57
|
+
|
|
58
|
+
### Multi-Domain Protected Service
|
|
59
|
+
|
|
60
|
+
- Router-first architecture
|
|
61
|
+
- Verification gate for protected actions
|
|
62
|
+
- Input pinning only for trusted values consumed by protected actions
|
|
63
|
+
|
|
64
|
+
### Regulated Flow
|
|
65
|
+
|
|
66
|
+
- One subagent unless the regulated work contains genuine additional domains
|
|
67
|
+
- Verification gate
|
|
68
|
+
- Scripted controls only for regulated decisions
|
|
69
|
+
- Action callbacks for deterministic post-action chain
|
|
70
|
+
|
|
71
|
+
### Open-Ended Assistant
|
|
72
|
+
|
|
73
|
+
- One agentic subagent unless genuine domain boundaries require more
|
|
74
|
+
- Minimal deterministic controls
|
|
75
|
+
- LLM-controlled actions and selective input pinning
|
|
76
|
+
|
|
77
|
+
## Anti-Patterns
|
|
78
|
+
|
|
79
|
+
- Modeling the entire agent as linear when only one workflow needs sequencing
|
|
80
|
+
- Creating a separate router subagent instead of using `start_agent agent_router`
|
|
81
|
+
- Creating greeting, cancellation, completion, off-topic, or ambiguity
|
|
82
|
+
subagents when one existing scope can handle those branches coherently
|
|
83
|
+
- Routing every turn back to router by default instead of using direct subagent transitions when workflow intent is clear
|
|
84
|
+
- Overusing deterministic controls without requirement or observed failure
|
|
85
|
+
- Pinning all action inputs by default instead of using `...` where safe
|
|
86
|
+
- Persisting names, preferences, questions asked, or dialogue stages that
|
|
87
|
+
surviving conversation history already contains
|
|
88
|
+
- Adding a variable without a trusted writer, named consumer, and lifecycle
|