Building AI Agents with Spring AI, Embabel and Amazon Bedrock AgentCore - Part 4

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore

Building AI Agants with Spring AI, Embabel and Amazon Bedrock AgentCore - Part 1

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore – Part 1 Introduction to the series and to the Embabel framework

Building AI Agents with Spring AI, Embabel and Amazon Bedrock AgentCore - Part 2

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore – Part 2 Develop Agents with Embabel shell

Building AI Agents with Spring AI, Embabel and Amazon Bedrock AgentCore - Part 3

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore – Part 3 Develop Agents as web application with Embabel

Building AI Agents with Spring AI, Embabel and Amazon Bedrock AgentCore - Part 4

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore – Part 4 Upgrade sample application to Embabel 1.5

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore – Part 4 Upgrade sample application to Embabel 1.5

Upgrade sample application to Embabel 1.5 to support Spring Boot 4.x and Spring AI 2.x

In parts 2 and 3, we developed our sample application and interacted with it via the shell and HTTP. We used Embabel version 1.0 there, which targets Spring Boot 3.x / Spring AI 1.x.

Recently, the Embabel team released version 1.5, which supports Spring Boot 4.x / Spring AI 2.x. In this article, we’ll explain how to migrate our sample application to the Embabel 1.5.x version. You can find the final version of the application in my GitHub repository.

The migration for my use case is really simple. First, in pom.xml we need to declare this Embabel version:

<properties>
   <java.version>25</java.version>
   <embabel-agent.version>1.5.1</embabel-agent.version>
</properties>

Please note that we use version 1.5.1 here. With version 1.5.0, I ran into a specific problem while using the Amazon Bedrock Converse API. This was due to the fact that BedrockOptionsConverter created generic ToolCallingChatOptions. Spring AI 2.0’s BedrockProxyChatModel expects BedrockChatOptions and casts the request options accordingly, causing:

ClassCastException: DefaultToolCallingChatOptions cannot be cast to BedrockChatOptions

With version 1.5.1, the Embabel team fixed the problem. Next, as Spring Boot 4.x / Spring AI 2.x uses Jackson version 3 by default, we need to declare a Jackson 3 mapper Spring bean. We do it in the Spring Boot main EmbabelConferenceApplication application class of our sample application:

@Bean
public JsonMapper objectMapper() {
    return new tools.jackson.databind.json.JsonMapper();
}

That’s it. Now you can compile, start, and interact with our sample application the same way we described in parts 2 and 3.

If you like my content, please follow me on GitHub and give my repositories a star!

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore

Building AI Agents with Embabel, Spring AI and Amazon Bedrock AgentCore – Part 3 Develop Agents as web application with Embabel