---
title: "How to Create an AI Agent With Heroku and Agentforce"
description: "The post shows how to extend Salesforce Agentforce with a Heroku-hosted custom action when customer information remains in older, unstructured cloud archives and requires scalable, real-time processing. It explains that Agentforce selects discrete actions, while Heroku exposes code through External Services using an OpenAPI description of the request and response. The sample uses Java and Spring Boot, an H2 in-memory database, springdoc.org for OpenAPI generation, and Spring AI to convert natural-language questions into SQL before returning results for an Agentforce response. The integration is identified as pilot-only and not intended for production, while the post also points to Heroku Postgres, Heroku Connect, Data Cloud, and pgvector as extensions for other agent use cases."
---

# How to Create an AI Agent With Heroku and Agentforce

[Heroku](https://yomu.fyi/company/heroku) · Andrew Fawcett · Oct 17, 2024

**Type:** Tutorial

## Summary

The post shows how to extend Salesforce Agentforce with a Heroku-hosted custom action when customer information remains in older, unstructured cloud archives and requires scalable, real-time processing. It explains that Agentforce selects discrete actions, while Heroku exposes code through External Services using an OpenAPI description of the request and response. The sample uses Java and Spring Boot, an H2 in-memory database, springdoc.org for OpenAPI generation, and Spring AI to convert natural-language questions into SQL before returning results for an Agentforce response. The integration is identified as pilot-only and not intended for production, while the post also points to Heroku Postgres, Heroku Connect, Data Cloud, and pgvector as extensions for other agent use cases.

## Context

UltraConstruction’s older invoices are stored in cloud archives as Microsoft Word documents, PDFs, and images. Its Salesforce agents need access to this information without importing it, while employees need answers to invoice-related questions without delays caused by inaccessible data.

## Approach / What changed

Build a custom Agentforce action on Heroku using Java and Spring Boot. The action exposes an OpenAPI-described API through External Services, processes invoice data into an H2 database, uses Spring AI to translate natural-language queries into SQL, and returns the results to Agentforce for a natural-language response.

## Takeaways

- Agentforce custom actions can be built with Apex or Flow for Salesforce-resident data and modest computational needs; Heroku supports custom actions in other languages and more intensive processing.
- Heroku-powered actions are exposed through Salesforce External Services and must describe their request and response using the OpenAPI standard before being imported into Agent Builder.
- The sample combines Spring AI with H2: Spring AI converts an Agentforce user’s natural-language question into SQL, which is executed against the in-memory relational database.

**Tags:** [Agentforce](https://yomu.fyi/topic/agentforce), [Heroku](https://yomu.fyi/topic/heroku), [Java](https://yomu.fyi/topic/java), [OpenAPI](https://yomu.fyi/topic/openapi)

- Source: [Heroku](https://www.heroku.com/blog/building-supercharged-agents-heroku-agentforce)
- Source URL: https://www.heroku.com/blog/building-supercharged-agents-heroku-agentforce
- Ingested by Yomu: 2026-09-10T00:04:31.610Z

[Read original post](https://www.heroku.com/blog/building-supercharged-agents-heroku-agentforce)
