Search
Close this search box.
Agentforce in Action: A Real Example of Using Agents in Salesforce

Agentforce in Action: A Real Example of Using Agents in Salesforce

and

Agentforce represents a major shift in Salesforce’s strategy and will likely radically change the way users interact with their CRM in the future. By enabling both assistive AI, which provides augmentative generative AI-fueled capabilities like summaries and sales emails, and autonomous AI, which enables an agent to take on automated actions without a person at the wheel, Agentforce allows users to be more efficient and pointed in how they operate in Salesforce.

Right now, though, it seems like many of the blogs, marketing materials, and information out there about Agentforce are all oriented towards driving the AI hype cycle — and not getting down to the brass tacks of how these tools work. This blog is all about illustrating how these tools work and how they can drive meaningful value for your organization’s custom business processes.

Interested to know more about how Agentforce agents can be set up quickly using both out-of-the-box standard actions as well as more bespoke custom actions? If so, let’s jump right in.

What is Agentforce?

If you’re just getting to know Agentforce, let’s set some context. Agentforce is Salesforce’s tool for leveraging conversational AI in CRM — but what does that really mean?

In short, it allows you to “talk” to Salesforce. How does it do this? By leveraging generative AI under the hood — along with a fancy tool called the Atlas Reasoning Engine — Agentforce can take user input and do things like summarize information from objects, update fields, and generate emails, knowledge articles, etc. It’s a powerful transformational tool, and it’s only in its infancy.

It is possible (in fact, quite likely) that Agentforce is the first step in building a natural language front-end over CRM. In a few years, we may no longer see users interacting with form-based interfaces, pointing and clicking their way through CRM, and instead navigating Salesforce via chatbots and automated agents.

The setup: managing pipeline

Let’s take a look at a scenario where we might want to leverage some assistive agent capabilities. In this case, consider a salesperson. This person has multiple objectives throughout their day — they need to be able to track key deals and manage their pipeline, work opportunities, and proactively identify risks to deals. Often, a seller is having conversations with their manager about the deals they need to keep an eye on, or the deals that are likely to close.

In the past, all of this work would be done manually. Our salesperson would navigate endless objects in Salesforce to identify meaningful information about their book of business, opening up the door to a number of potential challenges related to data inconsistencies, user error, etc. — but not anymore.

Agentforce actions can automate much of the process of identifying key deals, summarizing them, and tracking deal risks throughout the pipeline. Let’s take a quick look at an action that can summarize a user’s pipeline in detail.

A deeper look: Configuring actions for a pipeline summary

Agentforce allows you to quickly get started by utilizing out-of-the-box standard actions. However, if you find these actions don’t quite meet your needs, it could be a good time to explore custom actions. Let’s walk through the process of how to build a custom action specific to summarizing a seller’s pipeline.

Defining the action’s goal

The first thing we need to do is define our use case, the job the action is supposed to accomplish, and which user utterances, or questions, should trigger the action. Let’s say we want to enable our sales reps to get a quick overview of their current pipeline to prepare for their weekly pipeline review calls with their manager. The job that our action will execute is: generating a summary of key pipeline overview metrics.

After identifying the action’s goal, the next step is to determine which user utterances should trigger the action and what the expected inputs and outputs of the action are. In this case, some utterances might include “Tell me about my pipeline,” “What should I know about my current pipeline,” or “Help me prepare for my weekly pipeline review.” Going hand-in-hand with identifying the action triggers, it’s also important to determine the expected inputs and outputs.

For this action, there is no input other than knowing the user who is asking the question, as we’ll be searching for metrics related to their specific pipeline. Then for the output, we’re expecting a textual summary of their key pipeline metrics such as the current quarter, total pipeline value, number of opportunities in each stage for the quarter, value of opportunities in each stage, total number and value of won opportunities, etc.

Building the action

Once we have clearly defined the use case and have a solid understanding of what the action should accomplish, we can begin to build the flows and prompts necessary to accomplish the action. For our pipeline summary use case, we’re going to need a few different elements:

  1. A prompt template that creates the summary and is grounded with the pipeline metrics from the flow.
  2. A flow that calculates the metrics we want to surface to our user and that we will use to ground the flow.
  3. A flow that will execute this prompt template for the running user.
  4. The Agent Action that will call the flow and prompt template and return the response to the user in the Agentforce interface.

Now, let’s walk through each of these steps in greater detail. First, we will need to create the prompt template. We will use the Flex template type because, as the name suggests, this is the most flexible, and it will allow us to select a user as input.

Create Prompt Template

After creating the prompt template, we will save it and then jump over to the next step of creating the flow that will ground the prompt before we begin any additional prompt development.

To do this, we will be using a “Template-Triggered Prompt Flow.” The first thing we will do after creating this flow is link it to the pipeline summary prompt template that we just created. This is what will allow the flow to have access to the inputs of the prompt, and this is also what will allow us to write data back to the prompt template.

