---
schema_version: "1"
id: 9e121fa1ba30231fc1dfd647fa96d4bd9fcb2515c3153cb7f78f7ac712a8f046
title: Create a Custom Agent Action in the Legacy Builder
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/copilot_actions_custom.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.copilot_actions_custom.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 363132feab9d21d64e9c8d17e878790b0abb4bb67f6681fc989b4a3d0da415c4
description: With custom actions, you can extend your agent with Salesforce functionality so that it’s ready to assist users with tasks specific to your business. Build custom actions using Apex, flows, prompt templates, and API integrations.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Create a Custom Agent Action in the Legacy Builder

With custom actions, you can extend your agent with Salesforce functionality so that it’s ready to assist users with tasks specific to your business. Build custom actions using Apex, flows, prompt templates, and API integrations.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions. <a href="https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&amp;release=264.0.0&amp;type=5" title="Learn about agent types and default templates for specific clouds and common use cases.">Required add-on licenses vary by agent type.</a></td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d85624e76">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e76 ">To create a custom agent action:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e76 ">Manage AI Agents AND <a href="https://help.salesforce.com/s/articleView?id=ai.agent_setup_explore_types.htm&amp;type=5&amp;language=en_US" target="_blank">the required permissions for your agent
                type</a></td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e76 ">To create or modify prompt templates:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e76 ">Prompt Template Manager</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e76 ">To create or modify flows:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e76 ">Manage Flow</td>

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

Before you begin:

