Building Your First Agentforce Agent
A complete step-by-step developer guide to configuring, testing, and deploying your first autonomous agent using the Agentforce Agent Builder and Atlas reasoning engine.
Welcome to the Agentforce Hub developer quickstart. In this guide, we will design and deploy a customer service agent capable of querying orders and resolving case statuses autonomously.
Overview of Agentforce Architecture
Agentforce agents are built around a central execution loop known as the Atlas Reasoning Engine. Unlike standard rule-based chatbots, Agentforce interprets user intent, builds a plan, runs actions, and evaluates its own actions until the goal is satisfied.
graph TD
A[User Input] --> B[Atlas Interprets Intent]
B --> C[Select actions from Action Library]
C --> D[Execute Flow, Apex, or REST Action]
D --> E[Evaluate Result and Response]
E --> F{Goal Achieved?}
F -- Yes --> G[Final Response to User]
F -- No --> B
Step 1: Accessing Agent Builder
To build your first agent:
- Log in to your Salesforce Developer org (ensure Data Cloud and Agentforce are enabled).
- From Setup, search for Agent Builder in the Quick Find box.
- Click New Agent and select Service Agent.
[!NOTE] Make sure to assign a dedicated integration user profile to your Agent to ensure proper data access control.
Step 2: Defining Topics and Actions
Topics represent the functional boundaries of what your agent is allowed to discuss or act upon (e.g., “Order Management” or “Billing Support”). Within a topic, you define Actions which represent the specific toolsets the agent can execute.
Here is an example of an Apex Action wrapper used to retrieve order details:
// GetOrderDetailsAction.cls
public with sharing class GetOrderDetailsAction {
@InvocableMethod(label='Get Order Details' description='Fetches current order details using Order Number')
public static List<OrderResult> getOrderDetails(List<String> orderNumbers) {
List<OrderResult> results = new List<OrderResult>();
for (String orderNum : orderNumbers) {
OrderResult res = new OrderResult();
try {
Order ord = [SELECT Id, OrderNumber, Status, TotalAmount FROM Order WHERE OrderNumber = :orderNum LIMIT 1];
res.status = ord.Status;
res.total = ord.TotalAmount;
res.success = true;
} catch (Exception e) {
res.success = false;
res.errorMessage = 'Order not found';
}
results.add(res);
}
return results;
}
public class OrderResult {
@InvocableVariable(label='Status') public String status;
@InvocableVariable(label='Total Amount') public Decimal total;
@InvocableVariable(label='Is Success') public Boolean success;
@InvocableVariable(label='Error Message') public String errorMessage;
}
}
[!TIP] Always write clear labels and descriptions on both
@InvocableMethodand variables. The Atlas engine relies on these descriptions to decide which action to call.
Step 3: Testing and Deployment
Once actions are added, use the built-in Agent Playground (on the right-hand panel of the Agent Builder) to test scenarios:
- Enter a query like: “Where is my order #001293?”
- View the Reasoning Log to see how Atlas selected
Get Order Details. - Check the return variables and watch how the agent formulates a friendly response.
Once satisfied, click Publish to make your agent available on Experience Cloud, Slack, or external sites.
Frequently Asked Questions
What is the Atlas Reasoning Engine?
Atlas is the orchestrator and reasoning brain behind Salesforce Agentforce. It analyzes user inputs, determines target actions, evaluates results, and refines execution paths dynamically.
Do Agentforce Agents require code?
No, Agentforce Agents can be built using declarative tools. However, complex system tasks can be supported with Apex Actions, Flows, or Model Context Protocol (MCP) endpoints.