Building Blocks of Agents in Salesforce[Topic, Instructions, Actions] : Bijay Kumar
by: Bijay Kumar
blow post content copied from SalesForce FAQs
click here to view original post
### Summary of Building Blocks of Agents in Salesforce After deploying an Agent in Salesforce, it’s essential to train it using natural language so it can effectively respond to user queries. This training involves creating **topics**, **instructions**, and **actions**, which are crucial components of Salesforce Agents. #### Key Components: 1. **Building Blocks**: These are reusable elements that help automate AI-driven processes within Salesforce agents. They enhance customer experience and provide insights by allowing agents to interact with Salesforce data. 2. **Topics**: Define the tasks that agents perform. Each topic includes instructions and actions that guide the agent's responses. 3. **Instructions**: Serve as rules or guidelines for the agent to follow when addressing customer queries. 4. **Actions**: Specific tasks that agents can perform, such as retrieving data or sending emails. These can be standard (pre-built by Salesforce) or custom (created by users). #### Creating Custom Actions: - Actions can be created using: - **Apex**: Salesforce's programming language. - **Flows**: A no-code automation tool. - **Prompt Templates**: Reusable prompts in natural language. - **External Services**: No-code connections to APIs. #### Example Use Case: For instance, if a customer asks about their account's priority using their account number, a custom action can be created to fetch this information from the database. #### Steps to Create a Custom Action: 1. **Create an Apex Class**: This class will handle the logic to retrieve account priorities. 2. **Register the Action**: In Salesforce, create a new agent action that references the Apex class. 3. **Define a Topic**: Assign the custom action to a new topic, specifying the tasks the agent will perform. #### Conclusion: Understanding and utilizing these building blocks is crucial for creating effective AI agents in Salesforce. By defining custom topics, instructions, and actions, organizations can tailor their agents to meet specific business needs. ### Additional Context: Salesforce Agents are increasingly important as businesses look to enhance customer service through automation. By leveraging AI, organizations can streamline processes and provide timely responses to customer inquiries. ### Relevant Hashtags for SEO: #Salesforce #AgentForce #AI #Automation #CustomerService #SalesforceDevelopment #CustomActions #Topics #Instructions #SalesforceTraining #CRM #BusinessAutomation
After creating and deploying an Agent in Salesforce, we need to train the agent with natural language so that when a user or customer asks the agent a query, the agent should display the result. This can be done using topics, instructions, and actions, which are the building blocks of agents in Salesforce.
In this tutorial, we will learn about the building blocks of Agents in Salesforce. In that, I will explain why the building blocks are necessary and how to create custom topics, instructions, and actions in Salesforce Agentforce.
Building Blocks of Agents in Salesforce
In Salesforce, building blocks of Agents refer to the reusable components and elements that help design and automate AI-driven processes within Salesforce agents. These building blocks are essential for creating intelligent and automated workflows that can interact with Salesforce data, enhance customer experience, and provide insights.
These agents are built using three components: Topic, Instructions, and Actions. These are specific tasks or actions that the agent performs, like retrieving data, sending an email, or updating a record. Custom actions are often integrated with the agent’s logic to automate business processes.
Because of the building blocks, the agent understands and processes information, communicates naturally with the user, and takes action to perform specific tasks. When we create a new agent in Salesforce, we get access to standard topics and actions.
In Salesforce, an org can have multiple agents deployed on different channels to perform different tasks. The Salesforce Agent helps internal Salesforce employees in their daily work, and the Community Agent helps external users by solving their queries.
Every organization is special and has requirements specific to its business use case. To handle such requirements, we will have to create custom actions and assign them to the topics that will be assigned to the agents so that the agents will be able to perform the task.
Requirement of Creating Topics, Instructions, and Actions in Salesforce Agentforce
In this organization, we would like to give our agents the ability to answer queries when customers ask about the priority of their accounts. So, the expectation is that the customer will give us the account number they received through emails or messages.
These AI agents, which may be deployed on a customer community portal, will be able to take that Account Number and tell the customer what the Account Priority of their account is.

