Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

heroku-examples/heroku-agentforce-tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

💡Heroku Integration Pilot Only:
This branch is only intended for developers who have joined theHeroku Integration Pilot. If you have are not part of the pilot please refer to the main branch of this repository for alternative instructions.

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!

Image description

Step 1 - Deploy to Heroku

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.

LanguageGitHub Repository
PythonGitHub Repository
JavaGitHub Repository

Step 2 - Importing your Heroku App into a Salesforce org

💡Salesforce Org Requirements:
Ensure you have access to Agentforce in your org by searching forAgents in theSetup menu. If not, you can create a temporary org by logging into Trailhead and creating a Playground per the instructionsat 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.

From the directory you completed the above deployment in, run the following commands.

Add the Heroku Integration add-on to your application.

$ heroku addons:create heroku-integration

Connect your Heroku application to the org you intend to configure Agentforce within.

$ heroku salesforce:connect my-org --login-url "https://login.salesforce.com" --store-as-run-as-user

Add the Heroku Integration Service Mesh buildpack to ensure incoming calls from the Salesforce org are authenticated correctly.

$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-heroku-integration-service-mesh

Import your applications and its API specification into the connected org, for Python useapi-spec.json.

$ heroku salesforce:import api-spec.yaml --org-name my-org --client-name HerokuAgentAction

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 heroku-integration-pilot:main

Once complete check your application has been imported by searching forHeroku and thenApps under theSetup menu in your org.

Step 3 - Assigning Permissions

The above process created aHerokuAgentAction permission set to control access to your application from within the org. Search forPermisison Sets underSetup, locate this permission set and clickManage Assignments to assign to your user.

Step 4 - Creating an Agentforce Action

At present to make your imported app accessable to Agentforce you must create a Flow wrapper. This requirement will be removed in the future.

  1. Search forFlows underSetup and clickNew Flow. ClickStart from Scratch, thenNext, and selectAutolaunched Flow (No Trigger). ClickCreate to open theFlow Builder.

  2. From theFlow Builder, open theToolbox by clicking the sidebar icon near the top left of the screen. ClickNew Resource and create the following variable resources.

    • Resource Type: Variable

      • API Name: AgentActionRequestName
      • Data Type: Text
      • Apex Class: Not Applicable
      • Availability Outside the Flow: Available for Input
    • Resource Type: Variable

      • API Name: AgentActionResponseMessage
      • Data Type: Text
      • Apex Class: Not Applicable
      • Availability Outside the Flow: Available for Output
    • Resource Type: Variable

      • API Name: AgentActionRequest
      • Data Type: Apex Defined
      • Apex Class: ExternalService__HerokuAgentAction_AgentRequest
      • Availability Outside the Flow: None

    YourFlow should look like this so far:

    Image description
  3. Click the+ icon in the middle of the canvas and selectAction. In theSearch Actions sidebar, search forHeroku, select thePost Process action, and complete the fields as shown.

    Image description
  4. Click the+ iconbefore theCall Heroku element on the canvas, selectAssignment, and complete as shown.

    Image description
  5. Click the+ iconafter theCall Heroku element on the canvas, selectAssignment, and complete as shown.

    Image description

    Tip: To complete theValue field click into the field and use the popup to select theOutputs from the Call Heroku Action resource, then click_200 and finallymessage.
    Image description

  6. Finally, yourFlow should look like this:

    Image description
  7. ClickSave, enterHeroku Agent Action, and clickSave, followed by clickingActivate.

  8. Search forAgent Actions under theSetup menu, and clickNew Agent Action, selectingFlow as theReference Action Type. In theReference Action search field, search forHeroku so that you see the following:

    Image description
  9. Complete defining the action as follows and clickFinish.

    Image description
    FieldText
    Agent Action InstructionsUse this action in response to requests for a Heroku badge with a name on it.
    AgentActionRequestName InstructionsName to be placed on the badge.
    AgentActionResponseMessage InstructionsThis is the Heroku badge the user requested.

Step 5 - Using Agent Builder

  1. Search forAgents underSetup and be sure to toggle to enableEinstein Copilot for Salesforce.

  2. Click theEinstein Copilot link at the bottom of the page to find theOpen in Agent Builder button.

  3. Click theDeactivate button in the top right of the screen if present.

  4. ClickTopics and theGeneral CRM topic. If theNew Version button is shown, click it.

  5. Click theTopic Configuration tab and append "Also including requests for badges." to the current contents of theClassification Description field.

  6. Click theThis Topic's Actions tab and selectAdd from Asset Library from theNew button dropdown.

  7. Complete the dialog as shown and clickFinish.

    Image description
  8. Finally, click theActivate button in the top right of the screen.

Step 6 - Testing your Action

  1. Open theAgent Builder forEinstein Copilot.

  2. In theConversation Preview, enterI would like a Heroku badge with the name Master Builder on it.

    You can, of course, change the name to your own and share your badge with your friends!

    Image description

Summary

Congratulations on deploying your first Heroku-powered Agentforce Action!

Need some inspiration on what to build?

The examples in this tutorial are intentionally simple, designed to give you a clear starting point for creating your own actions. We have also shared some fully developed action demos, and while their code is not compatible with the Heroku Integartion Pilot, you may want to checkout the video demonstrations and review the code for further inspiration.

ExampleDemo VideoRelated Content
TheArchive 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.LinkImage descriptionBlogCode
With theCoral 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.LinkimageimageCode

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp