Six months ago the answer to "Spring AI or LangChain4j?" was almost automatic. Spring shop? Take Spring AI. Quarkus, Micronaut, or plain Java? Take LangChain4j. The two frameworks did the same job through different accents, and the choice was about which ecosystem you already lived in.
That answer is now out of date, and it went stale for two unrelated reasons in the same quarter. Spring AI shipped 2.0 GA on June 12 with a hard requirement on Spring Boot 4 and Spring Framework 7, which quietly turned a dependency choice into a platform migration question. And LangChain4j stopped being "the portable ChatClient" and grew a full agentic workflow engine, with typed agents, supervisor orchestration, and crash-resilient human-in-the-loop suspension. The frameworks are no longer two dialects of the same idea. They have genuinely diverged.
I run Spring AI services in production on Spring Boot, I build agent infrastructure on the side, and I just went through this decision process again for a new service. Here is the comparison I wish someone had handed me, with the 2026 changes front and center.
One disclosure first: my production experience is Spring AI. I have built with LangChain4j, including its new agentic module, but nothing I ship to paying users runs on it. Where I am comparing from documentation rather than scars, I will say so.
What actually changed in 2026
Spring AI 2.0 became a platform, with platform pricing. The 2.0.0 GA announcement is explicit: it is designed for Spring Boot 4.0 and 4.1 and Spring Framework 7, brings Jackson 3, and requires Java 17 at minimum. That is not a version bump, that is a baseline. If your estate is still on Boot 3.x, and in my experience most production estates in 2026 still are, you cannot adopt Spring AI 2.x without the Boot 4 migration first. The 1.x line works, but its clock is ticking.
LangChain4j grew an agentic module with real workflow semantics. The langchain4j-agentic module lets you declare typed agents as interfaces, then compose them into sequential, looping, conditional, and parallel workflows, or hand control to a supervisor agent that decides what to call next. This is orchestration machinery that Spring AI does not have an equivalent for at the same level of abstraction. Recent releases have added a Belief-Desire-Intention agent pattern, tool action compensation at the agentic system level, and crash-resilient human-in-the-loop suspension and resume, so a workflow waiting on human approval can survive a restart.
The tool-calling loop got rebuilt on both sides. Spring AI 1.x buried the tool-calling loop inside each chat model implementation, which made it impossible to intercept or customize. Spring AI 2.0 moved that loop into the advisor chain as a composable ToolCallingAdvisor with four extension points, added ToolSearchToolCallingAdvisor for progressive tool disclosure when you have too many tools to stuff into one prompt, and introduced AugmentedToolCallbackProvider, which wraps tools and can carry an innerThought field the model populates before each call, effectively structured chain-of-thought you can log and audit. LangChain4j's answer is the agentic module's AgenticScope, the shared context object that gives you control over what each agent in a workflow sees.
Both are real, production-shaped answers to the same problem: agents that call tools need to be observable and interruptible, not just callable.
The same feature, side by side
Here is a single tool call, the hello world of agent backends, in both frameworks.
Spring AI 2.0 style, a tool as a Spring bean passed to the ChatClient:
@Component
public class OrderTools {
@Tool("Look up order status by order ID")
public OrderStatus getOrderStatus(String orderId) {
return orderRepository.findStatus(orderId);
}
}
var answer = chatClient.prompt()
.system("You are a support assistant.")
.user(question)
.tools(orderTools)
.call()
.content();
LangChain4j style, the declarative AiServices pattern:
class OrderTools {
@Tool("Look up order status by order ID")
public OrderStatus getOrderStatus(String orderId) {
return orderRepository.findStatus(orderId);
}
}
interface SupportAssistant {
@SystemMessage("You are a support assistant.")
String chat(@UserMessage String question);
}
var assistant = AiServices.builder(SupportAssistant.class)
.chatLanguageModel(model)
.tools(new OrderTools())
.build();
String answer = assistant.chat(question);
Notice what is different. Spring AI's tool is a bean, discovered and wired by the container you already run. LangChain4j's assistant is a typed interface, and the framework generates the implementation. The Spring version integrates with your existing instincts. The LangChain4j version is framework-agnostic by construction: that interface and builder work identically in Quarkus, Micronaut, a CLI, or a plain main method.
For a single tool call, it is a coin flip. The differences that matter show up one level up.
Where they genuinely diverge: orchestration
Spring AI composes through the advisor chain. The 2.0 design routes everything through advisors: memory, RAG, tool calling, tool search. You get blocking and streaming on the same path, and the four loop extension points let you insert approval gates between tool iterations. If your mental model is "a request pipeline with interceptors," this is exactly that, and it is the reason Spring AI feels like coming home if you have written a Spring filter or interceptor in the last decade. For a single agent with tools, memory, and guardrails, this is a clean, complete answer.
LangChain4j composes through workflows. The agentic module's unit of composition is not a request, it is a multi-agent workflow. You can run agents in parallel and fan in the results, loop a writer-critic pair until a quality score clears a threshold, branch conditionally, or wrap the whole workflow as a compound agent that another workflow uses as a single step. The supervisor pattern hands routing to an LLM. The execution reports show every agent invocation with timings, token counts, inputs, and outputs, which is the observability story I currently hand-roll in my own setup.
The honest summary: if you are building one agent that does a job, Spring AI's pipeline is tidier and better integrated. If you are building a system of agents where steps fan out, loop, and wait on humans, LangChain4j has machinery Spring AI currently makes you build yourself.
The version-coupling problem nobody prices in
Here is the part that changed my own planning, and it is not on either framework's feature list.
Spring AI 2.0.1, the first patch release on the 2.0 line, shipped on August 21 with fixes for seven CVEs disclosed August 20. Three are serious bug classes: unadvertised tool dispatch via prompt injection, arbitrary file write via path traversal in a cache service, and a remote denial-of-service through poisoned PDFs. The 2.0.x fixes are open source. But the fixes for the 1.1.x and 1.0.x lines, 1.1.9 and 1.0.10, are listed as Enterprise Support only.
Read that again as an architecture decision. If you are on Boot 3.x with Spring AI 1.x, and a prompt-injection CVE lands in your stack, your options are: migrate to Boot 4 to reach the open-source fix, pay for enterprise support to get the backport, or accept the exposure while you plan. That is the real cost of the 2.0 baseline, and I say that as someone who otherwise likes the 2.0 design. Framework coupling was always a soft argument against Spring AI. In 2026 it became a line item.
LangChain4j has its own version reality: the release cadence is fast, occasionally with breaking changes, and the agentic module is newer than its documentation in places. You trade platform lock-in for upgrade churn. Neither is free, they are just expensive in different currencies.
Ecosystem signals worth knowing
Provider and store coverage is a wash. LangChain4j supports 20-plus model providers and roughly 30 vector stores; Spring AI covers every provider I have needed and adds first-party integrations maintained by vendors themselves, including Oracle and Microsoft modules.
LangChain4j has an enterprise Java patron. Microsoft published a partnership post with the LangChain4j team specifically about secure, enterprise-grade Java AI applications. A framework-agnostic Java AI library being backed by Microsoft is a meaningful credibility signal for non-Spring shops.
Spring AI has the Spring machine behind it. Auto-configuration, Micrometer observability, the Boot actuator, and a documentation set that assumes you deploy the way Spring teams deploy. None of that is glamorous, and all of it reduces the number of things you build yourself.
The decision framework I actually use
If I were standing at this fork today, starting a new Java AI service, here is the checklist I would run, in order.
- Are you on Spring Boot 4 already, or genuinely close? If yes, Spring AI 2.x is the default. The integration depth is real and the 2.0 advisor design is good. If no, do not adopt Spring AI 2.x for a feature you need next month. The Boot 4 migration becomes your critical path, including for security patches.
- Is the thing you are building a pipeline or a workflow? One agent with tools, memory, and guardrails: Spring AI. Multiple agents that run in parallel, loop to a quality bar, or pause for human approval and resume after a restart: LangChain4j's agentic module saves you building an orchestration layer.
- Is your runtime actually Spring? Quarkus, Micronaut, Jakarta EE, or a non-container Java service: LangChain4j, without much debate. The GitHub Copilot SDK for Java is a third, leaner option I wrote about separately, worth knowing about but not a framework replacement.
- How fast is your model surface moving? LangChain4j's fast cadence means new provider features land quickly, at the cost of occasional breaking changes. Spring AI moves at platform speed: slower, steadier, more predictable.
- Who debugs it at 2 AM? If the on-call engineers are Spring veterans, the Spring AI stack has fewer new concepts to learn. That is worth more than any feature comparison.
My own split, for what it is worth: my production services stay on Spring AI because they live inside a Spring estate that is moving to Boot 4 on its own schedule. The next multi-agent experiment I am building starts on LangChain4j's agentic module, precisely because the workflow semantics match the shape of the problem. The frameworks have diverged enough that using both is no longer an inconsistency. It is just matching tools to jobs.
Have you picked one for a real project in 2026, or are you also running both side by side? I would genuinely like to hear how the Boot 4 requirement is sitting with teams on Boot 3 estates.
I write about Java, Spring Boot, and AI every week. Subscribe, it is free, and it is how you catch the follow-up where I document how the multi-agent build actually goes.
References
- Spring AI 2.0.0 GA announcement: https://spring.io/blog/2026/06/12/spring-ai-2-0-0-GA-available-now
- LangChain4j agents and agentic AI tutorial: https://docs.langchain4j.dev/tutorials/agents
- LangChain4j release notes, BDI pattern and human-in-the-loop: https://github.com/langchain4j/langchain4j/releases
- Microsoft and LangChain4j partnership post: https://devblogs.microsoft.com/java/microsoft-and-langchain4j-a-partnership-for-secure-enterprise-grade-java-ai-applications/
- My write-up of the seven Spring AI 2.0.1 CVEs and the enterprise-only 1.x fixes: https://dev.to/jamilxt/spring-ai-201-fixed-7-cves-one-of-them-lets-a-prompt-call-tools-you-never-advertised-2d4k
Top comments (0)