LangChain4j is an Apache-2.0, open-source, idiomatic Java library for building LLM-powered applications on the JVM, aimed at Java developers and enterprise teams who want one unified API over many LLM providers and embedding stores without leaving the Java ecosystem.
What it is
LangChain4j is a Java library, started in early 2023, that simplifies integrating LLMs into Java applications. LLM providers such as OpenAI and Google Vertex AI, and embedding (vector) stores such as Pinecone and Milvus, each expose a proprietary API. LangChain4j offers a unified API across 20+ popular LLM providers and 30+ embedding stores, so swapping an LLM or an embedding store does not require rewriting application code. Despite the name, it is not a Java port of LangChain (Python); it is built for Java from the ground up around Java conventions — type safety, POJOs, annotations, interfaces, dependency injection and fluent APIs — with an API, internals and release cycle independent of the Python project.
The concrete problem it solves is per-provider integration work. Without it, a Java team must learn and implement each provider's and each embedding store's own API, then absorb the cost of rewriting when the provider or store changes. LangChain4j replaces that work with one API surface plus a toolbox that captures patterns the community identified since 2023: low-level prompt templating, chat memory management and function calling, up to high-level Agents and RAG. For each abstraction it ships an interface with multiple ready-to-use implementations, so a chatbot or a full RAG pipeline from data ingestion to retrieval can be assembled from existing pieces.
Key capabilities
- Unified API over 20+ LLM providers, allowing a switch between models without rewriting code.
- Integrations for 30+ embedding (vector) stores.
- Tool calling, including MCP support.
- High-level patterns: Agents and RAG, including a complete data-ingestion-to-retrieval pipeline.
- Low-level building blocks: prompt templating, chat memory management and function calling.
- First-class integration with enterprise Java frameworks: Quarkus, Spring Boot, Helidon and Micronaut.
- A companion
langchain4j-examples repository with runnable examples for LLM-powered applications.
Who uses it and how
- Java teams adding chat or RAG features to services already running on Quarkus or Spring Boot, using the framework integrations and dependency injection rather than a separate runtime.
- Teams that must change LLM providers, for example moving between OpenAI, Google Vertex AI and other supported providers, without rewriting their integration code.
- Teams building chatbots that rely on chat memory management and function calling.
- Teams building RAG applications that need one pipeline from data ingestion through retrieval across a chosen embedding store.
- Teams that need tool calling with MCP support inside an existing JVM service.
Getting started
The library is published on Maven Central as dev.langchain4j:langchain4j, and the getting started guide lives at docs.langchain4j.dev/get-started. Full documentation is at docs.langchain4j.dev, with an experimental documentation chatbot at chat.langchain4j.dev.
How it compares
The facts name LangChain (Python) and the Python and JavaScript LLM libraries as the prior art LangChain4j was created to answer, so it sits in that space as the JVM-native option rather than a port of any of them. Its API, internals and release cycle are independent of the Python LangChain project, and its design targets Java conventions and Java framework integration instead of mirroring another language's idioms.
When to use it — and when not to
Choose LangChain4j when the application is Java or JVM-based and needs one API across many providers and embedding stores. Do not choose it for non-JVM stacks, and do not expect Python LangChain parity in API or semantics, since the project states the two are independent. Note that the README excerpt points offsite for getting started, active development means some features are still being worked on, and the repository carries 878 open issues — a real signal that issues can outpace resolution.
project readme (upstream, from github) — read inline
LangChain4j: idiomatic, open-source Java library for building LLM-powered applications on the JVM


Introduction
Welcome!
The goal of LangChain4j is to simplify integrating LLMs into Java applications.
Here's how:
- Unified APIs:
LLM providers (like OpenAI or Google Vertex AI) and embedding (vector) stores (such as Pinecone or Milvus)
use proprietary APIs. LangChain4j offers a unified API to avoid the need for learning and implementing specific APIs for each of them.
To experiment with different LLMs or embedding stores, you can easily switch between them without the need to rewrite your code.
LangChain4j currently supports 20+ popular LLM providers
and 30+ embedding stores.
- Comprehensive Toolbox:
Since early 2023, the community has been building numerous LLM-powered applications,
identifying common abstractions, patterns, and techniques. LangChain4j has refined these into practical code.
Our toolbox includes tools ranging from low-level prompt templating, chat memory management, and function calling
to high-level patterns like Agents and RAG.
For each abstraction, we provide an interface along with multiple ready-to-use implementations based on common techniques.
Whether you're building a chatbot or developing a RAG with a complete pipeline from data ingestion to retrieval,
LangChain4j offers a wide variety of options.
- Numerous Examples:
These examples showcase how to begin creating various LLM-powered applications,
providing inspiration and enabling you to start building quickly.
LangChain4j began development in early 2023 amid the ChatGPT hype.
We noticed a lack of Java counterparts to the numerous Python and JavaScript LLM libraries and frameworks,
and we had to fix that!
Despite the name, LangChain4j is not a Java port of LangChain (Python) — it is built for Java, not ported to it.
It is an idiomatic Java library designed from the ground up around Java conventions:
type safety, POJOs, annotations, interfaces, dependency injection, fluent APIs, and first-class integrations with Quarkus, Spring Boot, Helidon, and Micronaut.
Its API, internals, and release cycle are independent of the Python LangChain project.
We actively monitor community developments, aiming to quickly incorporate new techniques and integrations,
ensuring you stay up-to-date.
The library is under active development. While some features are still being worked on,
the core functionality is in place, allowing you to start building LLM-powered apps now!
Documentation
Documentation can be found here.
The documentation chatbot (experimental) can be found here.
Getting Started
Getting started guide can be found here.
Code Examples
Please see examples of how LangChain4j can be used in langchain4j-examples repo:
Useful Materials
Useful materials can be found here.
Get Help
Please use Discord or GitHub discussions
to get help.
Request Features
Please let us know what features you need by opening an issue.
Contribute
Contribution guidelines can be found here.