[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-95117":3},{"id":4,"name":5,"fullName":6,"owner":5,"repo":5,"description":7,"homepage":8,"htmlUrl":9,"language":10,"languages":8,"totalLinesOfCode":8,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":8,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":16,"compositeScore":17,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":8,"createdAt":8,"pushedAt":8,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":15,"starSnapshotCount":15,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},95117,"langgraph4j","langgraph4j\u002Flanggraph4j","🚀 LangGraph for Java. A library for develop AI Agentic Architectures in the Java ecosystem. Designed to work seamlessly with both Langchain4j and Spring AI.",null,"https:\u002F\u002Fgithub.com\u002Flanggraph4j\u002Flanggraph4j","Java",1936,273,29,26,0,1,52.91,false,"main","2026-08-24 04:01:23","\n# 🦜🕸️ Welcome to LangGraph4j ( \u003Ci>AI Agentic workflow in Java\u003C\u002Fi> )\n\n![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg) [![docs](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSite-Documentation-blue)][documentation] [![DeepWiki](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDeepWiki-docs-0b6?style=flat)](https:\u002F\u002Fdeepwiki.com\u002Flanggraph4j\u002Flanggraph4j) [![Static Badge](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmaven--snapshots-1.8--SNAPSHOT-blue)][snapshots] [![Maven Central](https:\u002F\u002Fimg.shields.io\u002Fmaven-central\u002Fv\u002Forg.bsc.langgraph4j\u002Flanggraph4j-core.svg)][releases][![discord](https:\u002F\u002Fimg.shields.io\u002Fdiscord\u002F1364514593765986365?logo=discord&style=flat)](https:\u002F\u002Fdiscord.gg\u002FszVVztSYKh)\n\nLangGraph for Java. A library for building stateful, multi-agents applications with LLMs, built for work with [langchain4j] and [Spring AI]\n> It is inspired by [LangGraph] solution, part of [LangChain AI project].\n\n## Releases\n\n| Date         | Release        | info\n|--------------|----------------| ---\n| Aug 08, 2026 | `1.8.24` | last release\n\n\n| Release line | Java baseline | Notes |\n|---|---|---|\n| `1.8.x` stable releases | Java 17+ | Recommended baseline for core, integrations, and saver modules |\n| `1.8-SNAPSHOT` development builds | Java 17+ | Snapshot users should expect active development and pre-release changes |\n| Notebook-oriented tooling in `how-tos\u002F` | Java 22 (tool-dependent) | The current notebook tooling choice referenced in `how-tos\u002FREADME.md` requires Java 22 |\n\n\u003C!--\n## Star History\n-->\n\u003C!--\n[![Star History Chart](https:\u002F\u002Fstarchart.cc\u002Flanggraph4j\u002Flanggraph4j.svg)](https:\u002F\u002Fstarchart.cc\u002Flanggraph4j\u002Flanggraph4j)\n-->\n\n\u003Ca href=\"https:\u002F\u002Fstar-history.dera.page\u002F#langgraph4j\u002Flanggraph4j&Date\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fstar-history.dera.page\u002Fsvg?repos=langgraph4j\u002Flanggraph4j&type=Date&theme=dark\" \u002F>\n    \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fstar-history.dera.page\u002Fsvg?repos=langgraph4j\u002Flanggraph4j&type=Date\" \u002F>\n    \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fstar-history.dera.page\u002Fsvg?repos=langgraph4j\u002Flanggraph4j&type=Date\" \u002F>\n  \u003C\u002Fpicture>\n\u003C\u002Fa>\n\n\n# Getting Started\n\nWelcome to LangGraph4j! This guide will help you understand the core concepts of LangGraph4j, install it, and build your first application.\n\n## Introduction\n\nLangGraph4j is a Java library for building stateful, multi-agent applications with Large Language Models (LLMs). It is inspired by the Python library [LangGraph](https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flanggraph) and is designed to work seamlessly with popular Java LLM frameworks like [Langchain4j](https:\u002F\u002Fgithub.com\u002Flangchain4j\u002Flangchain4j) and [Spring AI](https:\u002F\u002Fspring.io\u002Fprojects\u002Fspring-ai).\n\nAt its core, LangGraph4j allows you to define cyclical graphs where different components (agents, tools, or custom logic) can interact in a stateful manner. This is crucial for building complex applications that require memory, context, and the ability for different \"agents\" to collaborate or hand off tasks.\n\n## Core Features & Benefits\n\nLangGraph4j offers several features and benefits:\n\n*   **Stateful Execution:** Manage and update a shared state across graph nodes, enabling memory and context awareness.\n*   **Cyclical Graphs:** Unlike traditional DAGs, LangGraph4j supports cycles, essential for agent-based architectures where control flow can loop back (e.g., an agent retrying a task or asking for clarification).\n*   **Explicit Control Flow:** Clearly define the paths and conditions for transitions between nodes in your graph.\n*   **Modularity:** Build complex systems from smaller, reusable components (nodes).\n*   **Flexibility:** Integrate with various LLM providers and custom Java logic.\n*   **Observability & Debugging:**\n    *   **Checkpoints:** Save the state of your graph at any point and replay or inspect it later. This is invaluable for debugging and understanding complex interactions.\n    *   **Graph Visualization:** Generate visual representations of your graph using PlantUML or Mermaid to understand its structure.\n*   **Asynchronous & Streaming Support:** Build responsive applications with non-blocking operations and stream results from LLMs.\n*   **Playground & Studio:** A web UI to visually inspect, run, and debug your graphs.\n\n## Pattern Matrix\n\n| Pattern | Best for | Main abstraction | Start here |\n|---|---|---|---|\n| First graph \u002F linear flow | Learning the core execution model | `StateGraph`, normal edges, shared state | [`Your First Graph - A Simple Example`](#your-first-graph---a-simple-example) |\n| Conditional routing | Router-style decisions and dynamic control flow | Conditional edges | [`Edges`](#edges) |\n| Stateful checkpointed flow | Long-running or resumable workflows | `CheckpointSaver`, `CompileConfig` | [`Checkpoints (Persistence)`](#checkpoints-persistence) |\n| Framework-integrated agents | Using LangGraph4j with Java AI frameworks | LangChain4j \u002F Spring AI integrations | [`BONUS: built-in integrations`](#bonus-built-in-integrations) |\n| Visual debugging and inspection | Observing and iterating on graphs interactively | Studio | [`Studio 🤩 - Running Your Graph visually`](#studio--running-your-graph-visually) |\n\n## Core Concepts Explained\n\nUnderstanding these concepts is key to using LangGraph4j effectively:\n\n### `StateGraph\u003CS extends AgentState>`\n\nThe `StateGraph` is the primary class you'll use to define the structure of your application. It's where you add nodes and edges to create your graph. It is parameterized by an `AgentState`.\n\n### `AgentState`\n\nThe `AgentState` (or a class extending it) represents the shared state of your graph. It's essentially a map (`Map\u003CString, Object>`) that gets passed from node to node. Each node can read from this state and return updates to it.\n\n*   **Schema:** The structure of the state is defined by a \"schema,\" which is a `Map\u003CString, Channel.Reducer>`. Each key in the map corresponds to an attribute in the state.\n*   **`Channel.Reducer`:** A reducer defines how updates to a state attribute are handled. For example, a new value might overwrite the old one, or it might be added to a list of existing values.\n*   **`Channel.Default\u003CT>`:** Provides a default value for a state attribute if it's not already set.\n*   **`Channel.Appender\u003CT>` \u002F `MessageChannel.Appender\u003CM>`:** A common type of reducer that appends the new value to a list associated with the state attribute. This is useful for accumulating messages, tool calls, or other sequences of data. `MessageChannel.Appender` is specifically designed for chat messages and can also handle message deletion by ID.\n\n### `Nodes`\n\nNodes are the building blocks of your graph that perform actions. A node is typically a function (or a class implementing `NodeAction\u003CS>` or `AsyncNodeAction\u003CS>`) that:\n1.  Receives the current `AgentState` as input.\n2.  Performs some computation (e.g., calls an LLM, executes a tool, runs custom business logic).\n3.  Returns a `Map\u003CString, Object>` representing updates to the state. These updates are then applied to the `AgentState` according to the schema's reducers.\n\nNodes can be synchronous or asynchronous (`CompletableFuture`).\n\n### `Edges`\n\nEdges define the flow of control between nodes.\n\n*   **Normal Edges:** An unconditional transition from one node to another. After node A completes, control always passes to node B. You define these with `addEdge(sourceNodeName, destinationNodeName)`.\n*   **Conditional Edges:** The next node is determined dynamically based on the current `AgentState`. After a source node completes, an `EdgeAction\u003CS>` (or `AsyncEdgeAction\u003CS>`) function is executed. This function receives the current state and returns the name of the next node to execute. This allows for branching logic (e.g., if an agent decided to use a tool, go to the \"execute_tool\" node; otherwise, go to the \"respond_to_user\" node). Conditional edges are defined with `addConditionalEdges(...)`.\n*   **Entry Points:** You can also define conditional entry points to your graph using `addConditionalEntryPoint(...)`.\n\n### `Compilation`\n\nOnce you've defined all your nodes and edges in a `StateGraph`, you `compile()` it into a `CompiledGraph\u003CS extends AgentState>`. This compiled graph is an immutable, runnable representation of your logic. Compilation validates the graph structure (e.g., checks for orphaned nodes).\n\n### `Checkpoints (Persistence)`\n\nLangGraph4j allows you to save (`Checkpoint`) the state of your graph at any step. This is extremely useful for:\n*   **Debugging:** Inspect the state at various points to understand what happened.\n*   **Resuming:** Restore a graph to a previous state and continue execution.\n*   **Long-running processes:** Persist the state of long-running agent interactions.\nYou'll typically use a `CheckpointSaver` implementation (e.g., `MemorySaver` for in-memory storage, or you can implement your own for persistent storage).\n\nUseful starting points for persistence:\n\n- [`langgraph4j-mysql-saver\u002FREADME.md`](langgraph4j-mysql-saver\u002FREADME.md) for MySQL-backed checkpoints\n- [`langgraph4j-postgres-saver\u002FREADME.md`](langgraph4j-postgres-saver\u002FREADME.md) for PostgreSQL-backed checkpoints\n- [`langgraph4j-redis-saver\u002FREADME.md`](langgraph4j-redis-saver\u002FREADME.md) for Redis-backed checkpoints\n\nIf you only want to see the minimal integration point first, look for `CompileConfig.builder().checkpointSaver(...)` in the saver module examples before diving into the full storage details.\n\n## Project Structure\n\n```\nlanggraph4j\u002F\n├── langgraph4j-bom\u002F                     # LangGraph4j dependency management\n├── langgraph4j-core\u002F                    # LangGraph4j core components\n├── langgraph4j-opentelemetry\u002F           # LangGraph4j Hook & OpenTelemetry integration module\n├── langgraph4j-mysql-saver              # LangGraph4j persistent checkpoint saver based on MySQL\n├── langgraph4j-oracle-saver             # LangGraph4j persistent checkpoint saver based on OracleDB\n├── langgraph4j-postgres-saver           # LangGraph4j persistent checkpoint saver based on PostgresSQL\n├── langgraph4j-sqlite-saver             # LangGraph4j persistent checkpoint saver based on SQLite\n├── langgraph4j-dynamodb-saver           # LangGraph4j persistent checkpoint saver based on Amazon DynamoDB\n├── langgraph4j-cockroachdb-saver        # LangGraph4j persistent checkpoint saver based on CockroachDB\n├── langgraph4j-redis-saver              # LangGraph4j persistent checkpoint saver based on Redis\n├── langgraph4j-hazelcast-saver          # LangGraph4j persistent checkpoint saver based on Hazelcast\n├── langchain4j\u002F                         # LangChain4j integration\n│   ├── langchain4j-core\u002F                # LangChain4j core components (integration required)\n│   └── langchain4j-agent\u002F               # LangChain4j agent executor\n├── spring-ai\u002F                           # Spring AI integration\n│   └── spring-ai-core\u002F                  # Spring AI core components (integration required)\n│   └── spring-ai-agent\u002F                 # Spring AI agent executor\n├── studio\u002F                              # LangGraph4j Studio (web UI)\n│   └── base\u002F                            # Base classes and interfaces\n│   └── jetty\u002F                           # Jetty server implementation\n│   └── quarkus\u002F                         # Quarkus server implementation\n│   └── springboot\u002F                      # Spring Boot implementation\n├── how-tos\u002F                             # How-tos and examples\n├── javelit\u002F                             # LangGraph4j & Javelit\n```\n\n## Installation\n\nTo use LangGraph4j in your project, you need to add it as a dependency.\n\n**Maven:**\n\nMake sure you are using Java 17 or later.\n\n**Latest Stable Version (Recommended):**\n```xml\n\u003Cproperties>\n    \u003Clanggraph4j.version>1.8.24\u003C\u002Flanggraph4j.version> \u003C!-- Check for the actual latest version -->\n\u003C\u002Fproperties>\n\n\u003C!-- Optional: Add the Bill of Materials (BOM) to manage langgraph4j module versions -->\n\u003CdependencyManagement>\n  \u003Cdependencies>\n    \u003Cdependency>\n      \u003CgroupId>org.bsc.langgraph4j\u003C\u002FgroupId>\n      \u003CartifactId>langgraph4j-bom\u003C\u002FartifactId>\n      \u003Cversion>${langgraph4j.version}\u003C\u002Fversion>\n      \u003Ctype>pom\u003C\u002Ftype>\n      \u003Cscope>import\u003C\u002Fscope>\n    \u003C\u002Fdependency>\n  \u003C\u002Fdependencies>\n\u003C\u002FdependencyManagement>\n\n\u003Cdependencies>\n    \u003Cdependency>\n        \u003CgroupId>org.bsc.langgraph4j\u003C\u002FgroupId>\n        \u003CartifactId>langgraph4j-core\u003C\u002FartifactId>\n    \u003C\u002Fdependency>\n    \u003C!-- Add other langgraph4j modules if needed, e.g., langgraph4j-langchain4j -->\n\u003C\u002Fdependencies>\n```\n*(Note: Always check the [Maven Central Repository](https:\u002F\u002Fcentral.sonatype.com\u002Fsearch?q=g%3Aorg.bsc.langgraph4j) for the latest version number.)*\n\n**Development Snapshot Version:**\nIf you want to use the latest unreleased features, you can use a snapshot version.\n```xml\n\u003Cdependency>\n    \u003CgroupId>org.bsc.langgraph4j\u003C\u002FgroupId>\n    \u003CartifactId>langgraph4j-core\u003C\u002FartifactId>\n    \u003Cversion>1.8.24\u003C\u002Fversion> \u003C!-- Or the current snapshot version -->\n\u003C\u002Fdependency>\n```\nYou might need to configure your `settings.xml` or `pom.xml` to include the Sonatype OSS snapshots repository:\n```xml\n\u003Crepositories>\n    \u003Crepository>\n        \u003Cid>sonatype-oss-snapshots\u003C\u002Fid>\n        \u003Curl>https:\u002F\u002Fcentral.sonatype.com\u002Frepository\u002Fmaven-snapshots\u003C\u002Furl>\n        \u003Csnapshots>\n            \u003Cenabled>true\u003C\u002Fenabled>\n        \u003C\u002Fsnapshots>\n    \u003C\u002Frepository>\n\u003C\u002Frepositories>\n```\n\n## Your First Graph - A Simple Example\n\nLet's create a very simple graph that has two nodes: `greeter` and `responder`.\nThe `greeter` node will add a greeting message to the state.\nThe `responder` node will add a response message based on the greeting.\n\nBefore you start, the shortest path is:\n\n1. Make sure you are on Java 17+ and have added `langgraph4j-core` to your project.\n2. Copy the example below exactly once to understand the basic `StateGraph` + shared-state flow.\n3. Run the graph locally and confirm you can see the state evolve across the two nodes.\n4. After that first success, jump to the built-in integrations or checkpointing sections depending on whether you want framework integration or persistence next.\n\n**1. Define the State:**\nOur state will hold a list of messages.\n\n```java\nimport org.bsc.langgraph4j.state.AgentState;\nimport org.bsc.langgraph4j.state.Channels;\nimport org.bsc.langgraph4j.state.Channel;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\n\u002F\u002F Define the state for our graph\nclass SimpleState extends AgentState {\n    public static final String MESSAGES_KEY = \"messages\";\n\n    \u002F\u002F Define the schema for the state.\n    \u002F\u002F MESSAGES_KEY will hold a list of strings, and new messages will be appended.\n    public static final Map\u003CString, Channel\u003C?>> SCHEMA = Map.of(\n            MESSAGES_KEY, Channels.appender(ArrayList::new)\n    );\n\n    public SimpleState(Map\u003CString, Object> initData) {\n        super(initData);\n    }\n\n    public List\u003CString> messages() {\n        return this.\u003CList\u003CString>>value(\"messages\")\n                .orElse( List.of() );\n    }\n}\n```\n\n**2. Define the Nodes:**\n\n```java\nimport org.bsc.langgraph4j.action.NodeAction;\nimport java.util.List;\nimport java.util.Map;\n\n\u002F\u002F Node that adds a greeting\nclass GreeterNode implements NodeAction\u003CSimpleState> {\n    @Override\n    public Map\u003CString, Object> apply(SimpleState state) {\n        System.out.println(\"GreeterNode executing. Current messages: \" + state.messages());\n        return Map.of(SimpleState.MESSAGES_KEY, \"Hello from GreeterNode!\");\n    }\n}\n\n\u002F\u002F Node that adds a response\nclass ResponderNode implements NodeAction\u003CSimpleState> {\n    @Override\n    public Map\u003CString, Object> apply(SimpleState state) {\n        System.out.println(\"ResponderNode executing. Current messages: \" + state.messages());\n        List\u003CString> currentMessages = state.messages();\n        if (currentMessages.contains(\"Hello from GreeterNode!\")) {\n            return Map.of(SimpleState.MESSAGES_KEY, \"Acknowledged greeting!\");\n        }\n        return Map.of(SimpleState.MESSAGES_KEY, \"No greeting found.\");\n    }\n}\n```\n\n**3. Define and Compile the Graph:**\n\n```java\nimport org.bsc.langgraph4j.StateGraph;\nimport org.bsc.langgraph4j.GraphStateException;\nimport static org.bsc.langgraph4j.action.AsyncNodeAction.node_async;\nimport static org.bsc.langgraph4j.StateGraph.START;\nimport static org.bsc.langgraph4j.StateGraph.END;\n\nimport java.util.Map;\n\npublic class SimpleGraphApp {\n    \n    public static void main(String[] args) throws GraphStateException {\n        \u002F\u002F Initialize nodes\n        GreeterNode greeterNode = new GreeterNode();\n        ResponderNode responderNode = new ResponderNode();\n\n        \u002F\u002F Define the graph structure\n       var stateGraph = new StateGraph\u003C>(SimpleState.SCHEMA, initData -> new SimpleState(initData))\n            .addNode(\"greeter\", node_async(greeterNode))\n            .addNode(\"responder\", node_async(responderNode))\n            \u002F\u002F Define edges\n            .addEdge(START, \"greeter\") \u002F\u002F Start with the greeter node\n            .addEdge(\"greeter\", \"responder\")\n            .addEdge(\"responder\", END)   \u002F\u002F End after the responder node\n             ;\n        \u002F\u002F Compile the graph\n        var compiledGraph = stateGraph.compile();\n\n        \u002F\u002F Run the graph\n        \u002F\u002F The `stream` method returns an AsyncGenerator.\n        \u002F\u002F For simplicity, we'll collect results. In a real app, you might process them as they arrive.\n        \u002F\u002F Here, the final state after execution is the item of interest.\n        \n        for (var item : compiledGraph.stream( Map.of( SimpleState.MESSAGES_KEY, \"Let's, begin!\" ) ) ) {\n\n            System.out.println( item );\n        }\n\n    }\n}\n```\n\n**Explanation:**\n\n*   We defined `SimpleState` with a `MESSAGES_KEY` that uses `AppenderChannel` to accumulate strings.\n*   `GreeterNode` adds a \"Hello\" message.\n*   `ResponderNode` checks for the greeting and adds an acknowledgment.\n*   The `StateGraph` is defined, nodes are added, and edges specify the flow: `START` -> `greeter` -> `responder` -> `END`.\n*   `stateGraph.compile()` creates the runnable `CompiledGraph`.\n*   `compiledGraph.stream(initialState)` executes the graph. We iterate through the stream to get the final state. Each item in the stream represents the state after a node has executed.\n\nThis example demonstrates the basic workflow: define state, define nodes, wire them with edges, compile, and run.\n\n## Running Your Graph\n\nAs shown in the example, you typically run a compiled graph using one of its execution methods:\n\n*   `stream(S initialState, RunnableConfig config)`: Executes the graph and returns an `AsyncGenerator\u003CS>`. Each yielded item is the state `S` after a node has completed. This is useful for observing the state at each step or for streaming partial results.\n*   `invoke(S initialState, RunnableConfig config)`: Executes the graph and returns a `CompletableFuture\u003CS>` that completes with the final state of the graph after it reaches an `END` node.\n\nThe `RunnableConfig` can be used to pass in runtime configuration.\n\n## Studio 🤩 - Running Your Graph visually\n\n**Langgraph4j Studio** is an embeddable web application for visualizing and experimenting with graphs:\n\nTo explore the **Langgraph4j Studio** go to [studio]\n\n## BONUS: built-in integrations\n\n### Integration Paths\n\n| Integration | Best for | Quick links |\n|---|---|---|\n| LangChain4j | Projects already using LangChain4j chat models, tools, and agent patterns | [`langchain4j\u002FREADME.md`](langchain4j\u002FREADME.md), [`langchain4j\u002Flangchain4j-agent\u002FREADME.md`](langchain4j\u002Flangchain4j-agent\u002FREADME.md) |\n| Spring AI | Spring Boot and Spring-native MCP \u002F agent applications | [`spring-ai\u002FREADME.md`](spring-ai\u002FREADME.md), [`spring-ai\u002Fspring-ai-agent\u002FREADME.md`](spring-ai\u002Fspring-ai-agent\u002FREADME.md) |\n\n### LangChain4j \n\nAs default use case to proof [LangChain4j] integration, We have implemented **AgentExecutor (aka ReACT Agent)** using LangGraph4j. In the [project's module][agent-executor], you can the complete working code with tests. Feel free to checkout and use it as a reference.\nBelow usage example of the `AgentExecutor`.\n\n#### Define Tools\n\n```java\npublic class TestTool {\n\n    @Tool(\"tool for test AI agent executor\")\n    String execTest(@P(\"test message\") String message) {\n        return format( \"test tool ('%s') executed with result 'OK'\", message);\n    }\n\n    @Tool(\"return current number of system thread allocated by application\")\n    int threadCount() {\n        return Thread.getAllStackTraces().size();\n    }\n\n}\n```\n\n#### Run Agent\n\n```java\n\nvar model = OllamaChatModel.builder()\n            .modelName( \"qwen2.5:7b\" )\n            .baseUrl(\"http:\u002F\u002Flocalhost:11434\")\n            .supportedCapabilities(Capability.RESPONSE_FORMAT_JSON_SCHEMA)\n            .logRequests(true)\n            .logResponses(true)\n            .maxRetries(2)\n            .temperature(0.0)\n            .build();\n\nvar agent = AgentExecutor.builder()\n            .chatModel(model)\n            .toolsFromObject(new TestTool())\n            .build()\n            .compile();\n\nfor (var item : agent.stream( Map.of( \"messages\", \"perform test twice and return number of current active threads\" ) ) ) {\n\n    System.out.println( item );\n}\n\n```\n\n### Spring AI \n\nAs default use case to proof [Spring AI] integration, We have implemented **AgentExecutor (aka ReACT Agent)** using LangGraph4j. In the [project's module][spring-ai-agent], you can the complete working code with tests. Feel free to checkout and use it as a reference.\nBelow usage example of the `AgentExecutor`.\n\n#### Define Tools\n\n```java\npublic class TestTool {\n\n    @Tool(description = \"tool for test AI agent executor\")\n    String execTest( @ToolParam(description =\"test message\") String message ) {\n        return format( \"test tool ('%s') executed with result 'OK'\", message);\n    }\n\n    @Tool(description = \"return current number of system thread allocated by application\")\n    int threadCount() {\n        return Thread.getAllStackTraces().size();\n    }\n\n}\n```\n\n#### Run Agent\n\n```java\n\nvar model = OllamaChatModel.builder()\n            .ollamaApi(OllamaApi.builder().baseUrl(\"http:\u002F\u002Flocalhost:11434\").build())\n            .defaultOptions(OllamaOptions.builder()\n                    .model(\"qwen2.5:7b\")\n                    .temperature(0.1)\n                    .build())\n            .build();\n\nvar agent = AgentExecutor.builder()\n        .chatModel(model)\n        .toolsFromObject(new TestTool())\n        .build()\n        .compile()\n        ;\n\nfor (var item : agent.stream( Map.of( \"messages\", \"perform test twice and return number of current active threads\" ) ) ) {\n\n    System.out.println( item );\n}\n```\n\n## Key Capabilities Overview\n\nLangGraph4j is packed with features to build sophisticated agentic applications:\n\n*   **Asynchronous Operations:** Nodes and edges can be asynchronous (returning `CompletableFuture`), allowing for non-blocking I\u002FO operations, especially when dealing with LLM calls.\n*   **Streaming:** Natively supports streaming responses from LLMs through nodes, enabling real-time output. See [how-tos\u002Fllm-streaming.ipynb].\n*   **Checkpoints (Persistence & Time Travel):** Save and load the state of your graph. This allows you to resume long-running tasks, debug by inspecting intermediate states, and even \"time travel\" to previous states. See [how-tos\u002Fpersistence.ipynb] and [how-tos\u002Ftime-travel.ipynb].\n*   **Graph Visualization:** Generate [PlantUML] or [Mermaid] diagrams of your graph to visualize its structure, which aids in understanding and debugging. See [how-tos\u002Fplantuml.ipynb].\n*   **Playground & Studio:** LangGraph4j comes with an embeddable web UI (Studio) that allows you to visualize, run, and interact with your graphs in real-time. This is excellent for development and debugging.\n*   **Child Graphs (Subgraphs):** Compose complex graphs by nesting smaller, reusable graphs within nodes of a parent graph. This promotes modularity and reusability. See [how-tos\u002Fsubgraph-as-nodeaction.ipynb], [how-tos\u002Fsubgraph-as-compiledgraph.ipynb], and [how-tos\u002Fsubgraph-as-stategraph.ipynb].\n*   **Parallel Execution:** Configure parts of your graph to execute multiple nodes in parallel, improving performance for tasks that can be run concurrently. See [how-tos\u002Fparallel-branch.ipynb].\n*   **Threads (Multi-turn Conversations):** Manage distinct, parallel execution threads within a single graph instance, each with its own checkpoint history. This is vital for handling multiple user sessions or conversations simultaneously.\n\n## Next Steps\n\nNow that you have a basic understanding of LangGraph4j, here's how you can continue your journey:\n\n*   **Explore the `how-to`:** The [`how-tos\u002F`](how-tos) directory in the repository contains Jupyter notebooks (runnable with Java kernels like [IJava](https:\u002F\u002Fgithub.com\u002FSpencerPark\u002FIJava)) that demonstrate various features with code examples.\n*   **Study the Examples:** Check out the examples from [here](https:\u002F\u002Fgithub.com\u002Flanggraph4j\u002Flanggraph4j-examples) for more complete application examples, including integrations with Langchain4j and Spring AI.\n*   **Consult the Javadocs:** For detailed information on classes and methods, refer to the [API documentation (Javadocs)][javadocs]. *(Link might need updating if official project documentation site changes)*\n*   **Experiment!** The best way to learn is by doing. Try modifying the examples or building your own simple graphs.\n\nWe hope this guide helps you get started with LangGraph4j. Happy building!\n\n# References\n\n## Videos\n\n* [LangGraph4j live discussion with Johannes Rabauer](https:\u002F\u002Fwww.linkedin.com\u002Fevents\u002Fyourtool-callingloopisn-tanagen7494246562873716736\u002Ftheater\u002F)\n\n## Projects using LangGraph4j\n\n* [Agentic CI\u002FCD Orchestrator](https:\u002F\u002Fgithub.com\u002Fveerjain-1\u002Fagentic-cicd-orchestrator)\n* [AI-Powered Hiring Workflow](https:\u002F\u002Fgithub.com\u002Fykpraveen\u002Flangchain4j-sample)\n* [OpenHuskyAgent (_Agent Runtime Platform_)](https:\u002F\u002Fgithub.com\u002FHandleCoding\u002FOpenHuskyAgent\u002Ftree\u002Fmain)\n* [spring-ai-alibaba (_use an embedded version in spring-ai-alibaba-graph-core_)](https:\u002F\u002Fgithub.com\u002Falibaba\u002Fspring-ai-alibaba\u002Ftree\u002Fmain)\n* [An ACP bridge to langraph4j and langchain4j](https:\u002F\u002Fgithub.com\u002FOsgiliathEnterprise\u002Facp-langgraph-langchain-bridge)\n* [A deep research assistant based on the Langgraph4j](https:\u002F\u002Fgithub.com\u002Fimfangs\u002Flanggraph4j-deep-researcher)\n* [research4j - Build your own perplexity for your applications](https:\u002F\u002Fgithub.com\u002Fbhavuklabs\u002Fresearch4j)\n* [Multi Agent Banking Assistant with Java using Langraph4j](https:\u002F\u002Fgithub.com\u002FAzure-Samples\u002Fagent-openai-java-banking-assistant-langgraph4j)\n* [Java Async Generator, a Java version of Javascript async generator](https:\u002F\u002Fgithub.com\u002Fbsorrentino\u002Fjava-async-generator)\n* [AIDEEPIN: Ai-based productivity tools (Chat,Draw,RAG,Workflow etc)](https:\u002F\u002Fgithub.com\u002Fmoyangzhan\u002Flangchain4j-aideepin)\n* [Dynamo Multi AI Agent POC: Unlock the Power of Spring AI and LangGraph4J](https:\u002F\u002Fgithub.com\u002FBreezeware-OS\u002Fdynamo-multi-ai-agent-langgraph4j-starter)\n* [LangChain4j & LangGraph4j Integrate LangFuse](https:\u002F\u002Fgithub.com\u002FKugaaa\u002Flangchain4j-langfuse)\n\n\n## Articles\n* [Building an Agentic Harness with Spring AI and LangGraph4j](https:\u002F\u002Fdev.to\u002Flbobylev\u002Fbuilding-an-agentic-harness-with-spring-ai-2j1p)\n* LangGraph4j Series\n  * [Part 1: State Management, Channels Reducers and Human in the Loop](https:\u002F\u002Fwww.futurecraft.dev\u002Fai\u002FState-Management\u002F)\n  * [Part 2: Node Hooks, applyBefore, applyWrap, and applyAfter Explained](https:\u002F\u002Fwww.futurecraft.dev\u002Fai\u002FNode-Hooks-in-LangGraph4j\u002F)\n  * [Part 3: Framework-Agnostic Nodes — The Adapter Pattern, Explained](https:\u002F\u002Fwww.futurecraft.dev\u002Fai\u002FFramework-Agnostic-Nodes-in-LangGraph4j\u002F)\n* [LangGraph4j: 5 Practical Steps](https:\u002F\u002Fwww.linkedin.com\u002Fpulse\u002Flanggraph4j-5-practical-steps-vincent-vauban-uot1e)\n* [Building a Multi-Agent Hiring Workflow with Langchain4j and Langgraph4j on Spring Boot](https:\u002F\u002Fdev.to\u002Fykpraveen\u002Fbuilding-a-multi-agent-hiring-workflow-with-langchain4j-and-langgraph4j-on-spring-boot-2a15)\n* [Spring AI Recipe: Building a Graph-Based Agentic Workflow with LangGraph4j](https:\u002F\u002Fwww.linkedin.com\u002Fpulse\u002Fspring-ai-recipe-building-graph-based-agentic-workflow-craig-walls-ztfqc\u002F)\n* [Skill-Based Sub-Agents with LangGraph4j and Spring AI](https:\u002F\u002Fdev.to\u002Fbsorrentino\u002Fskill-based-sub-agents-with-langgraph4j-and-spring-ai-52b0)\n* [Building AI-Powered Workflows in Java: A Hands-On Guide to Spring AI and LangGraph4j](https:\u002F\u002Fmedium.com\u002F@kandisa.ganesh\u002Fbuilding-ai-powered-workflows-in-java-a-hands-on-guide-to-spring-ai-and-langgraph4j-805464ab8a2e)\n* [Beyond the Basics: Building Real-World AI Workflows with LangGraph4j](https:\u002F\u002Fmedium.com\u002F@kandisa.ganesh\u002Fbeyond-the-basics-building-real-world-ai-workflows-with-langgraph4j-8e2f7765c505)\n* [LangGraph4j Hooks and OpenTelemetry](https:\u002F\u002Fmedium.com\u002Fdev-genius\u002Flanggraph4j-hooks-and-opentelemetry-3bd8de02f9d1)\n* [LangGraph4j Deep Agents (Agent 2.0)](https:\u002F\u002Fbsorrentino.github.io\u002Fbsorrentino\u002Fai\u002F2025\u002F10\u002F17\u002Flanggraph4j-deepagents.html)\n* [LangGraph4j Meets AG-UI - Building UI\u002FUX in AI Agents era](https:\u002F\u002Fbsorrentino.github.io\u002Fbsorrentino\u002Fai\u002F2025\u002F08\u002F21\u002FLangGraph4j-meets-AG-UI.html)\n* [LangGraph4j - Implementing Human-in-the-Loop at ease](https:\u002F\u002Fbsorrentino.github.io\u002Fbsorrentino\u002Fai\u002F2025\u002F07\u002F13\u002FLangGraph4j-Agent-with-approval.html)\n* [LangGraph4j - Multi-Agent handoff implementation with Spring AI](https:\u002F\u002Fbsorrentino.github.io\u002Fbsorrentino\u002Fai\u002F2025\u002F05\u002F10\u002FLanggraph4j-agent-handoff.html)\n* [Microsoft JDConf 2025 - AI Agents Graph: Your following tool in your Java AI journey](https:\u002F\u002Fyoutu.be\u002FSp36wdpobpI?si=dXDTD9k16hM8A8KQ)\n* [Enhancing AI Agent Development: A Hands-On Weekend with LangGraph4J](https:\u002F\u002Fwww.linkedin.com\u002Fpulse\u002Fenhancing-ai-agent-development-hands-on-weekend-langgraph4j-chung-ha-iu3be\u002F)\n* [LangGraph4j Generator - Visually scaffold LangGraph Java code](https:\u002F\u002Fdev.to\u002Fbsorrentino\u002Flanggraph4j-generator-2ika)\n* [AI Agent in Java with LangGraph4j](https:\u002F\u002Fbsorrentino.github.io\u002Fbsorrentino\u002Fai\u002F2024\u002F05\u002F20\u002Flanggraph-for-java.html)\n* [Building Stateful Multi AI Agents -LangGraph4J & Spring AI](https:\u002F\u002Fmedium.com\u002F@ganeshmoorthy5999\u002Fbuilding-stateful-multi-ai-agents-langgraph4j-spring-ai-c0046e293d00)\n\n## Useful links\n\n* [Shypd (_The largest open index of AI tools_)](https:\u002F\u002Fshypd.ai\u002Ftools\u002Flanggraph4j)\n* [DeepWiki](https:\u002F\u002Fdeepwiki.com\u002Flanggraph4j\u002Flanggraph4j)\n* [Content7](https:\u002F\u002Fcontext7.com\u002Flanggraph4j\u002Flanggraph4j)\n* [olud.ai (_The AI hub_)](https:\u002F\u002Folud.ai\u002Fproject\u002Flanggraph4j-langgraph4j.html)\n\n## Books\n\n* [Applied AI for Enterprise Java Development(Red Hat Developer e-books)](https:\u002F\u002Fdevelopers.redhat.com\u002Fe-books\u002Fapplied-ai-enterprise-java-development)\n\n\u003C!--\n* [LangGraph - LangChain Blog][langgraph.blog]\n-->\n\n[LangChain AI project]: https:\u002F\u002Fgithub.com\u002Flangchain-ai\n[langchain4j]: https:\u002F\u002Fgithub.com\u002Flangchain4j\u002Flangchain4j\n[Spring AI]: https:\u002F\u002Fspring.io\u002Fprojects\u002Fspring-ai\n[langgraph]: https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flanggraph\n[documentation]: https:\u002F\u002Flanggraph4j.github.io\u002Flanggraph4j\u002F\n[releases]: https:\u002F\u002Fcentral.sonatype.com\u002Fsearch?q=a%3Alanggraph4j-parent\n[snapshots]: https:\u002F\u002Fcentral.sonatype.com\u002Frepository\u002Fmaven-snapshots\u002Forg\u002Fbsc\u002Flanggraph4j\u002F\n[PlantUML]: https:\u002F\u002Fplantuml.com\n[Mermaid]: https:\u002F\u002Fmermaid.js.org\n[documentation]: https:\u002F\u002Flanggraph4j.github.io\u002Flanggraph4j\u002F\n[javadocs]: https:\u002F\u002Flanggraph4j.github.io\u002Flanggraph4j\u002Fapidocs\u002F\n[springai-agentexecutor]: spring-ai\u002Fspring-ai-agent\n[agent-executor]: langchain4j\u002Flangchain4j-agent\n[spring-ai-agent]: spring-ai\u002Fspring-ai-agent\n[Studio]: studio\u002FREADME.md\n[Jetty]: https:\u002F\u002Fjetty.org\n[Spring Boot]: https:\u002F\u002Fspring.io\u002Fprojects\u002Fspring-boot\n[Quarkus]: https:\u002F\u002Fquarkus.io\n[CompletableFuture]: https:\u002F\u002Fdocs.oracle.com\u002Fjavase\u002F8\u002Fdocs\u002Fapi\u002Fjava\u002Futil\u002Fconcurrent\u002FCompletableFuture.html\n[article01]: https:\u002F\u002Fbsorrentino.github.io\u002Fbsorrentino\u002Fai\u002F2024\u002F05\u002F20\u002Flanggraph-for-java.html\n[langgraph.blog]: https:\u002F\u002Fblog.langchain.dev\u002Flanggraph\u002F\n[langchain]: https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain\u002F\n[langgraph]: https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flanggraph\n[langchain.agents]: https:\u002F\u002Fpython.langchain.com\u002Fdocs\u002Fmodules\u002Fagents\u002F\n[AgentExecutor]: https:\u002F\u002Fgithub.com\u002Flangchain-ai\u002Flangchain\u002Fblob\u002Fmaster\u002Flibs\u002Flangchain\u002Flangchain\u002Fagents\u002Fagent.py\n[java-async-generator]: https:\u002F\u002Fgithub.com\u002Fbsorrentino\u002Fjava-async-generator\n\n[how-tos\u002Fplantuml.ipynb]: how-tos\u002Fplantuml.ipynb\n[how-tos\u002Fpersistence.ipynb]: how-tos\u002Fpersistence.ipynb\n[how-tos\u002Fllm-streaming.ipynb]: how-tos\u002Fllm-streaming.ipynb\n[how-tos\u002Ftime-travel.ipynb]: how-tos\u002Ftime-travel.ipynb\n[how-tos\u002Fsubgraph-as-nodeaction.ipynb]: how-tos\u002Fsubgraph-as-nodeaction.ipynb\n[how-tos\u002Fsubgraph-as-compiledgraph.ipynb]: how-tos\u002Fsubgraph-as-compiledgraph.ipynb\n[how-tos\u002Fsubgraph-as-stategraph.ipynb]: how-tos\u002Fsubgraph-as-stategraph.ipynb\n","LangGraph4j 是一个面向 Java 生态的 AI 智能体工作流框架，用于构建具备状态管理能力的多智能体（multi-agent）应用。它支持基于有向图的循环执行逻辑，可编排 LLM 驱动的 Agent、工具调用与自定义节点，并原生集成 LangChain4j 和 Spring AI。核心特性包括状态快照、条件分支、节点间状态共享及故障恢复机制。适用于需长期上下文、多步骤协作与任务流转的场景，如自动化客服编排、复杂决策工作流、RAG 增强型业务流程等。",2,"2026-08-21 02:30:13","trending"]