Prerequisites for Agent Actions Using Apex Controller Methods

You must first install Agentforce for Developers to use this feature. Agentforce for Developers is available in the VS Code and Open VSX marketplaces as a part of the Salesforce Extension Pack. You can install it in the VS Code desktop application, or just use it in Code Builder, where the Salesforce Extension Pack (Expanded) comes pre-installed.

Agentforce for Developers is enabled by default. Any developer with access to a Salesforce org can use the extension. See Set Up Agentforce for Developers for more details.

To validate and test documents to make sure that they work with your AuraEnabled Apex controller methods, make sure that the MuleSoft for Agentforce API Design Extension in the MuleSoft for Agentforce Extension Pack (beta) is installed. The Salesforce API Topic and Action Enablement governance rulesets are included in the MuleSoft for Agentforce Extension Pack (beta).

In order for an Apex class to qualify to be registered as an OpenAPI spec in the API catalog, it must have the annotation @AuraEnabled and have sharing rules defined using either the with sharing, without sharing, or inherited sharing modifiers. See Use the with sharing, without sharing, and inherited sharing Keywords.

Apex classes from installed managed packages don't qualify. The Apex code inside a managed package remains inaccessible, even if declared global.

If this is your first time working in the VS Code IDE, check out the documentation for Salesforce Extensions for Visual Studio Code and Code Builder. You will also need to install the Salesforce Command Line Interface (CLI). If you already have the Salesforce CLI installed, make sure to update it with the sf update command.

Decomposing External Service Registration (ESR) files makes them easier to work with because you can edit the OpenAPI v3 specification in a YAML editor in the VS Code IDE. To decompose your ESR metadata into YAML and metadata XML files, run sf project convert source-behavior -b decomposeExternalServiceRegistrationBeta in the command line to decompose existing ESR metadata files. New ESR files will be automatically decomposed upon generation. This command updates the sfdx-project.json file in your project to include the following:

When deploying the decomposed ESR to the org, the ESR metadata type data is reconstructed into a single record by embedding the YAML contents into the metadata XML.

Your AI AppDev org comes ready for Salesforce development. Salesforce Extensions for VS Code and Code Builder runs commands against this org. Connect to this org and then bring your Apex REST classes into your Salesforce IDE to generate your OAS. See Change or Open your Default Org to learn more about connecting to a Salesforce org.