PluginBench
Skill
Fail
Audit score 45

implementing-ui-bundle-agentforce-conversation-client

forcedotcom/sf-skills

Embed and configure Agentforce Conversation Client in UI Bundle projects.

What is implementing-ui-bundle-agentforce-conversation-client?

This skill adds, embeds, configures, styles, or removes the AgentforceConversationClient component in Salesforce UI Bundle projects. Use it when you need to integrate a chat widget or conversational AI agent into an existing UI Bundle with a uiBundles/*/src/ directory structure.

  • Embed the AgentforceConversationClient component into React pages or shared shells
  • Validate and resolve agent IDs against your Salesforce org using SOQL queries
  • Configure component props including agentId, styling, and behavior options
  • Update or replace existing agent configurations without recreating components
  • Validate agent ID format (0Xx[a-zA-Z0-9]{15}) and check agent activation status

How to install implementing-ui-bundle-agentforce-conversation-client

npx skills add https://github.com/forcedotcom/sf-skills --skill implementing-ui-bundle-agentforce-conversation-client
Prerequisites
  • UI Bundle project with uiBundles/*/src/ directory structure
  • Salesforce CLI (sf) installed and authenticated to your org, or manual agent ID
  • At least one active Employee Agent configured in Salesforce Setup → Agentforce Agents
  • For local development: trusted domain entry (localhost:5173) added in Session Settings
Claude Code
Cursor
Windsurf
Cline

How to use implementing-ui-bundle-agentforce-conversation-client

  1. 1.Search for existing AgentforceConversationClient usage in your app files using grep
  2. 2.If found, validate the current agentId format (must match ^0Xx[a-zA-Z0-9]{15}$)
  3. 3.If agentId is missing or invalid, query your org for active agents using SOQL
  4. 4.Select or confirm the correct agent ID from the list of active agents
  5. 5.Import AgentforceConversationClient from @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client and render it with the validated agentId prop
  6. 6.Update any additional props (styling, behavior) as needed and test in your dev environment

Use cases

Good for
  • Adding a chat widget to a customer-facing portal or internal app page
  • Switching to a different active agent in an existing UI Bundle project
  • Configuring trusted domains for local development and testing
  • Updating conversation client styling or props in an existing implementation
  • Verifying that a configured agent ID exists and is active in your org
Who it's for
  • Salesforce developers building UI Bundles with React
  • Teams integrating Agentforce agents into existing web applications
  • Developers managing chat widget configurations across multiple pages

implementing-ui-bundle-agentforce-conversation-client FAQ

What if I don't have the Salesforce CLI installed?

The skill can guide you through installation via npm install -g @salesforce/cli, or you can manually find your agent ID in Setup → Agentforce Agents by clicking the agent name and copying the ID from the URL.

Can I create a custom chat widget instead of using AgentforceConversationClient?

No. This skill only works with the existing AgentforceConversationClient component. Custom chat widget components are out of scope.

What if my agent ID is configured but the component isn't working?

First, verify the agent ID is active in your org (Setup → Agentforce Agents). If inactive, activate it in Agent Builder. Also ensure your org is authenticated via sf CLI and trusted domains are configured for local development.

Do I need to remove the trusted domain entry before production?

Yes. The trusted domain entry for localhost:5173 is only for local development and should be removed before deploying to production.

What if no active agents are found in my org?

Create an Employee Agent in Setup → Agentforce Agents, then activate it in Agent Builder before proceeding.

Full instructions (SKILL.md)

Source of truth, from forcedotcom/sf-skills.


name: implementing-ui-bundle-agentforce-conversation-client description: "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." metadata: version: "1.1" package: "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client" sdk-package: "@salesforce/agentforce-conversation-client"

Managing 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.

Prerequisites

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):

  • Setup → Session Settings → Trusted Domains for Inline Frames → Add your domain
    • Local development: localhost:5173 (default Vite dev server port)
    • Warning: Remove this trusted domain entry before deploying to production.

Instructions

Step 1: Check if component already exists

Search for existing usage across all app files (not implementation files):

grep -r "AgentforceConversationClient" --include="*.tsx" --include="*.jsx" --exclude-dir=node_modules

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):

  • Valid only if it matches: ^0Xx[a-zA-Z0-9]{15}$
  • Meaning: starts with 0Xx and total length is 18 characters

Decision:

  • If agentId matches ^0Xx[a-zA-Z0-9]{15}$ and user wants to update other props → Go to Step 4 (update props)
  • If 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?"
    • Change agent → Step 2
    • Update props → Step 4b
  • If agentId is missing, empty, or does NOT match ^0Xx[a-zA-Z0-9]{15}$ → Continue to Step 2 (need real ID)
  • If not found → Continue to Step 2 (add new)

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.

Step 2: Resolve and Validate Agent ID

