Skip to main content
The Trailblazer Community will undergo maintenance on Saturday, November 15, 2025 and Sunday, November 16, 2025. Please plan your activities accordingly.

Customize Your Agents

Learning Objectives

After completing this unit, you’ll be able to:

  • Explore the different ways you can customize agent actions.
  • Compare the benefits of customizing agent actions.
Note

New Agent Building Experience Coming Soon!

Agentforce is getting an update! At Dreamforce 2025, we announced the new agent building experience which may differ from the process and features you learn about in this badge. Expect the new experience to become available in open beta in the weeks following Dreamforce. General availability comes soon after. The current builder experience remains available to support previously built agents. Stay tuned for more information.

Trailcast

If you'd like to listen to an audio recording of this module, please use the player below. When you’re finished listening to this recording, remember to come back to each unit, check out the resources, and complete the associated assessments.

Right out of the box, Agentforce can tackle many of the common challenges businesses face in data and customer relationship management. An agent can help when your team struggles to find the right answers to customer inquiries. Or when too many routine tasks demand your service reps’ time. Or when you need content for an upcoming presentation, but lack the human resources to get it done. From automating customer points of contact to summarizing meetings and documents for key stakeholders, there’s a lot you can do with the standard Agentforce configuration. But what about the advanced applications that are specific to your business, or that might emerge as you see how agents plug into your work? That’s where customization comes in.

Custom Agent Actions

Custom agent actions are how you can influence the way your agents act. While agents can read any data you give them access to in Salesforce, they can’t‌ change records without a predefined agent action. These actions can be configured and chained together to create the functionality you need. This might involve greeting a hotel guest and offering options when they check in, or automatically sending summarized notes to all participants after a weekly meeting.

The good news about custom actions is that you don’t have to create them out of thin air. In fact, custom actions are based on Salesforce technologies you already know and love. When you create a custom action, you build it on top of existing platform functionality that you want to make available in Agentforce—invocable and REST Apex classes, autolaunched flows, and prompt templates. In Agentforce, we refer to that underlying functionality as a reference action, and it’s an awesome way to get more mileage out of your Salesforce Platform capabilities.

Deterministic or Non-Deterministic

When developing the underlying platform functionality for your agent actions, you might wonder when you should use a flow, Apex class, or prompt template to build the action. Essentially it comes down to whether the process you’re automating is deterministic or not.

  • Deterministic: Uses an invocable Apex class, REST Apex class, or autolaunched flow to generate output. Actions based on flows or Apex are deterministic and use business logic and rules to produce a consistent outcome.
  • Non-deterministic: Uses one or more prompt templates to generate output, which involves a degree of randomness. A prompt-based action lets you control how a response is written or use the reasoning and generative capabilities of an LLM. For example, to generate a summary or perform sentiment analysis, you need to use a prompt template as a reference action. Prompt templates are also used to ground an agent in data, such as knowledge or external system data.

Keep in mind that a single agent action can combine both deterministic and non-deterministic approaches. For example, say that when a guest cancels their hotel reservation, a flow-based action is triggered to complete the cancellation. At some point during that flow, the agent could also follow a prompt to ask the customer for information about why they’re cancelling. The agent could even summarize the response from the customer and provide that summary for review if the customer indicates a particular reason for cancelling.

Let’s take a closer look at each of the reference actions you can use when building a custom agent action: prompt templates, flows, and Apex.

Prompt Templates

Agents come with templated prompt types for a wide range of common tasks like answering emails or managing service cases. Prompt Builder’s intuitive UI also has several features, like one-click copy for text fields and the ability to generate resolutions without full responses if you need to iterate quickly. To get the best performance out of your prompts, you’ll want to refine the templates and create new ones to fit the specific use cases you experience in your business. With Prompt Builder, you can easily modify a default prompt to collect the right information, deliver personalized responses, and ensure things are running smoothly for your agents.

For example, if an agent is generating generic responses that don’t make customers feel valued, you can use a prompt template to add instructions for the agent to use your existing customer data to provide more tailored responses. Prompts allow you to create context-aware and evolving commands that come in three main types.

  • Field generation templates work well with a single object, such as an account, but have limitations in providing additional context.
  • Service email templates are ideal for case-related responses but are restricted to that scope.
  • Flex templates offer the most versatility, allowing you to use multiple objects, free text input, and data models for richer responses. These templates aren’t as quick to use for simple tasks but work well when you need a specific solution that includes creative thinking.

Flows

The true power of Agentforce lies in its ability for agents to activate flows—low-code tools that enable users to perform complex business tasks, such as modifying customer records. And you can build ‌agent-ready flows for your agents to make tasks easy. They can also improve an agent’s accuracy by instructing agents to access specific and relevant data instead of using all the data they have access to in Salesforce.

Apex

While flows and prompts can do a lot to refine how Agents work with Salesforce, they only work with tasks you can automate through natural language instructions and traditional flows. However, because LLMs can also read and process code, agents can also help you take advantage of the power of Apex. With Apex customization, a single person can code advanced applications into simple-to-deploy agent actions that can be used and referenced by others. These actions can help you do things like check flight times at the airport closest to your business or ‌pull and analyze data from a previously built Apex application already used by your teams. Once you’ve added your Apex code to an agent action, even teams with limited code knowledge can use the action.

Dive Deeper

Continue your AI agent learning journey by exploring other badges related to prompts, flows, and Apex customization to gain more hands-on experience and discover various ways to enhance how Agents work.

It won’t take long for you to discover all the advantages of having agents that are tailored to your specific needs.

Resources

Compartilhe seu feedback do Trailhead usando a Ajuda do Salesforce.

Queremos saber sobre sua experiência com o Trailhead. Agora você pode acessar o novo formulário de feedback, a qualquer momento, no site Ajuda do Salesforce.

Saiba mais Continue compartilhando feedback