Pipeline Summary Template Triggered Prompt Flow

After connecting the flow to the prompt template, we can then perform any business logic or calculations necessary. In this case, we will be getting the opportunities that belong to the user and calculating their key pipeline summary metrics.

Once we’ve gathered all of the data we want to include in the prompt template, we then need to add a “Prompt Instructions” node because this is how we are able to include these metrics in the prompt template. After adding the prompt instructions node, you can select what data you want to be written back to the prompt template, as shown below.

Pipeline Summary Prompt

Building and grounding the prompt

Now that we’ve completed the first flow, we can jump back over to our prompt template and get to work on prompt engineering. The first thing we will need to do is add the flow resource that we just created into our prompt template. This will allow our prompt template to access the metrics we want to summarize. Then, in the remainder of the prompt, we will include instructions on what we want the summary to include and how the summary should be formatted.

Pipeline Review Prompt Builder

Once we’ve finished creating, grounding, and testing the prompt template in Prompt Builder and are satisfied with consistent outputs, this can be saved and activated.

Now that we’ve created the prompt template, we’re ready for our next steps of creating the flow to execute the prompt template and the corresponding agent action. It is possible to create an agent action from a prompt template rather than including the added layer of the flow that executes the prompt template. However, in this case, because the user is the input of the action, we need the flow to identify the ‘running user.’

This flow is fairly simple. It is an autolaunched flow that gets the current user, and then executes the pipeline summary prompt template using the user as input. Then the output from the prompt template is stored in a variable, and this is what will be returned via the agent.

Finally, we’ve made it to the last step, creating the agent action. To do this, we will go to the agent actions page and select to create a new agent action from a flow. Then we will select the flow that we just created.

Writing agent instructions

Next, we will need to write the agent instructions. This is the most important piece for creating the agent action because these instructions help Agentforce know when to use which action. As a part of this step, we will need to write the action, input, and output instructions.

Good action instructions describe not only what the action does but also include example user utterances, and in some cases, dependent actions and/or additional instructions on when to use the action. Then, for the input and output descriptions, these should describe things like the expected data type, how the information is retrieved or generated, and any other specific fields or values. Here is the configuration for our pipeline review action below.

Pipeline Review Action Instructions

Topic assignment

Once we’ve created an agent action, in order to allow end users to access it, we need to assign it to a topic. Topics are categories of actions related to a specific task or job that is done by agents. In this org, we already have a topic called Opportunity Management. This topic includes actions like opportunity summarization, key deal identification, opportunity risk analysis, and more. Pipeline summarization would fit well into this topic, so we can add the action to this topic, along with any additional instructions to our topic as needed.

Now that we’ve added our action to a topic, and activated the copilot/agent, we can now see it in action. When a user asks for “an overview of their current pipeline,” they will now see the following result:

Pipeline Review

That’s it! We’ve created an assistive agent that can be deployed to help a seller summarize their pipeline, understand which deals deserve their attention, how they track towards their quarterly number, and any opportunities that have fallen through the cracks — all with a simple question in a chat interface.

Remember: this is just one action. Follow-on actions could do things like summarizing Opportunities and/or Activities, identifying and mitigating potential risks on deals, and more. With custom agent actions, there is virtually no limit to the types of actions you could build.

How Agentforce applies to you: Use cases to get started

Agentforce provides some remarkable tools for implementing, testing, and productionizing AI-based functionality within Salesforce. But to help your organization understand the value and added productivity that these types of features can provide, consider the following two questions:

  1. Where do users need to generate content (e.g., sales or outreach emails) on a regular basis?
  2. When do users need to consolidate information from various sources — potentially internal/external systems, multiple Salesforce objects, or other information — into a single summary (e.g., preparing for a client meeting, etc.)?

Processes like these can offer excellent starting points for companies that want to pilot assistive AI technologies because they can provide immediate productivity impacts and tend to align nicely with some of the existing standard actions that Agentforce can provide. Most will find that starting with standard actions and making iterative tweaks is the best place to start, and building towards more complex use cases is more feasible once they’ve started to build some momentum.

Remember, too, that AI solutions do not drive gains in productivity or increase revenue if they are not adopted, so don’t think about implementing agents as a purely technical exercise. Rather, you should start by thinking about the user experience you’re trying to enable with a persona-based approach, and then identify agent actions that can streamline that user’s workflow.

For instance, not all Agentforce functionality should be served up in a “copilot-style” chat interface. Templated prompts that populate Lightning Web Components or fields on a record can be very useful to consider as well and are easily created with Prompt Builder in Agentforce. Care should be taken to take user feedback into account when building and iterating on actions. Focus on business change enablement to make sure your users are well-trained to use these new tools responsibly and efficiently.

Need some help getting started? Learn about Atrium’s Salesforce Agentforce Consulting Services.