SoPhi, Koog, LangChain4j and Spring AI compared
The short answer
- Spring AI if you're on Spring Boot and want clean access to models, tools, memory and MCP, with your own code deciding what the agent does.
- LangChain4j if you want ready-made patterns in Java: AI services, RAG, and agentic workflows (sequential, parallel, loops, a supervisor) wired for you.
- Koog if you want a stable Kotlin framework with graph workflows, or need agents on Android, iOS or the web as well as the JVM.
- SoPhi if you want one agent loop that already comes with the parts a long-running agent needs: crash-safe sessions, long-term memory, learning from use, goal planning, skills and subagents. You can use it as a library, a terminal app or a server.
They are not all the same kind of thing. Spring AI is a layer for talking to models; the other three run agents. SoPhi itself uses Spring AI to reach its models.
Side by side
| SoPhi | Koog | LangChain4j | Spring AI | |
|---|---|---|---|---|
| What it is | An agent harness: one loop plus sessions, memory, learning and planning | An agent framework from JetBrains | An LLM library with AI services, RAG and agentic workflows | Spring's layer for models, tools, memory and MCP |
| Language | Kotlin, JDK 21+ | Kotlin, with a Java API; JDK 17+ | Java, with Kotlin support | Java, Spring Boot 4 |
| Status | Pre-release; build from source (not on Maven Central yet) | Stable 1.x since May 2026 | 1.x, released every few weeks; the agentic module is marked experimental | 2.0 GA, June 2026 |
| Licence | Apache 2.0 | Apache 2.0 | Apache 2.0 | Apache 2.0 |
| How an agent runs | A single tool-calling loop, configured with a builder DSL | Graph workflows, with functional and planning strategies | AI services; agentic workflows: sequential, loop, parallel, conditional, supervisor | ChatClient, with the tool-calling loop inside the advisor chain |
| Planning | Breaks a goal into a plan, works through it and replans; the CLI's /goal --check runs until a check passes | Planning strategy (GOAP) | Supervisor and custom planners; goal-oriented pattern | Build it yourself on advisors |
| Sessions | Append-only JSONL session tree that survives a crash; branch and check out | Persistence restores agent state at checkpoints | Chat memory; agentic workflows can resume after a suspension or crash | Chat memory repositories |
| Long-term memory | A memory palace on embedded ArcadeDB (experimental) | Embeddings and RAG across conversations | Chat memory and RAG | Chat memory, vector stores and RAG; auto-memory tools in a community project |
| Learning from use | Tool reliability stats, lessons distilled at session end, user feedback, dataset export | Not described as a built-in feature in their documentation | ||
| Skills | Markdown skills loaded on demand; the agent can write new ones, behind safety checks | Not described | Not described | Agent Skills in a community project |
| MCP | Client (stdio and HTTP) and server | MCP tools in agents | MCP client agents; A2A | Client and server, with annotations |
| Several agents | Subagents defined in plain Markdown files, called like a tool | Graph workflows; Agent Client Protocol | Agentic workflows and A2A | Patterns you compose |
| Models | Claude, and any OpenAI-compatible server (Ollama, LM Studio, llama.cpp); local by default | OpenAI, Anthropic, Google, DeepSeek, OpenRouter, Ollama, Bedrock | Most major providers and local servers | OpenAI, Anthropic, Bedrock, Google, Mistral, DeepSeek, Ollama and more |
| Runs on | JVM | JVM, Android, iOS, JavaScript, Wasm | JVM | JVM |
| Ways to use it | Library (Sophi.runtime { }), terminal app, REST and SSE server | Library; Spring Boot and Ktor integrations | Library; Spring Boot and Quarkus integrations | Spring Boot starters |
Spring AI
Spring AI doesn't try to be an agent framework. It gives Spring Boot apps one way to call models, run the tool-calling loop, keep chat memory, and serve or call MCP tools. In 2.0 the tool loop moved into the advisor chain, so you can wrap and change it like any other advisor. Choose it when you want to write the agent's behaviour yourself, on Spring.
SoPhi uses Spring AI for exactly this. Its provider module wraps Spring AI, and the agent loop never imports it.
LangChain4j
LangChain4j brings ready-made building blocks to Java: AI services declared as interfaces, chat memory, RAG, and a large set of integrations. Its agentic module adds workflows (sequential, loop, parallel, conditional) and a supervisor that plans which agent to call next, plus MCP and A2A client agents. Choose it when you want those patterns decided for you, in Java. The agentic module is still marked experimental.
Koog
Koog is JetBrains' agent framework, written in Kotlin with a Java API, stable since 1.0 in May 2026. Agents are graph workflows, with functional and planning strategies as alternatives. It has persistence, history compression, OpenTelemetry tracing, and it runs beyond the JVM: Android, iOS, JavaScript and Wasm. Choose it for multi-step workflows you want to see as a graph, or for agents that must run on devices.
SoPhi
SoPhi keeps the agent to one loop, and builds in what that loop needs to run for weeks rather than minutes:
- Sessions that survive a crash. Every turn is appended to a JSONL file; a session can branch and be checked out like a git history.
- Memory and learning. Long-term memory, plus lessons distilled at the end of each session and tool reliability tracked over time.
- Goals and plans. A goal is broken into steps, worked through and replanned; a check command can decide when it's done.
- Skills and subagents in plain files. Markdown, loaded only when needed.
- Local first. It finds a local model server on its own and never picks a cloud model for you.
The trade-offs are real: SoPhi is younger and smaller than the other three, runs only on the JVM, is Kotlin-first, and isn't on Maven Central yet. Choose it when you want those built-in parts more than a large ecosystem.
Why we wrote our own loop instead of using Koog or LangChain4j is in Why we built a Kotlin agent harness instead of using one.
Questions
Can I use Spring AI and SoPhi together?
Yes, SoPhi already does: Spring AI is how SoPhi reaches Claude and OpenAI-compatible servers. You can also embed SoPhi in a Spring Boot app; its web server is one.
Which one runs fully on a local model?
All four can use Ollama. SoPhi starts on a local model by default (Ollama, LM Studio or llama.cpp) and only uses Claude when you choose it.
Which one should a Java team pick?
Spring AI or LangChain4j are the natural fit; Koog has a Java API too. SoPhi is written for Kotlin.
Sources
- Koog: GitHub README, Koog 1.0 announcement, Koog comes to Java
- LangChain4j: Agents and agentic AI, releases
- Spring AI: Spring AI 2.0.0 GA, Tool calling in Spring AI 2.0
- SoPhi: GitHub
Something out of date or wrong? Email hello@sophiloop.com and we'll fix it.