Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lessons learned from building AI Agents With Ja...

Lessons learned from building AI Agents With Java, Spring AI and Amazon Bedrock AgentCore

Presentation from the AWS Meetup in June 2026

Avatar for Jeroen Reijn

Jeroen Reijn

June 25, 2026

More Decks by Jeroen Reijn

Other Decks in Programming

Transcript

  1. An AI agent is a software program that can interact

    with its environment, gather data, reason about a goal, and independently take actions to achieve that goal. Humans define the objective, but the agent decides the best steps to complete the task with minimal ongoing supervision. A definition from Amazon Web Services They use tools to interact with the real world. Definition of an AI Agent
  2. Think Signal Answer Observation Action Key aspects of an agent

    Reasoning Acting Observing Planning Collaborating
  3. Elements of an AI Agent Guardrails Conversation Memory Tools RAG

    Prompt Response Loop Input Output agent Large Language Model
  4. Spring AI An application framework for AI engineering. Its goal

    is to apply the Spring ecosystem design principles to the AI domain.
  5. Spring AI features • Support for all major AI Model

    providers such as Anthropic, OpenAI, Microsoft, Amazon, Google, and Ollama. • Portable API support across AI providers for both synchronous and streaming API options are supported. • Structured Outputs - Mapping of AI Model output to POJOs. • Support for all major Vector Database providers such as Apache Cassandra, Azure Vector Search, Chroma, Milvus, MongoDB Atlas, Neo4j, Oracle, PostgreSQL/PGVector, PineCone, Qdrant, Redis, and Weaviate. • Support for Chat Conversation Memory and Retrieval Augmented Generation (RAG).
  6. Agent Persona A system prompt defines the AI Agent's persona,

    behavior, and constraints. It is sent with every request and shapes how the model responds.
  7. System prompt • Define the agent's role and personality •

    Set boundaries on what the agent should or shouldn't do • Provide context about the business domain • Specify response format and tone
  8. Tools calling “AI models don’t have access to real-time information.

    Any question that assumes awareness of information such as the current date or weather forecast cannot be answered by the model. However, we can provide a tool that can retrieve this information, and let the model call this tool when access to real-time information is needed.”
  9. "What day is tomorrow?" “I am an AI and do

    not have access to real-time information. Please provide the current date so I can accurately determine what day tomorrow will be.”
  10. Spring AI Agent Utils Spring AI Agent Utils reimplements core

    Claude Code capabilities as Spring AI tools, enabling sophisticated agentic workflows with file operations, shell execution, web access, task management, and extensible agent skills.
  11. Conversation memory • Chat Memory: The information that a large-language

    model retains and uses to maintain contextual awareness throughout a conversation. • Chat History: The entire conversation history, including all messages exchanged between the user and the model.
  12. AgentCore Runtime • Framework agnostic runtime for agents • Isolated

    sessions • Serverless endpoints • Embedded identity • Low cold-start • Rapid deployment • Long running async execution (up to 8 hours) • MCP & A2A compatible
  13. AgentCore Runtime - Framework agnostic • Source code based •

    Supports Python and Node (22) • Containerized workloads • Bring any application framework
  14. AgentCore Runtime - Pricing • Billing is calculated per second,

    using actual CPU consumption and peak Memory consumed up to that second, with a 1-second minimum • You only pay for actual resource consumption during your session, which spans from microVM boot, initialization, active processing, idle periods, until session termination (microVM shutdown) • Billing includes system overhead in addition to your application's resource usage • 128MB minimum memory billing applies for memory
  15. • Cost calculation is quite complex: • Browser tool, Runtime,

    Code Interpreter are based on CPU and Memory usage • Web Search on AgentCore - $7.00 per 1,000 queries • Gateway is based on invocations • Identity is based on tokens or API keys • Memory (per 1000 events, records stored, retrieval) • Evaluations is based on input and output tokens • Policy is based on per request and input tokens AgentCore Pricing – Consumption based
  16. Bedrock Converse API • Tool/Function Calling: Support for function definitions

    and tool use during conversations • Multimodal Input: Ability to process both text and image inputs in conversations • Streaming Support: Real-time streaming of model responses • System Messages: Support for system-level instructions and context setting
  17. Take-aways • Spring AI is a mature project to build

    agents in Java. • Spring AI AgentCore is a community driven project, but still under development and does not yet support Spring AI 2.0 and Spring 4. • Amazon Bedrock AgentCore offers a wide range of services, but making it work together has a steep learning curve. • Amazon Bedrock AgentCore is a great way to run Enterprise grade agents. • AWS CDK offers an official L2 library for AgentCore, but Constructs differ in maturity and feature parity. • Keeping up is a challenge
  18. Further references • Spring AI - https://spring.io/projects/spring-ai • Spring AI

    AgentCore - https://github.com/spring-ai- community/spring-ai-agentcore • AWS Spring AI AgentCore workshop https://catalog.workshops.aws/java-spring-ai-agentcore/en-US • https://www.coenradie.com/posts/short-and-long-term-memory- with-amazon-bedrock-agentcore-and-spring-ai/