LangChain4j CDI
AI Services for Jakarta EE and MicroProfile
A CDI extension that integrates LangChain4j with enterprise Java. Inject AI services, agents, and MCP servers into your CDI-managed beans with fault tolerance, telemetry, and external configuration.
AI Services
Declare AI service interfaces with @RegisterAIService and let CDI handle proxy creation, dependency injection, and lifecycle management.
Agent Orchestration
11 agent topologies — sequence, loop, parallel, conditional, supervisor, planner, A2A, MCP, and more — all wired via CDI annotations.
MCP Server
Turn CDI beans into Model Context Protocol servers exposing tools, prompts, and resources over JSON-RPC 2.0 / Streamable HTTP.
Enterprise Features
MicroProfile integration for external configuration, fault tolerance (retry, circuit breaker, fallback), and OpenTelemetry observability.
Quick Install
Add the LangChain4j CDI extension to your Maven project. Choose the extension that matches your runtime:
For Quarkus / Helidon (build-time)
<dependency>
<groupId>dev.langchain4j.cdi</groupId>
<artifactId>langchain4j-cdi-build-compatible-ext</artifactId>
<version>${langchain4j-cdi.version}</version>
</dependency>
For WildFly / GlassFish / Liberty (portable)
<dependency>
<groupId>dev.langchain4j.cdi</groupId>
<artifactId>langchain4j-cdi-portable-ext</artifactId>
<version>${langchain4j-cdi.version}</version>
</dependency>
See the Getting Started guide for full setup instructions.
Compatibility
| CDI Extension Version | LangChain4j | Java | Jakarta EE | MicroProfile |
|---|---|---|---|---|
| 1.3.4 | 1.17.1 | 17+ | 10 | 6.1 |
| 1.2.0 | 1.14.1 | 17+ | 10 | 6.1 |
| 1.1.0 | 1.12.2 | 17+ | 10 | 6.1 |
| 1.0.0 | 1.9.1 | 17+ | 10 | 6.1 |
| dev (unreleased) | 1.18.0 | 17+ | 10 | 6.1 |