npx skills add ...
npx skills add forcedotcom/sf-skills --skill implementing-ui-bundle-agentforce-conversation-client
Use this skill when the user asks to add, embed, integrate, configure, style, or remove an agent, chatbot, chat widget, conversation client, or AI assistant in a UI Bundle project. TRIGGER when: project contains a uiBundles/*/src/ directory and the task involves adding or modifying a chat widget, chatbot, or conversational AI; files under uiBundles/*/src/ import AgentforceConversationClient; user asks to add any chat or agent functionality to a page. DO NOT TRIGGER when: user wants to create a custom agent, chatbot, or chat widget component from scratch; the project has no uiBundles directory.
npx skills add forcedotcom/sf-skills --skill implementing-ui-bundle-agentforce-conversation-client
HARD CONSTRAINT: NEVER create a custom agent, chatbot, or chat widget component. ALL such requests MUST be fulfilled by importing and rendering the existing <AgentforceConversationClient /> from @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client as documented below. If a requirement is unsupported by this component's props, state the limitation — do not improvise an alternative.
Before the component will work, the following Salesforce settings must be configured by the user. ALWAYS call out the prequisites after successfully embedding the agent.
Trusted domains (required only for local development):
localhost:5173 (default Vite dev server port)Search for existing usage across all app files (not implementation files):
Important: Look for React files that import and USE the component (for example, shared shells, route components, or feature pages). Do NOT open files named AgentforceConversationClient.tsx or AgentforceConversationClient.jsx - those are the component implementation.
If multiple files found: Ask the user which component file they are referring to. Do not proceed until clarified.
If found: Read the file and check the current agentId value.
Agent ID validation rule (deterministic):
^0Xx[a-zA-Z0-9]{15}$0Xx and total length is 18 charactersDecision:
agentId matches ^0Xx[a-zA-Z0-9]{15}$ and user wants to update other props → Go to Step 4 (update props)agentId matches ^0Xx[a-zA-Z0-9]{15}$ and user asks to "embed" or "add" the chat client → Inform: "The Agentforce Conversation Client is already embedded in <file> with agent ID <agentId>. Would you like to change the agent or update other props?"
agentId is missing, empty, or does NOT match ^0Xx[a-zA-Z0-9]{15}$ → Continue to Step 2 (need real ID)If user reports an error:
If the user says the component is "not working", "showing an error", or similar — ask them for the specific error message. Then proceed to Step 2 to cross-check the configured agentId against the org.
Verify sf CLI is available:
If fails:
sf) is not installed. It's needed to query available agents from your org."npm install -g @salesforce/cli, then continue.^0Xx[a-zA-Z0-9]{15}$), store it, proceed to Step 3.<YOUR_AGENT_ID>.Verify org connectivity:
If fails:
sf org login web to authenticate."
<YOUR_AGENT_ID>.Note: Even if the user provides their own agentId, the org must be connected for the agent to function at runtime. An agentId without a connected org will not work.
Run the SOQL query defined in references/agent-id-resolution.md.
No records at all:
"No Employee Agents found in this org. Create one in Setup → Agentforce Agents."
Ask user if they want to provide an agent ID manually or skip. If skip, proceed to Step 4 with placeholder <YOUR_AGENT_ID>.
All agents are inactive:
Found Employee Agents but none are active:
- Agentforce Sales Agent (0Xxxx000000001dCAA)
- HR Assistant (0Xxxx0000000002BBB)
To activate: Setup → Agentforce Agents → click the agent name → open in Agent Builder → press Activate. Then re-run this step.
Ask user if they want to provide an agent ID manually or skip. If skip, proceed to Step 4 with placeholder <YOUR_AGENT_ID>.
Has active agents — Path A (fresh install / no existing agentId):
Present only active agents for selection:
Which agent should the chat widget use?
- Property Manager Agent (0Xxxx0000000001CAA)
- HR Assistant (0Xxxx0000000002BBB)
Id for use in Step 4.<YOUR_AGENT_ID> for fresh installs. For existing projects, leave the component as-is.Has active agents — Path B (existing agentId from Step 1, passed format check):
Cross-check the existing agentId against query results:
If user reported an error → surface the agent name even if active, so user can confirm it's the intended one.
If the SOQL query fails, surface the error message from the response directly to the user. Do not guess at the fix — just report what came back. For example:
"The query failed with:
[error message from response]. Check your org permissions or that the API version supports this object."
Use this import path by default in app code:
If the package is not installed, install it:
Only use a local relative import (for example, ./components/AgentforceConversationClient) when the user explicitly asks to use a patched/local component in that app.
Do not infer import path from file discovery alone. Prefer one consistent package import across the codebase.
Determine which sub-step applies:
<AgentforceConversationClient /> TSX into the component's return block. Place it as a sibling of existing content — do NOT wrap or restructure existing TSX. Use the real agentId obtained in Step 2. If no agentId was resolved (user skipped Step 2), use the placeholder:With resolved agentId:
Without resolved agentId (user skipped):
<AgentforceConversationClient ... /> TSX element.agentId is already valid and the user did not ask to change it and Step 2 confirmed it is active, leave it as-is.If the user reports an error after the component has been set up (e.g., "it's not working", "I see an error"), go to Step 2 to validate the configured agentId against the org. Cross-check whether the agent is active, exists, and belongs to the connected org.
Available props (use directly on component):
agentId (string, required) - Salesforce agent IDinline (boolean) - true for inline mode, omit for floatingwidth (number | string) - e.g., 420 or "100%"height (number | string) - e.g., 600 or "80vh"headerEnabled (boolean) - Show/hide headerstyleTokens (object) - For all styling (colors, fonts, spacing)salesforceOrigin (string) - Auto-resolvedfrontdoorUrl (string) - Auto-resolvedagentLabel (string) - header title for agentExamples:
Floating mode (default):
Inline mode with dimensions:
Adding or updating agent label:
Styling rules (mandatory):
styleTokens prop. There are no exceptions.style attributes, className, or wrapper elements. These approaches will not work and will be ignored by the component.For the complete list of available style tokens, consult references/style-tokens.md.
For complex patterns, consult references/examples.md for:
Common mistakes to avoid: Consult references/constraints.md for:
If component doesn't appear or authentication fails, see references/troubleshooting.md for:
| File | When to read |
|---|---|
references/agent-id-resolution.md | Step 2 — SOQL query structure, response format, activation path, manual lookup |
references/style-tokens.md | Step 5 — Complete style token reference for all UI areas |
references/examples.md | Step 5 — Layout patterns, sizing, theming combinations, host component examples |
references/constraints.md | Step 4 — Invalid props, invalid styling approaches, files not to edit |
references/troubleshooting.md | Post-setup — Agent activation, trusted domains, cookie settings |