r/SpringAIDev • • May 18 '26

Video Spring AI : Generate output in the JSON format via Prompting and OutputParser

Thumbnail
youtube.com
2 Upvotes

In this tutorial, TechyTacos explores how Java developers can effectively generate JSON output using Spring AI. The video provides a practical walkthrough for moving beyond simple text-based responses toward structured, reliable data integration.

Key Takeaways

  • Prompt engineering alone often results in text that mimics JSON but lacks true programmatic structure.

  • BeanOutputParser is the recommended tool for mapping AI responses directly to Java records.

  • Defining a Java record serves as the schema for the expected output data structure.

  • Developers must include formatting instructions in the prompt template to ensure consistent parsing.

  • Setting the output parser on the template ensures the AI adheres to the requested schema.

  • Using the .parse() method converts the raw AI response into a type-safe object ready for use.

By implementing the BeanOutputParser, you ensure your application receives valid, type-safe JSON.


r/SpringAIDev • • Jul 23 '26

Model Context Protocol (MCP) With Spring AI - Travel Booking Demo

Post image
6 Upvotes

Just published !.. - MCP With Spring AI - Part 2: Travel Booking Demo.

Part 1 covered the protocol. Part 2 is where it gets practical.

One chat prompt. Three MCP servers. One travel assistant:

"Plan my trip from Delhi to Goa - book flight, hotel and cab."

No hard-coded workflow. The LLM picks the tools and chains them: searchFlights → bookFlight → bookHotel → bookCab.

Read the full walkthrough here 👇:
https://heapsteep.com/mcp-with-spring-ai-travel-booking-demo


r/SpringAIDev • • Jul 23 '26

Model Context Protocol (MCP) With Spring AI - Core Concepts

Post image
3 Upvotes

Just published Model Context Protocol (MCP) With Spring AI - Part 1.

LLMs are great at understanding intent. On their own, they still can't do things - book a flight, call an API, hit your database.

That's where MCP comes in: a standard way for AI to discover and call external tools.

In Part 1 I break down the concepts (before any code).

Read the full walkthrough here 👇:
https://heapsteep.com/mcp-with-spring-ai-core-concepts


r/SpringAIDev • • Jun 23 '26

Self-Correcting Structured Output in Spring AI 2.0

Post image
4 Upvotes

r/SpringAIDev • • Jun 23 '26

Tool Calling in Spring AI 2.0: A Composable, Agentic Architecture

Post image
10 Upvotes

https://spring.io/blog/2026/06/15/spring-ai-composable-tool-calling

Tool calling - the ability for an AI model to invoke application-defined functions and act on the results — is the essential building block of agentic AI systems. A model that can discover information, take action, and loop until a goal is reached is an agent.

Spring AI 2.0 lifts the tool loop into the advisor chain as a first-class, composable component.

ChatClient runs every request through an ordered chain of advisors and supports looping, letting an advisor re-enter the downstream chain. The same mechanism drives tool-call loops, structured-output retry loops, and evaluation loops alike.


r/SpringAIDev • • Jun 23 '26

Tool Calling in Spring AI 2.0: A Composable, Agentic Architecture

Post image
7 Upvotes

Tool calling — the ability for an AI model to invoke application-defined functions and act on the results — is the essential building block of agentic AI systems. A model that can discover information, take action, and loop until a goal is reached is an agent.

Spring AI 2.0 re-architects tool calling. In 1.x, each chat model implementation contained its own private tool execution loop — functional, but buried. There was no way to hook into it, observe intermediate steps, or compose it with other behaviors. You could call tools; you could not build on top of tool calling.

2.0 lifts the tool loop into the advisor chain as a first-class, composable component. ChatClient runs every request through an ordered chain of advisors and supports looping, letting an advisor re-enter the downstream chain. The same mechanism drives tool-call loops, structured-output retry loops, and evaluation loops alike.

https://spring.io/blog/2026/06/15/spring-ai-composable-tool-calling


r/SpringAIDev • • Jun 16 '26

