|||

Video Transcript

X

Building Supercharged Agents with Heroku and Agentforce

Heroku is a powerful general-purpose PaaS offering, but when combined with the broader Salesforce portfolio, it excels in unlocking and unifying customer data, regardless of its age, location, size, or structure. One of the key reasons why Salesforce customers turn to Heroku is when they require such data to be securely linked to high-scale experiences, such as consumer web or mobile apps, or when they need scalable compute resources to access and analyze more intricate and complex data in real time. In this blog, we’ll explore how to supercharge Agentforce by leveraging one of the ways in which the Heroku platform is used to transform data from diverse sources, offering comprehensive, real-time information that keeps employees in the flow of work.

Supercharge Agentforce with Heroku

Salesforce recently launched a new AI-driven technology, Agentforce, along with an array of prebuilt agents tailored to each role within Customer 360, from service to sales and various industries. Agentforce relies on discrete actions described to the AI engine, allowing it to interpret user questions and execute one or more actions (effectively coded functions) to deliver an answer.

However, some use cases require actions that are more customized to a specific business or workflow. In these situations, custom actions can be built using both code and low-code solutions, enabling developers to extend the range of actions available to Agentforce. Developers can utilize Apex or Flow, and if the necessary data resides within Salesforce, and the complexity and computational needs are minimal, both options are worth exploring first. However, if this is not the case, a Heroku custom action written in languages other than Apex can be added to Agentforce agents, as will be demonstrated in this blog post.

Introducing UltraConstruction, an Agentforce User

Let's take a look at a use case first. UltraConstruction, a 60-year-old company, uses Salesforce Sales and Service Cloud agents to handle customer inquiries. However, their older, unstructured invoices are stored in cloud archives, creating access challenges for their AI agents and leading to delays and customer frustration.

Data access challenges with Agentforce

UltraConstruction’s Agentforce builders and developers have discovered that older invoice information is stored in cloud file archives in various unstructured formats, such as Microsoft Word, PDFs, and images. UltraConstruction does not need this information imported but requires it to be accessible by their agents.

archived invoices

UltraConstruction’s developers know that Java has a rich ecosystem of libraries to handle such formats, and that Heroku offers the vertical scalability needed to process and analyze the extracted data in real time. With the additional help of AI, they can make the action more flexible in terms of the queries it can handle—so they get coding! The custom Agentforce action they develop on Heroku accesses information without moving that data, and answers not only the above query but practically any other query that sales or service employees might encounter.

Heroku helps agentforce access information

An Agentforce and Heroku Integration Blueprint

UltraConstruction’s use case can occur regardless of the type, age, location, size, or structure of the data. Even for data already residing in Salesforce, more intensive computational tasks such as analytics, transformations, or ad-hoc queries are possible using Heroku and its array of languages and elastic compute managed services. Before we dive into the UltraConstruction Agentforce action, let's review the overall approach to using Heroku with Agentforce.

Using Heroku with Agentforce - a blueprint

On the far right of the diagram above, we can see customer data depicted in various shapes, sizes, and locations, all of which can be accessed by Heroku-managed code on behalf of the agent. In the top half of the diagram, Agentforce manages which actions to use. Heroku-powered actions are exposed via External Services and later imported as an Agent Action via Agent Builder.

In the bottom half of the diagram, since External Services are used, the only requirement for the Heroku app is to support the OpenAPI standard to describe the app's API inputs and outputs, specifically the request and response of the action. Finally, keep in mind that Heroku applications can call out to other services, leverage Heroku add-ons, and utilize many industry programming languages with libraries that significantly speed up the development process.

A Sample Agentforce Heroku Action

Now that you know the use case and the general approach, in the following video and GitHub repository README file, you will be able to try this out for yourself! The action has been built to simulate the scenario that UltraConstruction found themselves in, with some aspects simplified to make the sample easier to understand and deploy. The following diagram highlights how the above blueprint was taken and expanded upon to build the required action.

Heroku and Agentforce action diagram

The primary changes to note are:

  • Java, along with Spring Boot
    The Spring framework offers a wide range of tools that make managing data, security, and calling AI LLMs (Large Language Models) very simple with minimal code. It supports both web and API-based applications.
  • H2 is a highly optimized in-memory database
    Stores data from processed invoice documents in a relational form, ready for querying.
  • springdoc.org is used to generate an OpenAPI schema
    Java is a strongly typed language, making it an excellent choice for building and defining APIs. This library requires minimal configuration for compliant OpenAPI APIs, which are required by External Services.
  • Spring AI has been used to simplify access to industry LLMs
    Spring AI is easy to configure and often requires minimal coding—sometimes just one line of code—to tap into powerful LLMs, such as those provided by OpenAI and others. In this case, it is responsible for taking the natural language query entered into the Agentforce agent and converting it into SQL, which is run against the H2 database. The result of this query is then returned to Agentforce and integrated into a natural language response for the user.

If you're interested in viewing the code and a demonstration, you can watch the video below. When you're ready to deploy it yourself, review the deployment steps in the README.

Conclusion

Code is a powerful tool for integration, but keep in mind that Heroku also provides out-of-the-box integrations that bring Salesforce data closer to your application through Heroku Postgres and our Heroku Connect product. We also support integrations with Data Cloud. Heroku also offers pgvector as an extension to its managed Postgres offering, providing a world class vector database to support your retrieval augmented generation and semantic search needs. You can see it in action here. While this blog's customer scenario didn’t require these capabilities, other agent use cases may well benefit from these features, further boosting your agent actions! Last but not least, we at Heroku consider feedback a gift, so if you have broader ideas or feedback, please connect with us via the Heroku GitHub roadmap.

Updates

Since publishing this blog, we have released additional content we wanted to share.

This step by step tutorial, available in Java and Python, will guide you through configuring an Agentforce Action deployed on Heroku within your Salesforce org. By the end, you will be able to ask Agentforce to generate your own badge, as shown below!

Heroku Agentforce Tutorial

An additional demonstration video and sample code, diving deeper into how Heroku enhances Agentforce agents' capabilities. In this expanded version of the popular Coral Cloud Resort demo, vacationing guests can use Agentforce to browse and book unique experiences. With Heroku, the agent can even generate personalized adventure collages for each guest, showcasing how custom code on Heroku enables dynamic digital media creation directly within the Agentforce platform.

Coral Cloud Resorts

Originally published: October 17, 2024

Browse the archives for engineering or all blogs Subscribe to the RSS feed for engineering or all blogs.