With the Winter ’26 release, Salesforce is introducing a new beta feature that exposes existing AuraEnabled Apex methods as agent actions in Agentforce. AuraEnabled annotation (@AuraEnabled) allows developers to access Apex controller methods from both the client and server sides, making them available to your Lightning components. If you are building agents and need them to perform tasks unique to your business, you can now leverage AuraEnabled Apex methods in a new way by allowing Agentforce to invoke these methods through the mechanism of exposing them as agent actions.

This blog post will walk you through the end-to-end workflow of using AuraEnabled Apex methods as agent actions, including preparing your Apex class, generating an OpenAPI specification, creating agent actions, and testing the agent action with Agentforce.

Why use AuraEnabled Apex methods for agent actions?

From the Winter ’26 release onwards, Aura is transitioning from its custom protocol to more standardized HTTP endpoints. This shift is crucial because it will lead to a dedicated HTTP action endpoint for these Apex classes, allowing for a deterministically generated OpenAPI specification that precisely matches their capabilities. 

This standardization makes the robust AuraEnabled Apex methods highly discoverable and consumable by platforms like Agentforce, extending the current exposure beyond the Aura/LWC framework for UI components to Agentforce agents — without developers having to reimplement or change their existing AuraEnabled methods.

The power of an OpenAPI spec for agent actions

A crucial bridge between your AuraEnabled methods and agent actions is an OpenAPI document. This allows Salesforce to understand the capabilities of your Apex methods, and it facilitates the generation of the necessary components for agent actions.

Unlike the more dynamic nature of Apex REST, AuraEnabled methods are strongly typed. This means that developers have all the necessary information to generate a deterministic OpenAPI document by examining the code and its annotations. By generating an OpenAPI document from your AuraEnabled Apex class and enriching it with specific Salesforce extensions, you have the ability to view how your methods would appear and behave as agent actions, including their input parameters and output parameters.

How to turn an AuraEnabled Apex method into an agent action 

Let’s walk through the process of transforming an AuraEnabled Apex method into a powerful agent action.

Step 1: Create an AuraEnabled Apex class

First, be sure that you have an AuraEnabled Apex class with methods that you wish to expose. These methods should be well-defined with clear input parameters and return types. 

For example, consider the sample AccountController class shown in the code snippet below.

You’ll need to make sure that the user account that will execute the agent has proper access permissions to the Apex class. Grant access by either adding the Apex class to the user’s profile under “Enable Apex Class Access” or by assigning a permission set that includes the class under “Apex Class Access.”

Step 2: Generate an OpenAPI document

Next, you’ll need to create an OpenAPI document that describes your AuraEnabled Apex methods using either VS Code or Code Builder. 

The documentation describes the pre-requisites needed for correctly installing the IDE and required extension packs, and setting up your Salesforce DX project that includes your AuraEnabled class. Note that you’ll also need to install the Agentforce for Developers extension in the IDE, which is included in both the Salesforce Extension Pack and the Salesforce Extension Pack (Expanded).

With your Apex class ready, you can then generate an OpenAPI document that describes its methods. This process is initiated via a new command in VS Code/Code Builder: SFDX: Create OpenAPI Document from This Class (Beta). If any method within the Aura controller class contains the @AuraEnabled annotation, an OAS artifact will be produced.

Screenshot showing the Agentforce for Developers menu with the “SFDX: Create OpenAPI Document from This Class (Beta)” option selected

This command will create two files in the externalServiceRegistrations folder:

  • <Apex class name>.yaml: The generated OpenAPI document
  • <Apex class name>.externalServiceRegistration-meta.xml: Metadata for deploying the API to the Salesforce API Catalog

Here is a section of the generated OpenAPI document for the AccountController class:

Step 3: Enrich the OpenAPI spec with topic extensions

You can add optional MuleSoft Topic Center extension fields to the OpenAPI document to automatically create custom agent actions and topics when your AuraEnabled Apex method is registered in the Salesforce API Catalog. By leveraging these, it also means that you don’t need to manually create the agent actions in the Agent Builder dialog. Finally, as the action metadata is included in your Salesforce DX project along with your Apex class, you can then apply Salesforce DX best practices.

The Agentforce documentation lists the Salesforce-specific extension fields to create agent actions; they are all located under a x-sfdc tag. Below is an example that uses the publishAsAgentAction extension field that creates a custom agent action from the API.

In addition to the above, you can also explore extensions that let you automatically create the topic for the agent actions listed in the MuleSoft documentation. An agent topic is a group of actions that are focused on a specific job done by agents. Agent actions are added to topics, and topics are added to agents to enable them to perform specific jobs.

Step 4: Deploy the spec to your org

Once your OpenAPI document is ready, deploy it to your Salesforce org. This deployment makes the defined actions available within Agent Builder.

In our example AuraEnabled Apex method class, the registration is performed by deploying both the .yaml and .externalServiceRegisteration-meta.xml files in the ExternalServiceRegisterations folder to the target org. Right-click on the folder and select the SFDX: Deploy this Source to Org command. See the screenshot below.

