February 25, 2026

To build AI agents in Salesforce with Agentforce custom actions, you package your business logic as an Autolaunched Flow, Invocable Apex, or a prompt template, register it as an action in Agent Builder, then write plain-language instructions that tell the agent when to run it. Custom actions are the "hands" that let an autonomous agent read data, run a workflow, and update records without a human clicking through every step.
Standard actions cover the basics. The real power of Agentforce shows up when you build custom actions tuned to your own data and processes. This guide walks through the full build—Flow, Apex, testing, and the permissions that trip up most first agents.
A custom action is a specific task you let an AI agent perform against your Salesforce data and logic. If the Atlas Reasoning Engine is the brain that plans, custom actions are the hands that do the work.
Each action has one clear job: look up an order, create a case, calculate a quote, or draft an email. The agent decides when to call it based on your instructions and the user's request.
Standard actions ship with Agentforce and handle common jobs like drafting an email or answering from a knowledge article. Custom actions are the ones you build for logic that is unique to your org. For background on how Salesforce frames the agent model, Salesforce Ben's Agentforce coverage is a useful reference.
In Agent Builder, actions don't float on their own. They sit inside topics—job-based groupings like "Order Management" or "Case Handling." A topic holds the instructions plus the actions the agent may use for that job. Get the topic boundaries right and the agent picks the correct action far more often.
Line up a few things first: an Autolaunched Flow or Apex class for your logic, a clear input and output for each action, and a sandbox to test in. You'll also need a permission set for the Einstein Service Agent, which is the identity your agent runs as.
You can build a custom action three ways, and picking the right one saves both effort and Flex Credits. Here's how they compare.
Flow is the most common path because it's low-code and fast. Community walkthroughs like Apex Hours show the same pattern in action.
Start with the data contract. For an "Order Status" action, set Order Number as an input variable and Order Status as an output variable. Mark both as available for input and output so the agent can pass and read them.
Add a Get Records element to pull the order that matches the input number. Return the status field to your output variable. Keep the Flow narrow—one action, one job.
Open Agentforce Studio, then Agent Actions, then New Action. Choose Flow as the reference type and select your active Autolaunched Flow. Check "Collect data from user" for inputs the agent should ask about, and "Show in conversation" for outputs it should say back.
You don't trigger actions with code here - you trigger them with clear instructions. Write them the way you'd brief a new hire.
Reach for Apex when the logic is heavy - complex math, multi-object updates, or an external API call. When your action needs to talk to an outside system, sound integration architecture keeps those callouts safe and testable.
You expose the method to the agent with the @InvocableMethod annotation. A minimal example looks like this:
public class GetOrderStatus {
public class Request {
@InvocableVariable(required=true)
public String orderNumber;
}
public class Result {
@InvocableVariable
public String status;
}
@InvocableMethod(label='Get Order Status')
public static List<Result> run(List<Request> requests) {
// query the order, set status, return
}
}
Salesforce's Invocable Apex documentation covers the annotation rules and limits. Once the class is saved, register it in Agent Builder just like a Flow—pick Apex as the reference type.
Don't ship an agent on a hunch. Use the Agentforce Testing Center to run test utterances—real phrases a user might type—and confirm the agent picks the right action and returns the right data.
Test the messy cases too: vague requests, missing order numbers, and out-of-scope questions. A quick pass through the Trailhead agent modules helps if the testing tools are new to you.
If your agent says "I'm on it" but returns nothing, it's almost always a permissions gap. The agent runs as the Einstein Service Agent user, and that user needs explicit access. Work down this checklist.
Most guides stop at "it works in my sandbox." That's where the engineering discipline starts. Agent metadata—topics, actions, Flows, and Apex—should move through source control and a real release pipeline, not hand-clicks in production.
Version your actions, review them in pull requests, and promote them through sandboxes with automated tests. Governing agents as real software is where our managed services team spends most of its time, because a poorly governed agent burns Flex Credits and user trust fast.
No. Einstein Copilot needed a human prompt for each step. Agentforce is autonomous—it uses the Atlas Reasoning Engine to plan and run multi-step tasks on its own.
No. Most actions are built with Flow, which is low-code. Reach for Apex only when you need complex processing or an external API call.
Yes. Use Invocable Apex with a callout, or an External Service, to reach systems outside Salesforce. Plan the authentication and error handling up front.
Keep it tight. Too many actions in one topic makes the agent guess. Group only the actions that belong to the same job, and split topics when the list grows.
Agentforce uses a consumption model with Flex Credits. Pricing changes over time, so confirm current rates with your Salesforce account team before you forecast usage. Well-designed actions keep credit consumption down.
Custom actions turn a chatbot into a digital coworker - but only when the logic, testing, and governance are engineered, not improvised. As your strategic engineering partner, Minuscule Technologies designs high-ROI actions, wires them into your systems, and secures them inside the Einstein Trust Layer. Talk to us and let's build an agent that earns its Flex Credits.
You've seen what's possible. Now, let's make it happen for your business. Whether you need an end-to-end Salesforce solution, a complex integration, or ongoing managed services, our team is ready to deliver.
Schedule a Free Strategic Call