Prerequisites

  1. Verify sf CLI is available:

    sf --version
    

    If fails:

    • Inform: "The Salesforce CLI (sf) is not installed. It's needed to query available agents from your org."
    • Ask: "Would you like me to install it?"
      • Yes → Install via npm install -g @salesforce/cli, then continue.
      • No → "You can find your agent ID manually in Setup → Agentforce Agents → click the agent name → copy the ID from the URL. Would you like to provide it now, or skip this step?"
        • User provides ID → validate format (^0Xx[a-zA-Z0-9]{15}$), store it, proceed to Step 3.
        • Skip → proceed to Step 4 with placeholder <YOUR_AGENT_ID>.
  2. Verify org connectivity:

    sf org display --json
    

    If fails:

    • Inform: "No authenticated org found."
    • Ask: "Would you like to connect to your org now? Run sf org login web to authenticate."
      • User authenticates → retry the query, continue.
      • User declines → "You can find your agent ID manually in Setup → Agentforce Agents → click the agent name → copy the ID from the URL. Would you like to provide it now, or skip this step?"
        • User provides ID → validate format, store it, proceed to Step 3.
        • Skip → proceed to Step 4 with placeholder <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.

Query all Employee Agents

Run the SOQL query defined in references/agent-id-resolution.md.

Handle results

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?

  1. Property Manager Agent (0Xxxx0000000001CAA)
  2. HR Assistant (0Xxxx0000000002BBB)
  • One agent → still confirm with user, do not auto-select.
  • If user picks one → store the selected Id for use in Step 4.
  • If user declines to pick ("skip", "no", "I don't want to set one") → accept it and move to next steps. Do not re-ask. In Step 4, use placeholder <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:

  • ID found, agent is Active → "Agent ID maps to 'Property Manager Agent' — active in the org." Proceed.
  • ID found, agent is Inactive → "The configured agent 'Sales Agent' exists but is Inactive. To activate: Setup → Agentforce Agents → click the agent name → open in Agent Builder → press Activate. Or pick a different active agent:" → show active list.
  • ID not found at all → "The configured agent (0Xxxx...) doesn't exist in this org — it may have been deleted or belongs to a different org. Pick a replacement:" → show active list. If no active agents available, show inactive list with activation instructions.

If user reported an error → surface the agent name even if active, so user can confirm it's the intended one.

Query error handling

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."