Video Comparing Agentic AI Frameworks for Java by Timo Salm / Sandra Ahlgrimm @ Spring I/O 2026

Thumbnail
youtube.com
3 Upvotes

Timo Salm and Sandra Ahlgrimm explore the evolution of agentic AI frameworks within the Java ecosystem, comparing how different tools manage autonomous reasoning and orchestration.

Highlights & Key Takeaways

  • Agentic Shift: Move from static, prompt-driven interactions to autonomous, goal-oriented systems.

  • Spring AI: Leverages an Advisor API for intercepting and managing LLM call chains.

  • LangChain4j: Offers a community-driven, framework-agnostic approach with a dedicated Agentic Module.

  • Embable: Provides high-level abstractions focused on automated planning, goal-oriented execution, and domain modeling.

  • Workflow Patterns: Utilize strategies like prompt chaining, parallelization, and evaluator-optimizer loops.

  • Token Economy: Optimize performance and cost by minimizing metadata overhead and managing tool invocation efficiently.

Building autonomous systems on the JVM requires balancing architectural control against the abstraction layers provided by the framework.

👉 Watch the full video to dive deeper into the implementation.


r/SpringAIDev • • Sep 02 '26

Video Getting Started with Ollama, Llama 3.1 and Spring AI

Thumbnail
youtube.com
4 Upvotes

Dan Vega demonstrates how to deploy open-source Large Language Models (LLMs) locally using Ollama and integrate them into Spring Boot applications via Spring AI.

Highlights & Key Takeaways

  • Local Execution: Run LLMs locally to ensure data security and avoid costs associated with public APIs.

  • Ollama Setup: Easily download and manage models like Llama 3.1 directly from the command line.

  • Model Versatility: Swap between various open-source models without changing application code.

  • Open WebUI: Use Docker to deploy a familiar ChatGPT-like interface for your local LLM instances.

  • Spring AI Integration: Leverage the Spring AI starter for seamless interaction with local models.

  • Function Calling: Implement tools to allow LLMs to access real-time data, like weather services.

Running models locally offers developers a secure, cost-effective, and flexible way to leverage AI within the Spring ecosystem.

👉 Watch the full video to dive deeper into the implementation.


r/SpringAIDev • • May 27 '26

Spring Boot + Spring AI vs Python ecosystem for Backend/AI engineering?

Thumbnail reddit.com
2 Upvotes

r/SpringAIDev • • Aug 29 '26

Video State of the Art of Spring AI • Josh Long • GOTO 2025

Thumbnail
youtube.com
7 Upvotes

Josh Long demonstrates how Spring AI, now generally available, empowers Java developers to build production-ready AI applications. The session proves that Java is a robust, scalable choice for integrating complex AI workloads alongside traditional enterprise systems.

Highlights & Key Takeaways

  • System Prompts: Use these to guide model behavior and maintain goal alignment.

  • Chat Memory: Implement stateful interactions to overcome the stateless nature of base models.

  • Tool Calling: Enable AI to interact with the outside world through custom functions.

  • RAG Patterns: Use vector stores for efficient, context-aware retrieval of internal data.

  • Protocol Support: Leverage the Model Context Protocol (MCP) for modular, reusable AI services.

  • Performance: Optimize with GraalVM native images for lower footprints and rapid startup.

By combining these patterns, you build modular, intelligent, and secure systems. Spring AI makes implementing advanced AI architecture accessible for Java teams.

👉 Watch the full video to dive deeper into the implementation.


r/SpringAIDev • • Jun 16 '26

Tutorial Spring AI structured output: how to make a model correct itself

2 Upvotes

If you use an LLM for something else than just a free-form chatting, you might probably want it to return data in a structured form, e.g. JSON

Spring AI allows to [soft] force a model to do that. But sometimes LLM fails to do that. The simplier the model is, the more chances that it will fail. Morover, any such a failure could be devided into 2 categories: incorrect schema and correct schema with incorrect data burned in. For example, some fields of the desired schema are missing. Or all fields are present, but field type, for example, is incorrect or a required filed missies a value

