---
schema_version: "1"
id: 63d743cffcec6cb2cd1db37a47f6bc4e8c203b5fd19f056ba6ae253a0da99efe
title: Add Custom Subagents and Custom Actions
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/cc/264-0-0/b2c_shopper_agent_add_custom_subagent.md
canonical_url: https://help.salesforce.com/s/articleView?id=cc.b2c_shopper_agent_add_custom_subagent.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 0102a7ddb07d1f955ecf2d4dd2a1ff1f2c24dfa2c0a400f219fa9c6fa7b91452
description: 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.
products:
  - Commerce
  - B2C Commerce
release: "264"
---
# 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:

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small ">
        <colgroup>
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
          <col style="width:33.33333333333333%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d214109e57">Action Type</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d214109e60">Example Variable</th>
            <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d214109e63">Guidancer</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="Action Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e57 ">Prompt-template /RAG actions </td>

            <td data-label="Example Variable" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e60 ">generatePromptResponse</td>

            <td data-label="Guidancer" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e63 ">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<code> outputLanguage</code> for multilingual
              responses, and citationMode to define how sources are cited.</td>

          </tr>
          <tr class="">
            <td data-label="Action Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e57 ">Invocable actions (Apex) and Flow actions</td>

            <td data-label="Example Variable" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e60 ">standardInvocableAction</td>

            <td data-label="Guidancer" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e63 ">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.</td>

          </tr>
          <tr class="">
            <td data-label="Action Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e57 ">Utility actions</td>

            <td data-label="Example Variable" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e60 ">N/A</td>

            <td data-label="Guidancer" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e63 ">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)</td>

          </tr>
          <tr class="">
            <td data-label="Action Type" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e57 ">Multi-step action chains</td>

            <td data-label="Example Variable" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e60 ">N/A</td>

            <td data-label="Guidancer" class="slds-cell-wrap" style="vertical-align:top;" headers="d214109e63 ">
              <p style="margin-bottom:0;">Chain actions together the same way <code>product_expert</code> 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 <code>before_reasoning</code> and
                <code>after_reasoning</code> move the subagent to the next step automatically, after
                the required fields are complete.
              </p>
            </td>

          </tr>
        </tbody>
      </table>

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.