What this step does NOT do

  • No fallback to GraphQL or Tooling API — SOQL only
  • No auto-selection (always confirm with user)
  • No programmatic activation (only via Setup UI)
  • No file writes (that's Step 4)

Step 3: Canonical import strategy

Use this import path by default in app code:

import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";

If the package is not installed, install it:

npm install @salesforce/ui-bundle-template-feature-react-agentforce-conversation-client

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.

Step 4: Add or update component

Determine which sub-step applies:

  • Component NOT found in Step 1 → go to 4a (New installation)
  • Component found in Step 1 → go to 4b (Update existing)

4a — New installation

  1. If the user already specified a target file, use that file. Otherwise, ask the user: "Which file should I add the AgentforceConversationClient to?" Do NOT proceed until a target file is confirmed.
  2. Read the target file to understand its existing imports and TSX structure.
  3. Add the import at the top of the file, alongside existing imports. Use the canonical package import from Step 3:
import { AgentforceConversationClient } from "@salesforce/ui-bundle-template-feature-react-agentforce-conversation-client";
  1. Insert the <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:

<AgentforceConversationClient agentId="0Xx8X00000001AbCDE" />

Without resolved agentId (user skipped):

<AgentforceConversationClient agentId="<YOUR_AGENT_ID>" />
  1. Do NOT add any other code (wrappers, layout components, new functions) unless the user explicitly requests it.

4b — Update existing

  1. Read the file identified in Step 1.
  2. Locate the existing <AgentforceConversationClient ... /> TSX element.
  3. Apply only the changes the user requested. Rules:
    • Add new props that the user asked for.
    • Change prop values the user asked to update.
    • Preserve every prop and value the user did NOT mention — do not remove, reorder, or reformat them.
    • Never delete the component and recreate it.
  4. If Step 2 was triggered (cross-check or fresh selection) and a new agent ID was resolved, replace the existing agentId value with the new one.
  5. If the current agentId is already valid and the user did not ask to change it and Step 2 confirmed it is active, leave it as-is.

Post-Step-4 error handling

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.

Step 5: Configure props

Available props (use directly on component):

  • agentId (string, required) - Salesforce agent ID
  • inline (boolean) - true for inline mode, omit for floating
  • width (number | string) - e.g., 420 or "100%"
  • height (number | string) - e.g., 600 or "80vh"
  • headerEnabled (boolean) - Show/hide header
  • styleTokens (object) - For all styling (colors, fonts, spacing)
  • salesforceOrigin (string) - Auto-resolved
  • frontdoorUrl (string) - Auto-resolved
  • agentLabel (string) - header title for agent

Examples:

Floating mode (default):

<AgentforceConversationClient agentId="0Xx..." />

Inline mode with dimensions:

<AgentforceConversationClient agentId="0Xx..." inline width="420px" height="600px" />

Adding or updating agent label:

<AgentforceConversationClient agentId="0Xx..." agentLabel="<dummy-agent-label>" />

Styling rules (mandatory):

  • ALL visual customization (colors, fonts, spacing, borders, radii, shadows) MUST go through the styleTokens prop. There are no exceptions.
  • ONLY use token names listed in the tables below. Do NOT invent custom token names.
  • NEVER apply styling via CSS files, style attributes, className, or wrapper elements. These approaches will not work and will be ignored by the component.
  • If the user requests a visual change that does not map to a token below, inform them that the change is not supported by the current token set.

For the complete list of available style tokens, consult references/style-tokens.md.

For complex patterns, consult references/examples.md for:

  • Sidebar containers and responsive sizing
  • Dark theme and advanced theming combinations
  • Inline without header, calculated dimensions
  • Complete host component examples

Common mistakes to avoid: Consult references/constraints.md for:

  • Invalid props (containerStyle, style, className)
  • Invalid styling approaches (CSS files, style tags)
  • What files NOT to edit (implementation files)

Common Issues

If component doesn't appear or authentication fails, see references/troubleshooting.md for:

  • Agent activation and deployment
  • Localhost trusted domains
  • Cookie restriction settings

Reference File Index

FileWhen to read
references/agent-id-resolution.mdStep 2 — SOQL query structure, response format, activation path, manual lookup
references/style-tokens.mdStep 5 — Complete style token reference for all UI areas
references/examples.mdStep 5 — Layout patterns, sizing, theming combinations, host component examples
references/constraints.mdStep 4 — Invalid props, invalid styling approaches, files not to edit
references/troubleshooting.mdPost-setup — Agent activation, trusted domains, cookie settings

Related skills

More from forcedotcom/sf-skills and the wider catalog.

IMimplementing-ui-bundle-file-upload logo

implementing-ui-bundle-file-upload

forcedotcom/sf-skills

Programmatic file upload API with progress tracking for Salesforce UI bundles.

2.1k installsAudited
INintegrating-b2b-commerce-open-code-components logo

integrating-b2b-commerce-open-code-components

forcedotcom/sf-skills

Integrate Salesforce B2B Commerce open source components into your store's Experience Builder.

1.6k installs
INinvestigating-agentforce-architecture logo

investigating-agentforce-architecture

forcedotcom/sf-skills

Declared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins. Renders a human-readable architecture document and Mermaid invocation graph from design-time metadata (not runtime audit rows). TRIGGER when user asks to describe, diagram, inventory, audit, document, or diff (e.g. v3 vs v5) the architecture / action tree / topic structure / tool inventory of a specific agent by agent API name in a specific org. DO NOT TRIGGER for runtime session traces, conversation transcripts, generation timings, or gateway audit chains — this skill reads design-time metadata only (use investigating-agentforce-d360 for session traces).

836 installs
INinvestigating-agentforce-d360 logo

investigating-agentforce-d360

forcedotcom/sf-skills

Data Cloud 360° view of a single Agentforce session. TRIGGER when user asks to trace, inspect, summarize, or describe a specific Agentforce session by session id (Agent Session UUID `019d…` or MessagingSession id `0Mw…`). Also triggers on session discovery — find/list/search sessions by time, agent, channel, outcome, or conversation text — when the user has no session id yet. DO NOT TRIGGER for design-time architecture questions (use investigating-agentforce-architecture instead) or for runtime perf/latency/SLO questions that require platform telemetry beyond Data Cloud.

822 installs
MAmanaging-managed-event-subscription logo

managing-managed-event-subscription

forcedotcom/sf-skills

Create, read, update, and delete ManagedEventSubscription metadata in Salesforce. Use this skill for any work involving managed event subscriptions, platform event subscriptions, event channel subscribers, or .managedEventSubscription-meta.xml files. TRIGGER when: user asks to subscribe to a platform event, create a managed subscription, set up event replay, configure an event channel subscriber, update replay preset, activate or deactivate a subscription, delete a subscription, or manage ManagedEventSubscription metadata. SKIP when: user needs to create the platform event channel itself (use generating-platform-event skill) or needs Flow-based event subscriptions (use generating-flow skill).

820 installsAudited
MOmodeling-omnistudio-epc-catalog logo

modeling-omnistudio-epc-catalog

forcedotcom/sf-skills

Model Salesforce Industries EPC product bundles, attributes, and offer metadata with DataPack JSON templates.

1.9k installsAudited