LangGraph4j

Active
GitHub Java MIT

Description

LangGraph for Java — a library for developing AI agentic architectures in the Java ecosystem, designed to work seamlessly with both LangChain4j and Spring AI, supporting stateful graph-based workflows and complex agent orchestration.

Key Features

  • Stateful graph-based workflow execution with cyclical graphs for agent retry and clarification loops
  • Seamless integration with LangChain4j and Spring AI for Java LLM ecosystem compatibility
  • Checkpoint persistence for saving and replaying graph state at any execution step
  • Conditional edges and entry points for dynamic routing based on AgentState
  • Visual debugging via PlantUML/Mermaid graph visualization and web-based Studio playground
  • Async and streaming support with CompletableFuture for non-blocking responsive applications

Use Cases

💡 Building stateful multi-agent workflows in Java with LangChain4j or Spring AI
💡 Creating complex agent orchestration with conditional branching and retry logic
💡 Developing long-running resumable workflows with checkpoint-based persistence
💡 Visual debugging and inspection of agent execution flows via Studio UI
💡 Prototyping agentic applications in the Java/Spring ecosystem with graph-based control flow

Quick Start

Add to your `pom.xml`:
```xml
<dependency>
  <groupId>org.bsc.langgraph4j</groupId>
  <artifactId>langgraph4j-core</artifactId>
  <version>1.8.17</version>
</dependency>
```
Requires Java 17+. See the [documentation](https://bsorrentino.github.io/langgraph4j/) for building your first StateGraph with nodes, edges, and conditional routing.

Related Projects