The POC i built validates not only schema as such, but also field types and ranges (e.g. Min-Max, NotNull, etc.) using validation package spring-boot-starter-validation

If any of the checks doesn't pass, this is feded back to model:

prompt = """
        Your previous response was invalid.

        Problem(s): %s

        Your previous output was:
        %s

        Return corrected JSON that fixes these problems and matches the
        schema exactly. Output ONLY JSON, no prose.

        %s
        """.formatted(lastError, lastOutput, format);

So we give a feedback to the model, not just asking to redo/re-think. By providing a detailed feedback we increase chances that the next reply will satisfy our expectations

As always, all code is available in the github repo: https://github.com/DmitryFinashkin/spring-ai

You might also like to watch a detailed video walk-through on YouTube: https://youtu.be/59kcnTLVu0Q


r/SpringAIDev • • May 14 '26

Video Spring AI Introduction: Building AI Applications in Java with Spring

8 Upvotes

If you have been feeling the pressure to switch over to Python just to start experimenting with AI, this video is for you. It serves as a great introductory guide for Java and Spring developers looking to bring generative AI capabilities directly into the enterprise ecosystem, helping you leverage powerful LLMs like GPT-4 without leaving the Spring environment you already know and love.

Here is a breakdown of what the video covers:

  • Understanding LLM integration by treating them as standard REST APIs rather than black boxes.

  • An introduction to the Spring AI framework and how it applies familiar principles like modularity and POJOs to AI engineering.

  • A practical walkthrough of building a Spring Boot application from scratch, including secure API key management using environment variables.

  • Implementing a functional ChatController using the ChatClient interface to communicate with an LLM.

  • An overview of the next-level challenges developers will face, including prompt engineering and Retrieval-Augmented Generation (RAG).

It is a perfect entry point for anyone looking to modernize their stack and start building AI-powered applications without switching languages. It bridges that gap between traditional Java development and the rapidly evolving AI landscape, showing how clean and accessible integration can be.

Check out the full video if you are ready to start building!

👇
https://www.youtube.com/watch?v=yyvjT0v3lpY


r/SpringAIDev • • Aug 27 '26

Article Spring AI Recipe: Enabling Agent-to-Agent Communication with A2A

Thumbnail
thetalkingapp.medium.com
3 Upvotes

In this tutorial, Craig Walls explains how to enable Agent-to-Agent (A2A) communication, allowing specialized Spring AI agents to collaborate effectively.

Highlights & Key Takeaways

  • A2A Architecture: Uses HTTP and Spring MVC to help agents delegate workloads.

  • Configure ChatClient: Define a bean equipped with specific functional tools.

  • AgentExecutor: Bridge incoming requests directly to your LLM.

  • The AgentCard: Expose a JSON document detailing skills for agent discovery.

  • Precise Descriptions: Write clearly so client agents can evaluate relevance.

  • Testing: Validate responses locally using the A2A Inspector.

Wrapping an LLM in a machine-readable contract establishes the foundation for robust multi-agent systems. This ensures agents can securely discover and utilize one another.

👉 Read the full article to dive deeper into the implementation.


r/SpringAIDev • • Sep 01 '26

Tutorial Spring AI Recipe: Enabling Long-Term Memory

Thumbnail
thetalkingapp.medium.com
2 Upvotes

In his latest recipe, Craig Walls empowers Spring AI agents with long-term memory. This allows systems to retain durable facts across sessions instead of starting from scratch.

Highlights & Key Takeaways

  • Memory Types: Spring AI manages short-term, procedural, and long-term memory.

  • Selective Retention: Agents learn facts that are both significant and durable.

  • Implementation: Enabled using the AutoMemoryToolsAdvisor component.

  • Prompt Augmentation: The LLM is guided to extract key conversational details.

  • Persistence: Memories are saved as structured Markdown files on the filesystem.

  • Feedback Loop: Extracted facts are automatically injected into future prompts.

By persisting data across restarts, agents evolve beyond stateless responders. This yields highly personalized systems that continuously adapt to users.

👉 View the source code to dive deeper into the implementation.


