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 forAgents
in theSetup
menu. If not, you can obtain a free Salesforce Developer Edition org here. Be sure to visitEinstein Setup
to enable Einstein, the fresh the page and search forAgentforce Agents
to 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
Agents
in theSetup
menu. 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 Setup
under theSetup
menu 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 thejq
utlity, runheroku apps:info --json
manually and extract the value from theapp
json 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 Assets
under theSetup
menu, and on theActions
tab, clickNew Agent Action
, selectingAPI
as theReference Action Type
. Then selectHeroku
from theReference Action Category
. In theReference Action
search 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 Agents
underSetup
. -
Click the
Agentforce (Default)
link at the bottom of the page to find theOpen in Agent Builder
button. -
Click the
Deactivate
button in the top right of the screen if present. -
Click
Topics
and theGeneral CRM
topic. If theNew Version
button is shown, click it. -
Click the
Topic Configuration
tab and append "Also including requests for badges." to the current contents of theClassification Description
field. ClickSave
. -
Click the
This Topic's Actions
tab and selectAdd from Asset Library
from theNew
button dropdown. -
Complete the dialog as shown and click
Finish
. -
Finally, click the
Activate
button in the top right of the screen.
-
Open the
Agent Builder
forEinstein Copilot
. -
In the
Conversation Preview
, enterGenerate a badge for Astro
You 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 |