Build effective Agentforce agents

Build Effective Agentforce Agents for High-Impact Automation

By

As Salesforce Admins, we’re always looking for ways to automate processes and reduce manual work for our users. With the introduction of Agentforce, we have a powerful new tool that goes beyond traditional automation. Let’s explore how to create effective Agentforce agents that can handle complex tasks autonomously.

This article is based on my session from Dreamforce 2024, “Unleash the Power of Agentforce.” Watch the recording to learn more.

Understanding Agentforce vs. Einstein Copilots

Agentforce represents a significant evolution in Salesforce’s AI capabilities. While Einstein Copilots excel at assisting users with specific tasks, Agentforce agents can work independently across multiple domains. These agents use the Atlas Reasoning Engine to plan and execute complex tasks, access various data sources, and learn from interactions. Think of Agentforce as having a skilled team member who can handle entire processes independently, rather than just providing suggestions.

Standard actions vs. custom actions

Agents in Agentforce choose and perform actions from a repertoire of actions that they are configured to use. They iteratively identify the next task to be done to complete their work and identify the best action to perform that task. There are two types of actions that agents can choose from: standard actions and custom actions. These actions form the core functionality of AI agents, allowing them to perform tasks and respond to user requests.

Standard actions are pre-configured, out-of-the-box actions that come included with Agentforce. These actions require no additional setup or coding, automate common tasks across various Salesforce environments, and are available to all users with appropriate permissions. For example, standard actions include tasks like identifying records or summarizing basic information.

Custom actions, on the other hand, are tailored actions you can create to meet your specific business needs. They allow you to extend the capabilities of your AI agents beyond what’s available with standard actions. Custom actions are created by admins like yourselves and can be built using Apex, flows, or prompt templates. They address unique or complex business requirements and provide flexibility to create highly specialized functionalities, such as generating personalized sales proposals or performing industry-specific calculations. This is what allows you to build highly differentiated agents to achieve a high degree of automation and competitive advantage.

The building blocks of an effective agent

The building blocks of an agent include topics, instructions, and actions.

Creating a successful Agentforce agent starts with three key components: Topics, Instructions, and Actions. Topics are categories that define what your agent can do – they’re like job descriptions for your AI assistant. Instructions serve as your agent’s playbook, providing detailed guidance on handling tasks and making decisions. Actions are the specific tools your agent uses to get work done, whether it’s running a flow or using a prompt template to generate content.

Creating your first agent action

Example flow that implements an agent action

When building agent actions, you’ll need to choose between flows and prompt templates based on your use case (if you are a prolific Apex coder, you can use Apex instead of flows). Use flows when you need to modify Salesforce data or execute complex business processes–for example, when updating opportunity stages based on certain criteria. Opt for prompt templates when you need natural language processing or content generation, such as drafting personalized customer communications. The key is to match the tool to the task at hand.

To create a flow-based action:

  1. Build your flow in Flow Builder, ensuring it has clear input and output variables.
  2. Create a new Agent Action in Setup and select your flow.
  3. Map the flow variables to your agent’s requirements. Agent actions can have one or more inputs and can return one or more outputs. It is important to spend time on the wording of the agent actions instructions, and the instructions for each input and output. Agentforce uses these instructions to select the correct action and handle the inputs and outputs correctly.
  4. Optionally create a topic with instructions. You will group agent actions that support a related set of business processes into a single topic. If a topic representing your business process already exists, there is no need to create a new one. If you are creating a new topic, you must pay careful attention to the Classification Description, Scope, and Instructions for the Topic.

    Agentforce uses the Classification Description to select the correct topic. The Scope allows you to define guardrails around what your agent can and cannot do using this topic, and the Instructions (you can add as many as you need) allow you to fine-tune the behavior of the agent when using the topic. For Instructions, consider explaining the purpose of the topic, providing guidelines on how to handle related queries, and including any specific language or tone requirements.
  5. Add the action to your agent’s topic. You can typically use the out-of-the-box agent that Salesforce provides.

If you have already created flows before, then you already have all of the necessary skills to create agent actions.

Agent and topic configuration and testing in Agent Builder

Best practices for agent development

Keep these guidelines in mind as you build your agents:

  • Start with a clearly defined scope for your agent’s responsibilities. This should include what the agent should not do. It is important to set guardrails.
  • Write detailed instructions that cover both common and edge cases. This should include when the agent should request additional context from the human.
  • Test thoroughly in a sandbox environment before deployment.
  • Monitor agent performance and gather user feedback.
  • Iterate and refine based on real-world usage.

Taking action

Ready to get started with Agentforce? Begin by identifying a process in your organization that would benefit from automation. Create a simple agent with one topic and action, test it thoroughly, and gradually expand its capabilities based on user needs. Remember, the goal is to start small and build up to more complex implementations as you become comfortable with the technology.

Resources

Need help along the way? Share your experiences and questions with the Salesforce Admin Community –we’re all learning and growing together in this exciting new space.

Modular Flows + Agentforce for Smarter Automation

Embrace Modular Flows to Build Smarter Automation for Agentforce

Automation is one of our superpowers as Salesforce Admins, and modular flows make that power even stronger. If you’ve noticed, flows are everywhere! Your flow-building expertise is key to preparing your company for Agentforce by creating custom flow actions for agents. However, as we shift toward building autonomous agents, we must rethink our approach from […]

READ MORE
key 2024 takeaways for Salesforce Admins

Key 2024 Takeaways for Salesforce Admins: Agentforce, Flow, and More

As 2024 comes to a close, it’s time to reflect on all that Salesforce Admins have accomplished. ✅ This year was packed with innovation, and one of the standout milestones was the launch of Agentforce, Salesforce’s new suite of assistive and autonomous agents. With Agentforce, you can build, customize, and deploy intelligent agents tailored to […]

READ MORE