Screenshot of the folder structure representing the generated .yaml and .externalServiceRegisteration-meta.xml along with the SFDX: Deploy this Source to Org command developers need to run to deploy it

Step 5: Verify the deployment in API Catalog 

The Salesforce API Catalog is a single place where you can view API definitions from various sources and make them available for use in Salesforce. Today, API Catalog supports viewing the AuraEnabled Apex methods as a Beta feature (to learn more, refer to the documentation). 

API Catalog in your org uses External Services metadata “behind the scenes” to store the definitions of AuraEnabled Apex methods registered in the catalog. This explains the naming of the externalServiceRegistrations folder and the .externalServiceRegistration-meta.xml file. As a result of the registration of the OpenAPI doc and ESR metadata in an org via a deploy, the AuraEnabled Apex will be available in API Catalog for customers to observe and manage. The AuraEnabled Apex will be categorized under the AuraEnabled(Beta) section.

The screenshots below show our example AuraEnabled Apex methods registered in API Catalog with all the operations available and agent actions pre-created since we used the Topic Center extensions.

Screenshot of Salesforce API Catalog showing the AccountController API in the AuraEnabled (Beta) list of APIs

In order to view the operations available inside the API definition for the Account Controller inside the AuraEnabled(Beta)you’ll need to click on “AccountController” in API Catalog and it will give you a detailed view as shown below. Notice how it shows the agent action as “Created” since we used the Topic Center extension.

API Catalog showcasing the operations available and agent actions as created for Account Controller

Step 6: Understanding agent action creation

If you use Topic Center extensions, the agent actions are automatically created for you and are visible under Agentforce Asset in Setup. However, if you choose not use this approach or if this agent configuration is performed by another user or persona in your organization, you can create a new agent action directly in Salesforce Setup as follows:

  1. From Setup, search for and select Agentforce Asset.
  2. Click New Agent Action.
  3. Select Apex as the Reference Action Type.
  4. Choose AuraEnabled Method (Beta) as the Reference Action Category.
  5. Select your desired AuraEnabled method from the Reference Action dropdown.

Screenshot showing the Create an Agent Action dialog

The agent actions will use the descriptions for the API operations and parameters defined in the OpenAPI document, enabling you to ensure that the descriptions are complete and accurate, so that your agents choose them correctly. 

Here is an example of the agent action created and its details:

Screenshot of the Agentforce Asset Library showing the agent actions.

In order to see agent action details, you’ll need to click on an agent action, such as “Create Account” in the screenshot above. You’ll then be able to view the complete set of information and configurations pertaining to the agent action, as reflected in the screenshot below for Create Account.

Screenshot of the Agentforce Asset Library showing the details of agent actions available

Step 7: Attach the agent action to a topic

Now that your agent action is created, you need to associate it with a topic in Agent Builder. 

  1. Navigate to Agent Builder and open the relevant topic.
  2. Add the newly created agent action from the asset library to your topic’s flow.

Screenshot of the Add Available Actions menu in Agent Builder, with a new AuraEnabled action selected to add to the Agentforce topic

Step 8: Activate and test the agent action

Finally, activate your topic in Agent Builder. You can then test the agent action by simulating a conversation that triggers it. For instance, if your action creates an account, you might type a query related to creating an account. 

In the case of our example Apex class, one of our Apex methods was creating an account, so if you want to leverage that you can simply type: 

"Create an Account named MegaCorp."

Observe how the agent processes the request and executes your AuraEnabled method, confirming the successful creation of the account or the desired operation.

Screenshot in Agent Builder showing the activation of a topic and its related agent conversation

Conclusion

By following the steps outlined in this post, you can seamlessly integrate your AuraEnabled Apex methods by making them available to agents as actions that can help answer user requests, perform complex operations, and empower your agents with access to your custom business logic. This not only streamlines their workflow, but also ensures consistency and efficiency in handling customer requests.

In addition to supporting your Agentforce journey, this capability also leads to creating OpenAPI documents that describe your AuraEnabled Apex methods for broader uses, such as generating client applications and communicating the description of your API to developers. And the Salesforce API Catalog provides a centralized location where your AuraEnabled Apex methods are discoverable.

We need your feedback on the capabilities of this Beta, as well as how your AuraEnabled Apex methods will power your agent journey with Salesforce. Your comments will influence the GA release. Please post your questions and/or feedback on the Beta to the Agentforce for Developers Trailblazer Community. And if you want to highlight your use of AuraEnabled Apex methods with your agents, we’d love to co-present your use case at Dreamforce. Just let us know!

Resources

About the author

Riya Suri is a Software Engineer on Salesforce’s Enterprise API team, where she builds reliable, high-volume APIs and API frameworks to enable real-time, programmatic interactions with Salesforce that handle billions of transactions monthly. You can follow and connect with her on LinkedIn.