Create Topics, Instructions, and Actions in Salesforce Agentforce
In the Agentforce building blocks of agents, we have the following functionalities.
Following are ways to create custom actions in Salesforce:
- Apex: Salesforce programming language.
- Flows: No code Salesforce automation tool.
- Prompt Template: Reusable prompts written with natural language.
- External Services: No-code connection to external API.
So, here, we will create a custom action. This action’s job will be to answer queries related to soft drink order status. Here, we will see all the steps required to build an agent action and topic and then assign it to an agent.
Actions in Salesforce Agentforce
The working behind the scenes of an agent is because of actions. Actions actually perform the task, like creating a draft order, booking an Appointment, fetching some Account details, etc. We will create standard and custom actions in the system according to the organization’s needs, which will solve a particular task. The custom actions can be created using Flows, Apex, and prompt templates.
- Standard Actions: When we enable the agent, the actions already provided by the Salesforce are standard actions.
- Custom Action: Salesforce users create custom actions according to business needs to solve tasks specific to the organization.
Create Actions in Salesforce Agentforce
Here, we will use the Apex class to create a custom action.
1. Create Apex Class:
Now, let’s create an apex class, which will take the account number and will return the account priority back to the agents.
The Apex class CustomAction is created to return the priority of an account when a user provides an account number. In that first, we declared the @InvocableMethod. This method makes this class available to be used as a custom action for AI agents.
When we use this apex class as a custom action in agent builder, that custom action will have a required field called Instruction, which is very important. So, the description will be used as instruction.
Then, the static method (getPriority) takes input from a list collection of account numbers (accNumber) and returns a list of strings (the priority of the account).
In the SOQL query, we passed the user’s account number to retrieve the account priority value. Then, it returns the Account_Priority__c value in a new string list.
public class CustomAction {
@InvocableMethod( label = 'Account Priority'
description = 'Return the priority of an accountnumber, when user ask for it,
for example user can say what is priority of my account xyz' )
public static List<String> getPriority( List<Integer> accNumber ){
Account acc = [Select ID, Name, Account_Priority__c From Account Where
Account_No__c=:accNumber[0] ];
return new List<String> { acc.Account_Priority__c };
}
}
2. Create a New Custom Action For the AI Agent
In the above step, we created the class that actually executes the query in the backend. Now, we need to create an action in Salesforce for an agent. To do that, in Quick Find, search for Action Agent and click on it.
There, you will see the standard actions created by Salesforce. To create a new one, click the New Agent Action button.

Fill in the below details:
- Referenced Action Type: First, you will only see this field. We need to select Apex because we created an action in the Apex class. As you choose the Apex, another field will be populated.
- Referenced Action Category: In this field, we need to select Invocable Methods.
- Referenced Action: Here, select the label that you provided in the Apex class. In our apex class, we provided Account Priority as a label.
- Then, the Agent Action Label and API Name will automatically populate.

Now, you will see the Agent Action Instruction field is auto-populated, and this information comes from the description field in the Apex class. This field is very important because it is what the Atlas reasoning engine will use to understand whether this action will solve this particular task.
In the Loading Text, provide the text that will display when the agent searches the details of your query.
In the Input section, we can see the Apex method was expecting the account number. Then, we have to instruct the Atlas reasoning engine on what information should be passed here.
Then, in the instruction’s Output section, we tell the agent that when you invoke this apex class passing the account number, you will get some output, and we tell it what to do with that output.
After that, click the Finish button, and the action will be created.

Now you can see the custom action has been successfully created.

Topic in Salesforce Agentforce
The topic defines the work these AI agents will do, so each topic defines the jobs the agent needs to perform. Here, we defined the job in natural language. Unlike chatbots, where we define a decision tree, these topics contain a set of instructions and actions that will perform a task.
When we create a topic, we define the instructions that the agent will follow if it chooses this particular topic for the current request.
Create Topic and Assign Custom Action to Topic
In the above steps, we have created one new custom action. Now, we need to assign the created action to the topic.
Navigate to the Agents and select any agent for which you want to assign a created custom action. Here, I have selected Coral Cloud Agent.

After that, click on the Open in Builder button to assign action.

Here, this agent does not have any topic, and we know that the topic is the one that defines what an agent is going to do. The topic contains instructions and actions. So we are going to assign created action to the topic.
To create a new topic, click the New dropdown button and select New Topic.

Fill in the topic details as per your requirements. Below, I have shown what should be provided to create a topic.
- Topic Label: Provide the name of this topic, and the name should be specific.
- Classification Description: It says that this topic helps in finding the account priority of accounts when users ask by giving an account number.
- Scope: Here, we need to specify the limit of our topic. For example, this topic is for account information, and if the user searches for contact information, then the Atlas engine will understand that by using this scope, the agent will not get results in this topic.

Instructions
The instructions are the guardrails, or these are something that helps the agent to perform their job. Here, you need to give instructions to the agent, and you can provide multiple instructions by clicking on the Add Instruction button.
After adding the instructions, click the Next button to proceed.

Now, we need to select the actions for this topic. So, we created the Account Priority action and selected it. If you think your topic will require any other action, then you can select that as well.
After that, click the Finish button.

Now, you can see that one topic has been added to the agent builder. This allows us to create multiple topics and assign multiple actions for one topic in Salesforce.
As you keep on adding topics and custom actions to this agent, it will be able to perform more tasks. But for now, it can only perform account priority inquiries.

After adding Topic, Action, and the Instruction we are ready to use this agent. Now in the Conversation Priview I have asked query or question about priority of account no 1001?.
As a response you can see it returns the ‘Low‘ priority for 1001 account number. Also at the left side you can see user prompt that we asked then the atlas engine selecting topic and action that need to perform and the input and output result is displayed.

In the account object also, you can see that for the 1001 account number, the priority is ‘Low’.

Instructions in Salesforce Agentforce
Instructions are kind of rules that the agent should follow while solving customer queries. For example, we can give instructions that do not accept negative values, define a rule that the zip code length should be 5 digits, require the user to provide the order number, etc. Instructions are the guardrails that ensure that the Agent will perform the task within the boundaries that we have defined.
For example, for asset installation, we need to define the required information in the instructions, and creating an installation request is the actual action. However, we can define how to perform the action using instructions.
In this way, we can create actions, assign them to topics, and create instructions for AI agents in Salesforce.
Conclusion
I hope you have got an idea about the building blocks of Agents in Salesforce. In that, we have seen why the building blocks are necessary and how to create custom topics, instructions, and actions in Salesforce Agentforce.
To create the action here, we used the Apex class. Then, we assigned the created action to a topic and, by adding instructions, guided the agent to return the answer that the user would ask.
You may like to read:
- Create and Deploy Agentforce For Service in Salesforce
- Introduction to Salesforce Agentforce
- What Is Salesforce AgentForce
The post Building Blocks of Agents in Salesforce[Topic, Instructions, Actions] appeared first on SalesForce FAQs.
March 19, 2025 at 06:35PM
Click here for more details...
=============================
The original post is available in SalesForce FAQs by Bijay Kumar
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Post a Comment