Loading
Prepare for Email to Become the Default Login ExperienceRead More
Get Started with B2C Commerce
Add Custom Subagents and Custom Actions

Add Custom Subagents and Custom Actions

The Shopper Agent subagents manage the transactional shopping experience. If you want a capability that isn't in the subagent template, create a custom one.

Custom subagents use their own node so you can define strict, domain-specific behavior. You define content rules, output formatting, URL normalization. Configure the subagent to ask the shopper what to select when there are multiple matches. This subagent also handles language and scope boundaries.

Considerations for custom subagents:

  • Keep instructions for domain rules for formatting, verbatim content, and scope. Also, keep cross-cutting brand rules in the shared variables.
  • Restrict the agent to only the capabilities that your storefront uses. Retire or remove what you don't need, including a subagent's router route.
  • Use a connected subagent to delegate to a separately deployed agent, such as an external support specialist. The external source doesn't inherit the session binding so connect it independently.

Types of actions you can add:

Action Type Example Variable Guidancer
Prompt-template /RAG actions generatePromptResponse Rely on your own content (manuals, policies, knowledge articles), and return a grounded answer with citations. Retrieval from these sources don't require a resolved product ID first. Common inputs include outputLanguage for multilingual responses, and citationMode to define how sources are cited.
Invocable actions (Apex) and Flow actions standardInvocableAction Call org logic. Create a case, look up an order or account, check business hours or agent availability, set session variables, or contact an external system via a named credential.
Utility actions N/A Built-in features like @utils.transition (move between subagents), @utils.escalate (human handoff), and @utils.setVariables (capture and store extracted values such as name, email, and language)
Multi-step action chains N/A

Chain actions together the same way product_expert does. One action finds or identifies the item, and a second action fetches its details. You can apply this pattern to any domain. The lifecycle hooks before_reasoning and after_reasoning move the subagent to the next step automatically, after the required fields are complete.

  1. Give the subagent a precise description and its own reasoning instructions. Indicate what the subagent handles and what it defers to another subagent. You want clear routing, and topics that don't overlap.
  2. Wire it into the router by adding a go_to_ transition in start_agent agent_router. If you remove that route, it disables the subagent. Removing the block entirely retires it.
  3. Include actions, which are the tools that an agent can call.
 
Loading
Salesforce Help | Article