Why JVM-native agents matter#
Most enterprise systems of record — banking cores, insurance platforms, ERP integrations — run on the JVM or .NET. Building agents in the same stack reuses existing security (Spring Security, OAuth), transactions, data access, messaging, observability and deployment pipelines, and keeps agents close to the services they call. Since 2025 the JVM has gained a real choice of agent frameworks.
flowchart TB
subgraph Planning["Agent frameworks"]
EMB["Embabel<br/>goal-oriented planning"]
LCA["LangChain4j agentic<br/>sequence, parallel, supervisor"]
KOOG["Koog<br/>Kotlin strategy graphs"]
ADKJ["ADK for Java"]
end
subgraph Primitives["LLM primitives"]
SAI["Spring AI<br/>ChatClient, advisors, tools, MCP"]
LC4J["LangChain4j<br/>AI Services, tools, RAG"]
end
EMB --> SAI
LCA --> LC4J
KOOG --> P1["Own model clients"]
ADKJ --> P2["Own model clients"]
SAI --> GW["AI gateway → models"]
LC4J --> GW
Spring AI: patterns on a solid core#
Spring AI provides the primitives — ChatClient, advisors, @Tool, MCP client/server, chat memory, structured output, observability (see Spring AI fundamentals). Agentic behaviour is built from those primitives using the workflow patterns: the tool-calling loop (optionally inside ToolCallingAdvisor), routing, chaining, orchestrator–workers and evaluator–optimizer.
Orchestrator–workers in plain Spring AI:
record SubTask(String type, String description) {}
record Plan(List<SubTask> tasks) {}
@Service
class ImpactAnalysis {
private final ChatClient planner; // stronger model
private final ChatClient worker; // cheaper model
ImpactAnalysis(@Qualifier("smartClient") ChatClient planner,
@Qualifier("fastClient") ChatClient worker) {
this.planner = planner;
this.worker = worker;
}
String analyse(String regulationText) {
Plan plan = planner.prompt()
.system("Split the impact analysis into 2-5 independent sub-tasks.")
.user(regulationText)
.call()
.entity(Plan.class);
List<String> results = plan.tasks().parallelStream() // workers in parallel
.map(t -> worker.prompt()
.system("You are a " + t.type() + " analyst. Be concise.")
.user(t.description() + "\n\n" + regulationText)
.call().content())
.toList();
return planner.prompt()
.system("Combine the findings into one impact report with actions.")
.user(String.join("\n---\n", results))
.call().content();
}
}
- Good at: Spring Boot estates; full control in plain Java; MCP server and client starters; memory repositories; Micrometer observability.
- Watch out: orchestration is yours to design — which is a feature for regulated systems, but more code than an opinionated framework.
Embabel: goal-oriented action planning#
Core idea. Created by Rod Johnson (founder of Spring) and built on Spring AI. You declare actions (typed methods) and goals; a deterministic GOAP planner (Goal-Oriented Action Planning, from game AI) works out which sequence of actions reaches the goal from the current state — based on the types each action consumes and produces and on declared conditions. LLMs do the work inside actions; the plan itself is not left to the LLM.
flowchart LR
IN["UserInput"] -->|"@Action extractApplicant"| A["Applicant"]
A -->|"@Action fetchCreditFile"| C["CreditFile"]
A -->|"@Action fetchAccounts"| B["BankAccounts"]
C --> D{"@Action assessRisk<br/>needs both"}
B --> D
D --> R["RiskAssessment"]
R -->|"@AchievesGoal writeDecision"| G["CreditDecision<br/>GOAL"]
@Agent(description = "Assess a small-business credit application")
public class CreditAgent {
@Action
public Applicant extractApplicant(UserInput input, OperationContext ctx) {
return ctx.ai().withDefaultLlm()
.createObject("Extract the applicant from: " + input.getContent(), Applicant.class);
}
@Action
public CreditFile fetchCreditFile(Applicant applicant) { // plain Java, no LLM
return creditBureau.lookup(applicant.registrationNumber());
}
@Action
public BankAccounts fetchAccounts(Applicant applicant) {
return openBanking.accounts(applicant.id());
}
@Action
public RiskAssessment assessRisk(CreditFile file, BankAccounts accounts, OperationContext ctx) {
return ctx.ai().withDefaultLlm()
.createObject("Assess credit risk using: " + file + accounts, RiskAssessment.class);
}
@AchievesGoal(description = "A credit decision with reasons")
@Action
public CreditDecision writeDecision(Applicant a, RiskAssessment risk) {
return policy.decide(a, risk); // deterministic rules
}
}
- Good at: explainable, re-plannable flows; mixing LLM steps with deterministic Java; strong typing; Spring integration; replanning after each action when conditions change.
- Watch out: a newer project with a smaller community; think in types and preconditions rather than prompts.
LangChain4j: AI Services and the agentic module#
Core idea. Framework-agnostic Java (works with Quarkus, Micronaut, Spring, plain Java). AI Services turn an annotated interface into an LLM-backed implementation with tools, memory and RAG. The agentic module adds workflow patterns (sequence, parallel, loop, conditional) and a supervisor agent, plus MCP and A2A integration.
interface CreditAnalyst {
@SystemMessage("You are a credit analyst. Be factual and concise.")
@UserMessage("Assess this application: {{application}}")
@Agent("Assesses SME credit applications")
String assess(@V("application") String application);
}
interface MemoWriter {
@UserMessage("Write a one-page credit memo from this assessment: {{assessment}}")
@Agent("Writes credit memos")
String write(@V("assessment") String assessment);
}
CreditAnalyst analyst = AgenticServices.agentBuilder(CreditAnalyst.class)
.chatModel(model).outputKey("assessment").build();
MemoWriter writer = AgenticServices.agentBuilder(MemoWriter.class)
.chatModel(model).outputKey("memo").build();
UntypedAgent pipeline = AgenticServices.sequenceBuilder()
.subAgents(analyst, writer)
.outputKey("memo")
.build();
Object memo = pipeline.invoke(Map.of("application", applicationText));
- Good at: non-Spring Java, Quarkus (via Quarkus LangChain4j), declarative AI Services, broad model and store support.
- Watch out: agentic APIs are younger than the core; pin versions.
Koog (JetBrains)#
Core idea. A Kotlin-first framework with a type-safe DSL for agents and strategy graphs, tool registries, history compression, persistence for fault-tolerant, resumable agents, and Kotlin Multiplatform targets (JVM, Android, iOS, web).
- Good at: Kotlin teams; long-running agents that must resume after failures; on-device and multiplatform agents.
- Watch out: Kotlin-centric; smaller enterprise integration ecosystem than Spring.
Google ADK for Java#
The Java edition of Google ADK: LLM agents, workflow agents, tools and A2A, deployable to Google Cloud. A good fit for Java teams on Google Cloud.
Microsoft Agent Framework for .NET#
For .NET estates, Microsoft Agent Framework (1.0, April 2026) is the default: agents, graph workflows with checkpointing and human-in-the-loop, MCP and A2A, OpenTelemetry, Azure AI Foundry integration. It replaces Semantic Kernel’s agent features and AutoGen.
Comparison#
| Spring AI | Embabel | LangChain4j agentic | Koog | ADK Java | |
|---|---|---|---|---|---|
| Style | Primitives + patterns | Goals, actions, GOAP planner | Annotated AI Services + workflow builders | Kotlin DSL, strategy graphs | LLM + workflow agents |
| Planning | You code it | Deterministic planner | Workflow builders / supervisor LLM | Strategy graph | Workflow agents / LLM |
| Spring integration | Native | Native (on Spring AI) | Spring Boot starters | Possible | Possible |
| MCP | Client + server starters | Via Spring AI | Yes | Yes | Yes |
| A2A | Community/integrations | Yes | Yes | Yes | Native |
| Best for | Spring shops, full control | Explainable goal-driven flows | Non-Spring Java, Quarkus | Kotlin, resumable agents | Java on Google Cloud |
Guidance for a Spring-based enterprise#
- Standardise on Spring AI for model access, RAG, tools, MCP and memory.
- Implement most use cases as explicit workflows with Spring AI patterns — easiest to test and audit.
- Use Embabel where goal-driven planning over many typed actions helps (onboarding, credit, claims, case handling).
- Expose domain capabilities as MCP servers (Spring AI MCP server starter) so any agent, in any framework, can use them.
- Use A2A to integrate agents built by other teams or vendors in Python or .NET.
Review questions#
Why build agents on the JVM? To reuse the enterprise stack — security, transactions, data access, messaging, observability, deployment — and keep agents close to systems of record.
How does Embabel differ from LLM-driven agents? A deterministic GOAP planner chains typed actions toward a declared goal, using preconditions and the types each action produces; LLMs work inside actions but do not decide the plan, which makes flows explainable and re-plannable.
When would you choose LangChain4j over Spring AI? When the application is not Spring-based (Quarkus, Micronaut, plain Java) or the team prefers declarative AI Services and its agentic workflow builders.
What is the recommended .NET agent framework in 2026? Microsoft Agent Framework, the successor to Semantic Kernel and AutoGen.
Summary#
- Spring AI provides robust primitives; build agentic patterns explicitly on top.
- Embabel adds goal-oriented, explainable planning on Spring AI.
- LangChain4j (AI Services + agentic module) serves non-Spring Java; Koog serves Kotlin; ADK Java serves Google Cloud.
- Microsoft Agent Framework is the .NET choice.
References#
- Spring AI reference and Spring blog, Building Effective Agents with Spring AI.
- Embabel Agent and Embabel documentation.
- LangChain4j — AI Services and agents.
- Koog.
- Google ADK for Java.
- Microsoft Agent Framework.