A Java library for building stateful, multi-agent workflows with LLMs, inspired by Python LangGraph, supporting cyclic graphs, checkpoint persistence, human-in-the-loop, and subgraph composition.
LangGraph4j is a stateful multi-agent workflow orchestration framework for the Java ecosystem, originally inspired by Python's LangGraph. The framework uses cyclic directed graphs (not limited to DAGs) as its execution model. Graphs are defined via StateGraph with nodes and edges, while shared state across nodes is managed through the AgentState + Channel Reducer pattern, supporting multiple state merge strategies including override, append, and message dedup-append.
For control flow, it provides three edge types — unconditional edges, conditional routing edges, and conditional entry points — along with subgraph composition (embeddable as StateGraph, CompiledGraph, or NodeAction) and parallel branch execution. The execution layer supports both synchronous (NodeAction) and asynchronous (AsyncNodeAction + CompletableFuture) nodes, with AsyncGenerator enabling real-time streaming of LLM responses.
The built-in Checkpoint mechanism can save and restore graph state at any superstep, with five persistence backends: Memory, MySQL, PostgreSQL, Oracle, and Redis. It supports Time-Travel Debugging (browsing and replaying historical checkpoints) and Human-in-the-Loop (pausing workflows at designated interrupt points for human approval). Observability is addressed through OpenTelemetry integration with a Hook extension mechanism. Graph structures can be visualized in PlantUML and Mermaid formats, and a Studio Web UI (with Jetty/Quarkus/Spring Boot server implementations) is included for visual inspection, execution, and debugging.
LLM integration is achieved through dedicated modules: Langchain4j integration (langchain4j-core + langchain4j-agent) and Spring AI integration (spring-ai-core + spring-ai-agent), each providing an Agent Executor. The core module requires Java 17+, with the current stable release at 1.8.15, distributed via Maven Central (groupId: org.bsc.langgraph4j).
Multi-module project structure:
langgraph4j/
├── langgraph4j-bom/ # BOM dependency management
├── langgraph4j-core/ # Core execution engine
├── langgraph4j-opentelemetry/ # Observability
├── langgraph4j-mysql-saver/ # MySQL Checkpoint
├── langgraph4j-oracle-saver/ # Oracle Checkpoint
├── langgraph4j-postgres-saver/ # PostgreSQL Checkpoint
├── langgraph4j-redis-saver/ # Redis Checkpoint
├── langchain4j/ # LangChain4j integration
├── spring-ai/ # Spring AI integration
├── studio/ # Studio Web UI
├── how-tos/ # Interactive tutorials (Java 22 required)
├── samples/ # Sample code
├── javelit/ # Javelit UI integration
└── generator/ # Code generator
Unconfirmed information: The documentation site URL was not fully captured; Langchain4j compatibility range is set to 1.13.0 in pom.xml but actual bounds need confirmation; Spring AI integration version is 2.0.0-M4 (Milestone pre-release), production readiness unconfirmed; README shows release date "May 7, 2026" which appears inconsistent with the current timeline.