r/SpringAIDev • • May 10 '26

Spring AI Recipe: Building a Text-Based Chat Loop Around ChatClient | by Craig Walls | Apr, 2026

Thumbnail
thetalkingapp.medium.com
2 Upvotes

In this article, we learn how to build a simple conversation application with SpringAI by using the `ChatClient` interface to establish communication with an AI model and a `MessageChatMemoryAdvisor` object to keep the conversational context.


r/SpringAIDev • • May 07 '26

Discussion The AI landscape and where Spring AI fits in

2 Upvotes

AI is now an ubiquitous technology and with it, a whole new field emerges as well: the AI engineering.

However, as more and more people decides to start (or shift to) an AI career, the term drifts to be overused. After all, an AI engineer is someone who specializes in using AI or building AI?

Honestly, I don't think there's a right answer. Many people and companies will just come out with their own definitions and stick to it.

So, how to build an AI career?

In my opinion, more important that pursue a specific title or role, is to understand the different type of works involved in AI development and what needs to be done to get in those positions.

The way I see the AI landscape, in a very simplified way, is defined by two opposite positions:
* the traditional AI researcher: someone with a PhD degree in computer science that publish papers on new algorithms and architectures
* the heavy AI user: some who is high skilled in applying different AI tools on many different fields, like administration, medicine, law, marketing and many others

and between these two positions, there's a whole variety of professional that works close to on extreme or the other. Professional who are focused on implementing algorithms and tools, model building, building data ingestion pipelines, systems integration and many others...

So I would like to know from those who are willing to build an AI career. Which kind of position do you identify with? I'd love to know the thoughts from the members of our community in our comments.


r/SpringAIDev • • Sep 11 '26

News IA : les alertes d'experts se multiplient, le Congrès états-unien veut légiférer • FRANCE 24

Post image
3 Upvotes

☕🍃🗓️ [SAVE THE DATE: 24 Sept] How a JAVA CHAMPION uses AI to build a ROBUST SPRING BOOT app

(AI SpringBoot Secrets with Java Champ)

On September 24, Java Champion Laurentiu Spilca will build a complete Spring Boot application live with Packt.

👉https://luma.com/packt-qsxz?coupon=VIN40

The interesting part?

He won’t just use AI to generate code.

He’ll show how to leverage AI across the workflow to make the application more robust:

▪️ implementation

▪️ testing

▪️ debugging

▪️ code review

▪️ refactoring

All while keeping engineering decisions in the developer’s hands.

That is the AI discussion I find interesting:

not “Can AI write Java?”

But:

“How does a Java Champion use AI to write BETTER Java?”

🔗 Join the Packt workshop: https://luma.com/packt-qsxz?coupon=VIN40

#Java #SpringBoot #JavaChampion #Packt #AI #SoftwareEngineering

https://luma.com/packt-qsxz?coupon=VIN40


r/SpringAIDev • • Aug 20 '26

Discussion What is YOUR biggest challenge in adopting Spring AI in your project?

4 Upvotes

Hi community,

With the growing demand for AI applications, most popular languages and stacks now offer some form of support for AI development. And that would be no different with Java and Spring, as they represent one of the most popular development platforms for enterprise applications. Yet, many Java and Spring developers are still struggling with AI development or trying to learn Python to fill that gap.

So, I would like to know from you: when it comes to adopting Spring AI, what is your biggest challenge, problem, or frustration you are dealing with right now? The more detail you provide, the greater the chance that I (or someone else) will create content to help you with your problem.

If you think your problem is too complex for this post, I invite you to create a dedicated post for it and link it here!


r/SpringAIDev • • May 19 '26

Working with Prompts in Spring AI - Effectively Communicating with LLMs

Thumbnail
youtube.com
2 Upvotes

In this tutorial, Dan Vega explores how to effectively communicate with Large Language Models (LLMs) using Spring AI. While many view Spring AI simply as an API abstraction, Dan demonstrates that the real challenge lies in mastering prompt design to guide AI behavior and achieve precise, reliable outputs in your Java applications.

