This tutorial will guide you through configuring an Agentforce Action deployed to Heroku within your Salesforce org. This allows Agentforce agents to access powerful custom-coded actions written in Python and other languages, leveraging Heroku's fully managed and elastic compute service. By the end, you will be able to generate your own badge as shown below!
This tutorial provides examples in Java and Python for coding a basic Agentforce action. Complete the standard Heroku deployment instructions in one of the following repositories before progressing to the next step.
| Language | GitHub Repository |
|---|---|
| Python | GitHub Repository |
| Java | GitHub Repository |
💡 Heroku AppLink:
These steps utilize generally availble features in Heroku and Salesforce. If you had joined the Heroku Integration pilot program please refer to these alternative instructions.
💡 Salesforce Org Requirements:
Ensure you have access to Agentforce in your org by searching forAgentsin theSetupmenu. If not, you can obtain a free Salesforce Developer Edition org here. Be sure to visitEinstein Setupto enable Einstein, the fresh the page and search forAgentforce Agentsto enable Agentforce. Finally on the same page clickEnable the Agentforce (Default) Agent.
💡 Salesforce Org Requirements: Ensure you have access to Agentforce in your org by searching for
Agentsin theSetupmenu. If not, you can create a temporary org by logging into Trailhead and creating a Playground per the instructions at the top of this module (you do not need to complete the module). Once you have access to the org, locateEinstein Setupunder theSetupmenu and Enable Einstein, which will also enable Agentforce.
Add Heroku AppLink to your application.
heroku addons:create heroku-applink
Configure the application ID as follows:
heroku config:set HEROKU_APP_ID="$(heroku apps:info --json | jq -r '.app.id')"
💡 jq utility:
If you do not have thejqutlity, runheroku apps:info --jsonmanually and extract the value from theappjson structure output to the console.
Connect your Heroku application to the org you intend to configure Agentforce within.
heroku salesforce:connect my-org
Add Heroku AppLink Service Mesh buildpack to ensure incoming calls from the Salesforce org are authenticated correctly.
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-heroku-applink-service-mesh
Import your applications and its API specification into the connected org, for Python use api-spec.json.
heroku salesforce:publish api-spec.yaml --client-name BadgeService --connection-name my-org --authorization-connected-app-name BadgeServiceConnectedApp --authorization-permission-set-name BadgeServicePermissions
Lastly trigger a redeploy of the application to ensure the service mesh is running using the following commands.
git commit --allow-empty -m "empty commit"
git push heroku main
Once complete check your application has been imported by searching for Heroku and then Apps under the Setup menu in your org.
The above process created BadgeService and BadgeServicePermissions permission sets to control access to your application from within the org. Search for Permisison Sets under Setup, locate these permission sets and click Manage Assignments to assign to your user.
-
Search for
Agent Assetsunder theSetupmenu, and on theActionstab, clickNew Agent Action, selectingAPIas theReference Action Type. Then selectHerokufrom theReference Action Category. In theReference Actionsearch field, search forGenerate Badge. Your dialog should look like the following:
-
Complete defining the action as follows and click
Finish.
| Field | Text |
| ----- | ---- |
| `Agent Action Instructions` | Use this action in response to requests for a Heroku badge with a name on it. |
| `AgentActionRequestName Instructions` | Name to be placed on the badge. |
| `AgentActionResponseMessage Instructions` | This is the Heroku badge the user requested. |
-
Search for
Agentforce AgentsunderSetup. -
Click the
Agentforce (Default)link at the bottom of the page to find theOpen in Agent Builderbutton. -
Click the
Deactivatebutton in the top right of the screen if present. -
Click
Topicsand theGeneral CRMtopic. If theNew Versionbutton is shown, click it. -
Click the
Topic Configurationtab and append "Also including requests for badges." to the current contents of theClassification Descriptionfield. ClickSave. -
Click the
This Topic's Actionstab and selectAdd from Asset Libraryfrom theNewbutton dropdown. -
Complete the dialog as shown and click
Finish.
-
Finally, click the
Activatebutton in the top right of the screen.
-
Open the
Agent BuilderforEinstein Copilot. -
In the
Conversation Preview, enterGenerate a badge for AstroYou can, of course, change the name to your own and share your badge with your friends!
Congratulations on deploying your first Heroku-powered Agentforce Action!
We are working to improve and simplify this process, so please follow this repository to stay informed on updates.
The examples in this tutorial are intentionally simple, designed to give you a clear starting point for creating your own actions. We have also included fully developed actions below.
| Example | Demo Video | Related Content | |
|---|---|---|---|
| The Archive Agent action demonstrates using Heroku to access and perform complex computations over unstructured archived data. It uses AI to interpret natural language requests from users to perform a wider array of dynamic calculations on the data. | Link | ![]() |
Blog Code |
| With the Coral Cloud Collage Agent, we explore how Coral Cloud Resort invites its guests to browse and book unique experiences throughout their stay using Agentforce. With Heroku, we extend the agent's functionality to generate a personalized collage of each guest's adventures, showcasing how custom code deployed on Heroku can create dynamic digital media delivered directly within the Agentforce experience. | Link | ![]() |
Code |



