Skip to main content

LangChain4J CDI

LangChain4J CDI injects AI services directly into your Jakarta EE and MicroProfile applications.

Documentation

Full documentation is available at langchain4j.github.io/langchain4j-cdi.

Features

  • AI Service Injection — declare AI services as CDI beans using @RegisterAIService
  • Agentic Topologies — 11 per-topology annotations (@RegisterSimpleAgent, @RegisterSequenceAgent, @RegisterLoopAgent, etc.) for multi-agent workflows
  • MCP Server — expose CDI beans as a Model Context Protocol server
  • Configuration via Properties — configure LLM components through MicroProfile Config or a custom SPI
  • Fault Tolerance — resilience with @Retry, @Timeout, @CircuitBreaker, @Fallback
  • Telemetry — OpenTelemetry-based observability for AI operations
  • Expression Language — resolve ${...} (MicroProfile Config) and #{...} (Jakarta EL) expressions in annotations
  • Guardrails — input and output validation for AI service interactions

Supported Runtimes

RuntimeExtension Type
QuarkusBuild-compatible
HelidonBoth
WildFlyPortable
PayaraPortable
GlassFishPortable
LibertyPortable

For detailed explanation and usage of LangChain4j CDI features, see the LangChain4J CDI docuemntation.