Key Takeaways

  • Prompts are foundational inputs that dictate the style and quality of AI output.

  • Move beyond simple strings by using Prompt Templates for dynamic, reusable logic.

  • Leverage the User role for specific queries and the System role to enforce behavioral constraints.

  • Use System messages to define an AI's persona, such as an exclusive dad-joke generator.

  • Externalize your prompt templates into .st files to keep your code clean and manageable.

  • Always instruct the model to state if it lacks an answer to prevent hallucinations.

Mastering these techniques is essential for moving from basic prototypes to robust, production-ready AI tools.


r/SpringAIDev • • May 11 '26

News Our community grow to 100 members!

3 Upvotes

Hi everybody!

Our Spring AI Dev community reached the mark of 100 members this weekend. I'd like to thank all of you who have been visiting, voting, and commenting on our posts!

Let's keep the momentum and keep bringing your content, questions, votes, and comments!

Cheers!


r/SpringAIDev • • Sep 03 '26

Video Production-worthy AI with Spring AI, MCP, and Spring Security

Thumbnail
youtube.com
2 Upvotes

Coffee + Software demonstrates how to build production-ready AI agents using Spring AI, MCP, and Spring Security. The video illustrates that Java developers can leverage existing institutional expertise to deploy secure, scalable, and observable AI services.

Highlights & Key Takeaways

  • Use the Spring AI chat client for unified model interactions.

  • Implement Advisors to manage statelessness with chat memory.

  • Utilize RAG patterns with vector stores for semantic search.

  • Safely expose business logic via the Model Context Protocol (MCP).

  • Secure services using OAuth2 and the Spring Authorization Server.

  • Leverage virtual threads and GraalVM native images for efficiency.

  • Enable Actuator for comprehensive system observability.

Building enterprise-grade AI is not about rewriting stacks, but integrating AI into robust, proven Java ecosystems.

👉 Watch the full video to dive deeper into the implementation.


r/SpringAIDev • • May 18 '26

Discussion What have you built with Spring AI?

3 Upvotes

Hello community,

I'm very interested to learn how have you been using Spring AI.

What have you built with Spring AI? Was it a simple chat application, an assistant, an agent?

Was it a side project or did you deploy it in production?

Share your experience with us in the comment sections. Post the Github link if it is a public project!

Thank you!


r/SpringAIDev • • Jun 08 '26

Building an observable MCP proxy with HITL and policy enforcement

5 Upvotes

We’ve been experimenting with a different direction for AI agents:

trusted execution.

Instead of only focusing on connecting more tools, we’re building a policy-aware MCP proxy layer that can:

  • inspect tool calls

  • validate execution

  • apply policies

  • support HITL approval

  • trace agent workflows

  • block unsafe actions before execution

The goal is to create a safer execution boundary for MCP-based agents.

Built with Spring AI.
Local-first and self-hosted.

Docs:
https://spring-ai-community.github.io/spring-ai-playground/


r/SpringAIDev • • Sep 18 '26

Video Spring AI : Don't expose your keys while connecting with AzureOpenAI !

Thumbnail youtube.com
2 Upvotes

TechyTacos demonstrates a secure method to integrate Azure OpenAI with Spring AI by using Microsoft Entra ID instead of static API keys. This approach enhances security by utilizing short-lived, automatically refreshing tokens for authentication.

Highlights & Key Takeaways

  • Replace static API keys with dynamic tokens via Microsoft Entra ID to reduce exposure risks.

  • Deploy Azure OpenAI models through the Azure portal and manage them via the OpenAI Studio.

  • Register an application in Microsoft Entra ID to obtain necessary Client and Tenant IDs.

  • Assign the OpenAI Contributor role to the registered app to authorize access to the service.

  • Add the 'azure-identity' dependency to the project to manage credentials.

  • Implement a 'TokenCredential' bean using 'ClientSecretCredentialBuilder' in the configuration.

  • Verify the integration by validating successful responses through the Spring AI framework.

This workflow ensures robust security practices for AI development.

👉 Watch the full video to see the implementation.