- Review the [considerations for custom actions](https://help.salesforce.com/s/articleView?id=ai.copilot_considerations.htm&release=264.0.0&type=5 "Carefully review the support, limits, and considerations for AI agents.").
- create the underlying Salesforce functionality you want to use with your agent. When you create a custom action, you configure the functionality to use with your agent. You can create a custom action that calls invocable methods and REST Apex classes, external services, autolaunched flows, MuleSoft APIs, or prompt templates.

Access to a custom agent action depends on the type of Salesforce functionality it references. For example, if a custom action is built using a flow, the custom action adheres to the permissions, field-level security, and sharing settings configured in the flow. To run the action, the user or Agent User must have the Run Flows permission and access to the specific flow, depending on the type of agent.

1. From Setup, in the Quick Find box, enter Agent, and then select **Agentforce Assets** to view all the actions in your Salesforce org.
2. Click **New Agent Action**.
3. From the Reference Action Type dropdown, select the type of functionality that you want to use to build your agent action, such as a flow or prompt template. Then select the category, if prompted, and the reference action.
4. The agent action label and API name are populated with the reference action name and API name. Review these fields and, if necessary, edit the values to accurately describe the action. Then click **Next.**
5. The instructions for the custom action and each input and output are populated with the descriptions from the reference action. Review these fields and make changes. See [Best Practices for Agent Action Instructions](https://help.salesforce.com/s/articleView?id=ai.copilot_actions_instructions.htm&release=264.0.0&type=5 "Action instructions tell an agent what your action does and when to use it. When you create a custom action, carefully plan and test your instructions to ensure that your action performs as expected.").
    
    We copy over the descriptions from the reference action to give you a head start, but agent action instructions differ from traditional descriptions. An agent uses a large language model (LLM) and the reasoning engine to determine when to launch subagents and actions in a conversation. The instructions for the action, inputs, and outputs tell an agent what your action does and when and how to use it. Effective instructions vary by action and use case. Plan to test and iterate on your instructions to ensure that your action performs as expected.
6. For each input and output, specify any applicable settings.
    
    <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:66.66666666666666%">
            </colgroup>
            <thead class="slds-text-title_caps ">
              <tr class="">
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d85624e214">Setting</th>
                <th scope="col" class="slds-cell-wrap" style="vertical-align:top;" id="d85624e217">Details</th>
              </tr>
            </thead>
            <tbody>
              <tr class="">
                <td data-label="Setting" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e214 ">Collect data from user</td>

                <td data-label="Details" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e217 ">Require this parameter to be provided by the user.</td>

              </tr>
              <tr class="">
                <td data-label="Setting" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e214 ">Filter from agent action</td>

                <td data-label="Details" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e217 ">When you create an agent action, all inputs and outputs from the reference
                  action are added to the agent action. Enable this setting when you don’t want to
                  use a parameter from the reference action with your agent action. At least one
                  output must be used with the agent action.</td>

              </tr>
              <tr class="">
                <td data-label="Setting" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e214 ">Require input</td>

                <td data-label="Details" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e217 ">Require this parameter in order to execute the action. All other inputs are
                  treated as optional. If an input is required by the reference action, this
                  setting is enabled by default and read-only.</td>

              </tr>
              <tr class="">
                <td data-label="Setting" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e214 ">Show in conversation</td>

                <td data-label="Details" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e217 ">
                  <p>When this setting is enabled for some or all outputs, the outputs where
                    the setting is enabled are included in the agent's response. On some channels,
                    some outputs are converted to structured content (for example, the Agentforce
                    panel in Lightning Experience recognizes record pages).</p>
                  <p style="margin-bottom:0;">When this
                    setting is disabled for all outputs, the agent uses the LLM to summarize the
                    outputs in natural language in the agent's response.</p>
                </td>

              </tr>
              <tr class="">
                <td data-label="Setting" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e214 ">Show loading text for this action</td>

                <td data-label="Details" class="slds-cell-wrap" style="vertical-align:top;" headers="d85624e217 ">
                  <p>Show loading text in the agent conversation while the action is running in
                    the background.</p>
                  <p>For a custom action, you can specify the loading text for the action in the
                    Loading Text field. In 1–3 words with no punctuation, tell your users what
                    your action is doing. For example, “Crafting your email,” “Making updates,” or
                    “Getting activity details.”</p>
                  <p>When this setting is disabled, default loading text is shown. For example,
                    “Working,” “Making progress,” or “Checking my notes.” When this setting is
                    enabled, Loading Text is required.</p>
                  <p style="margin-bottom:0;">To show loading text in enhanced Messaging channel conversations, <a href="https://help.salesforce.com/s/articleView?id=ai.service_agent_messaging_progress_indicators.htm&amp;release=264.0.0&amp;type=5" title="Loading text tells the user what an agent is doing while an action runs in the background. To show your users loading text in Enhanced Chat v1, set up typing indicators. Users see loading text by default on Enhanced Chat v2 channels. Optionally, customize the loading text color and label on the Embedded Service Deployments Settings Setup page.">additional configuration is required for Enhanced Chat</a> and <a href="https://help.salesforce.com/s/articleView?id=ai.service_agent_messaging_byoc_progress_indicators.htm&amp;release=264.0.0&amp;type=5" title="Progress indicators tell the messaging user what actions an Agentforce Service agent is taking behind the scenes of a Bring Your Own Channel messaging session. Standard actions come with pre-written progress indicators, such as &quot;Doing research&quot; or &quot;Analyzing&quot;. To customize the progress indicator for an action, edit its loading text.">Bring Your Own Channel</a>.</p>
                </td>

              </tr>
            </tbody>
          </table>
    
    ![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/images/icon_tip.png)
    
    Tip When an action makes a change to a record, you can require an agent to ask the user to confirm the change before the agent can execute it. On the record page for the action, enable the **Require user confirmation** setting.
7. Click **Finish**.

After you create your action, [assign it to a subagent](https://help.salesforce.com/s/articleView?id=ai.copilot_actions_add.htm&release=264.0.0&type=5 "To use an action with an agent, add it to a subagent. An action can be added to multiple subagents. When you add a subagent to an agent, Salesforce makes a copy of the subagent and its actions. Each agent and agent version has its own independent copy of subagents and actions.") to add it to your agent.

To test your action and preview how the output appears in an agent conversation, open the agent in Agentforce Builder and start a preview conversation. Enter utterances that you expect to trigger your subagent and action, and then adjust the agent action and subagent instructions based on your results. Your action must be assigned to an agent to test it. Every agent that uses your custom action has its own independent copy of the action. You can update your custom action for a specific agent, and the updates won't be shared with any other agent.

- **[Best Practices for Agent Action Instructions](https://help.salesforce.com/s/articleView?id=ai.copilot_actions_instructions.htm&release=264.0.0&type=5)**  
    Action instructions tell an agent what your action does and when to use it. When you create a custom action, carefully plan and test your instructions to ensure that your action performs as expected.

#### See Also

- [_Video_: Create Custom Agent Actions](https://youtu.be/ZiCSCXmgtKc)
- [_Video_: Debug Agent Actions](https://youtu.be/qWVBrYyhE6A)
- [_Trailhead_: Agent Customization: Quick Look](https://trailhead.salesforce.com/content/learn/modules/agent-customization-quick-look)
- [_Trailhead_: Agent Customization with Flows](https://trailhead.salesforce.com/content/learn/modules/agent-customization-with-flows)
- [_Trailhead_: Agent Customization with Prompt Templates](https://trailhead.salesforce.com/content/learn/modules/custom-service-agents-with-prompt-builder-and-agentforce)
- [_Trailhead_: Agent Customization with Apex](https://trailhead.salesforce.com/content/learn/modules/agent-customization-with-apex)