LangChain4j unifies LLM and embedding-store APIs on the JVM and ships patterns for tools, agents, RAG, and chat memory.
Overview
LangChain4j is a Java library for integrating large language models into JVM applications. It wraps many commercial and self-hosted model providers and vector databases behind one API so components can be swapped without rewriting application code.
The library collects common building blocks identified in LLM application work: prompt templating, chat memory, structured output parsing, function and tool calling with MCP support, agents, and retrieval-augmented generation pipelines from ingestion through query.
It is designed for Java conventions such as type safety, interfaces, dependency injection, and integrations with Quarkus, Spring Boot, Helidon, and Micronaut. It is not a port of the Python LangChain project but an independent Java-first design.
Documentation, a separate examples project, and a documentation chatbot experiment support learning. Core functionality is usable now while additional features continue to land.
Key features
- Unified LLM provider API
- Thirty-plus embedding store integrations
- Tool calling and MCP support
- Agents and RAG pipelines
- Chat memory abstractions
- Prompt templating and output parsing
- Quarkus and Spring Boot integration
- Ready-made pattern implementations
Use cases
- Java chatbots and assistants
- Enterprise RAG over internal data
- Switch LLM vendors with one codebase
- Expose Java methods as model tools