# Repository: alibaba/spring-ai-alibaba # Stars: 9289 ## CLAUDE.md # CLAUDE.md - AI Assistant Guide for Spring AI Alibaba This file provides guidance for AI assistants working with the Spring AI Alibaba codebase. ## Project Overview Spring AI Alibaba is a production-ready framework for building Agentic, Workflow, and Multi-agent applications. It is an implementation of the Spring AI framework tailored for Alibaba Cloud services and components. It provides a comprehensive ecosystem for developing AI-powered applications with built-in context engineering and human-in-the-loop support. **Key Features:** - Multi-Agent Orchestration with built-in patterns - Context Engineering with human-in-the-loop, context compaction, editing, model call limits - Graph-based workflow with conditional routing, nested graphs, parallel execution - A2A (Agent-to-Agent) support with Nacos integration - Rich model support (DashScope, OpenAI, DeepSeek) and MCP (Model Context Protocol) - One-stop visual agent platform ## Repository Structure ``` spring-ai-alibaba/ ├── spring-ai-alibaba-agent-framework/ # Multi-agent framework (Sequential, Parallel, Routing, etc.) ├── spring-ai-alibaba-graph-core/ # Runtime providing persistence, workflow orchestration, state mgmt ├── spring-ai-alibaba-studio/ # Embedded UI for debugging agents visually ├── spring-ai-alibaba-admin/ # One-stop Agent platform (visual dev, observability, MCP mgmt) ├── spring-ai-alibaba-bom/ # Bill of Materials for dependency management ├── spring-boot-starters/ # Spring Boot Starters │ ├── spring-ai-alibaba-starter-a2a-nacos/ # Nacos A2A communication │ ├── spring-ai-alibaba-starter-builtin-nodes/ # Built-in workflow nodes │ ├── spring-ai-alibaba-starter-config-nacos/ # Dynamic config with Nacos │ └── spring-ai-alibaba-starter-graph-observation/ # Observability ├── examples/ # Example applications │ ├── chatbot/ # Chatbot example │ ├── deepresearch/ # Deep research agent example │ └── documentation/ # Documentation examples ├── tools/ # Build and linting tools └── docs/ # Documentation ``` ## Build System ### Prerequisites - **JDK**: 17 (Required by `java.version` property) - **Maven**: 3.6+ - **Git** ### Common Build Commands ```shell # Build the entire project (skip tests) ./mvnw -B package -DskipTests=true # Build a specific module ./mvnw -pl :spring-ai-alibaba-agent-framework -B package -DskipTests=true # Clean project ./mvnw clean # Run tests ./mvnw test # Run linting checks (using Makefile) make lint make licenses-check ``` ## Architecture & Key Concepts ### Core Components - **Agent Framework**: Built-in agents like `SequentialAgent`, `ParallelAgent`, `RoutingAgent`, `LoopAgent`. - **Graph Core**: Underlying engine for stateful agents, supporting persistence (PostgreSQL, MySQL, Oracle, MongoDB, Redis, File). - **A2A (Agent-to-Agent)**: Enables agents to seek and communicate with each other using Nacos as a registry. - **Admin & Studio**: Provides visual tools for developing and debugging agent workflows. ### Technology Stack - **Framework**: Spring Boot 3.5.x, Spring AI 1.1.x - **Cloud Integration**: Alibaba Cloud DashScope, Nacos (Service Discovery & Config) - **Observability**: Spring Cloud Observation (Micrometer/OpenTelemetry) ## Code Style & Conventions ### General Guidelines - Follow **Spring AI** standard code formatting. - Use **Apache 2.0** license headers for all Java files. - **Java 17** features are encouraged (records, switch expressions, text blocks). - Avoid `System.out.println` - use SLF4J logging. - Use `final` for local variables and parameters where appropriate. - Use Lombok annotations (`@Data`, `@Slf4j`, etc.) to reduce boilerplate. ### Linting & Formatting The project uses `make` for linting tasks: - `make codespell`: Checks for spelling errors. - `make yaml-lint`: Checks YAML file formatting. - `make licenses-check`: Verifies license headers. ### License Header ```java /* * Copyright 2025-2026 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ ``` ## Testing ### Frameworks - **JUnit 5** (`org.junit.jupiter`) - **Mockito** ### Running Tests ```shell # Run all tests ./mvnw test # Run a specific test class ./mvnw -pl : -Dtest= test ``` ## Tips for AI Assistants 1. **JDK Version**: Project targets JDK 17. Use appropriate language features. 2. **Spring Boot**: Uses Spring Boot 3.x. Be aware of `jakarta.*` namespace vs `javax.*`. 3. **Dependencies**: Check `spring-ai-alibaba-bom` or parent pom for version management. 4. **Makefile**: Use the Makefile in the root for project maintenance tasks (linting, license checks). 5. **Structure**: When adding new features, prefer creating or updating modules within `spring-ai-alibaba-agent-framework` or `spring-boot-starters` depending on the scope. ## Important Links - **Issues**: [https://github.com/alibaba/spring-ai-alibaba/issues](https://github.com/alibaba/spring-ai-alibaba/issues) - **Source**: [https://github.com/alibaba/spring-ai-alibaba](https://github.com/alibaba/spring-ai-alibaba) - **Contributing**: [CONTRIBUTING.md](CONTRIBUTING.md) ## README.md # [Spring AI Alibaba](https://java2ai.com) [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![CI Status](https://github.com/alibaba/spring-ai-alibaba/workflows/%F0%9F%9B%A0%EF%B8%8F%20Build%20and%20Test/badge.svg)](https://github.com/alibaba/spring-ai-alibaba/actions?query=workflow%3A%22%F0%9F%9B%A0%EF%B8%8F+Build+and+Test%22) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/alibaba/spring-ai-alibaba) [![Maven central](https://img.shields.io/maven-central/v/com.alibaba.cloud.ai/spring-ai-alibaba.svg)](https://img.shields.io/maven-central/v/com.alibaba.cloud.ai/spring-ai-alibaba) gitleaks badge

A production-ready framework for building Agentic, Workflow, and Multi-agent applications.

Agent Framework Docs, Graph Docs, Spring AI, Examples.

## Architecture

architecture

**Spring AI Alibaba Admin** is a one-stop Agent platform that supports visualized Agent development, observability, evaluation, and MCP management, etc. It also integrates with open-source low-code platforms like Dify, enabling rapid migration from DSL to Spring AI Alibaba project. **Spring AI Alibaba Agent Framework** is an agent development framework that can quickly develop agents with builtin **Context Engineering** and **Human In The Loop** support. For scenarios requiring more complex process control, Agent Framework offers built-in workflows like `SequentialAgent`, `ParallelAgent`, `RoutingAgent`, `LoopAgent`. **Spring AI Alibaba Graph** serves as the underlying runtime of the Agent Framework, providing essential capabilities such as persistence, workflow orchestration, and streaming required for long-running stateful agents. Compared to the Agent Framework, users can build more flexible multi-agent workflows based on the Graph API. ## Core Features * **[Multi-Agent Orchestration](https://github.com/alibaba/spring-ai-alibaba/tree/main/examples/multiagent-patterns)**: Compose multiple agents with built-in patterns including `SequentialAgent`, `ParallelAgent`, `RoutingAgent`, and `LoopAgent` for complex task execution. * **[Multimodal Support](https://github.com/alibaba/spring-ai-alibaba/tree/main/examples/multimodal)**: ReactAgent with text and media input (image understanding). ReactAgent with tool based image or audio generation. * **[Voice Agent](https://github.com/alibaba/spring-ai-alibaba/tree/main/examples/voice-agent)**: WebSocket-based real-time voice agent that supports streaming audio or text input and responds with generated audio. * **[Context Engineering](https://java2ai.com/docs/frameworks/agent-framework/tutorials/hooks)**: Built-in best practices for context engineering policies to improve agent reliability and performance, including human-in-the-loop, context compaction, context editing, model & tool call limit, tool retry, planning, dynamic tool selection. * **[Graph-based Workflow](https://java2ai.com/docs/frameworks/graph-core/quick-start)**: Graph based workflow runtime and api for conditional routing, nested graphs, parallel execution, and state management. Export workflows to PlantUML and Mermaid formats. * **[A2A Support](https://java2ai.com/docs/frameworks/agent-framework/advanced/a2a)**: Agent-to-Agent communication support with Nacos integration, enabling distributed agent coordination and collaboration across services. * **[Rich Model, Tool and MCP Support](https://java2ai.com/integration/chatmodels/dashScope)**: Leveraging core concepts of Spring AI, supports multiple LLM providers (DashScope, OpenAI, etc.), tool calling, and Model Context Protocol (MCP). * **[One-stop Agent Platform](https://java2ai.com/ecosystem/admin/quick-start)**: Build agent in a visualized way, deploy agent without code or export as a standalone java project.

architecture

## Getting Started ### Prerequisites * Requires JDK 17+. * Choose your LLM provider and get the API-KEY. ### Quickly Run a ChatBot There's a ChatBot example provided by the community at [examples/chatbot](https://github.com/alibaba/spring-ai-alibaba/tree/main/examples/chatbot). 1. Download the code. ```shell git clone --depth=1 https://github.com/alibaba/spring-ai-alibaba.git cd spring-ai-alibaba ``` 2. Start the ChatBot. Before starting, set API-KEY first (visit Aliyun Bailian to get API-KEY): ```shell # this example uses 'spring-ai-alibaba-starter-dashscope', visit https://java2ai.com to learn how to use OpenAI/DeepSeek. export AI_DASHSCOPE_API_KEY=your-api-key ``` ```shell # Maven installation is optional when using mvnw. ./mvnw -pl examples/chatbot spring-boot:run ``` 3. Chat with ChatBot. Open the browser and visit [http://localhost:8080/chatui/index.html](http://localhost:8080/chatui/index.html) to chat with the ChatBot.

chatbot-ui

## Chatbot Code Explained 1. Add dependencies ```xml com.alibaba.cloud.ai spring-ai-alibaba-agent-framework 1.1.2.0 com.alibaba.cloud.ai spring-ai-alibaba-starter-dashscope 1.1.2.1 ``` 2. Define Chatbot For more details of how to write a Chatbot, please check the [Quick Start](https://java2ai.com/docs/quick-start) on our official website. ## 📚 Documentation * [Overview](https://java2ai.com/docs/overview) - High level overview of the framework * [Quick Start](https://java2ai.com/docs/quick-start) - Get started with a simple agent * [Agent Framework Tutorials](https://java2ai.com/docs/frameworks/agent-framework/tutorials/agents) - Step by step tutorials * [Use Graph API to Build Complex Workflows](https://java2ai.com/docs/frameworks/agent-framework/advanced/context-engineering) - In-depth user guide for building multi-agent and workflows * [Spring AI Basics](https://java2ai.com/ecosystem/spring-ai/reference/concepts) - Ai Application basic concepts, including ChatModel, MCP, Tool, Messages, etc. ## Project Structure This project consists of several core components: * spring-ai-alibaba-agent-framework: A multi-agent framework designed for building intelligent agents with built-in context engineering best practices. * spring-ai-alibaba-graph: The underlying runtime for Agent Framework. We recommend developers to use Agent Framework but it's totally fine to use the Graph API directly. * spring-ai-alibaba-admin: A one-stop Agent platform that supports visualized Agent development, observability, evaluation, and MCP management, etc. * spring-ai-alibaba-studio: The embedded ui for quickly debugging agent in a visualized way. * spring-boot-starters: Starters integrating Agent Framework with Nacos to provide A2A and dynamic config features. ## Spring AI Alibaba Ecosystem Repository | Description | ⭐ --- | --- | --- | [Spring AI Alibaba Graph](https://github.com/alibaba/spring-ai-alibaba/tree/main/spring-ai-alibaba-graph-core) | A low-level orchestration framework and runtime for building, managing, and deploying long-running, stateful agents. | ![GitHub Repo stars](https://img.shields.io/github/stars/alibaba/spring-ai-alibaba?style=for-the-badge&label=) | [Spring AI Alibaba Admin](https://github.com/spring-ai-alibaba/spring-ai-alibaba-admin) | Local visualization toolkit for the development of agent applications, supporting project management, runtime visualization, tracing, and agent evaluation. | ![GitHub Repo stars](https://img.shields.io/github/stars/spring-ai-alibaba/spring-ai-alibaba-admin?style=for-the-badge&label=) | [Spring AI Extensions](https://github.com/spring-ai-alibaba/spring-ai-extensions) | Extended implementations for Spring AI core concepts, including DashScopeChatModel, MCP registry, etc. | ![GitHub Repo stars](https://img.shields.io/github/stars/spring-ai-alibaba/spring-ai-extensions?style=for-the-badge&label=) | [Spring AI Alibaba Examples](https://github.com/spring-ai-alibaba/examples) | Spring AI Alibaba Examples. | ![GitHub Repo stars](https://img.shields.io/github/stars/spring-ai-alibaba/examples?style=for-the-badge&label=) | [JManus](https://github.com/spring-ai-alibaba/jmanus) | A Java implementation of Manus built with Spring AI Alibaba, currently used in many applications within Alibaba Group. | ![GitHub Repo stars](https://img.shields.io/github/stars/spring-ai-alibaba/jmanus?style=for-the-badge&label=) | [DataAgent](https://github.com/spring-ai-alibaba/dataagent) | A natural language to SQL project based on Spring AI Alibaba, enabling you to query databases directly with natural language without writing complex SQL. | ![GitHub Repo stars](https://img.shields.io/github/stars/spring-ai-alibaba/dataagent?style=for-the-badge&label=) | [DeepResearch](https://github.com/spring-ai-alibaba/deepresearch) | Deep Research implemented based on spring-ai-alibaba-graph. | ![GitHub Repo stars](https://img.shields.io/github/stars/spring-ai-alibaba/deepresearch?style=for-the-badge&label=) ## Contact Us * Dingtalk Group (钉钉群), search `94405033092` and join. * WeChat Group (微信公众号), scan the QR code below and follow us. ## Resources * [AI-Native Application Architecture White Paper](https://developer.aliyun.com/ebook/8479):Co-authored by 40 frontline engineers and endorsed by 15 industry experts, this 200,000+ word white paper is the first comprehensive guide dedicated to the full DevOps lifecycle of AI-native applications. It systematically breaks down core concepts and key challenges, offering practical problem-solving approaches and architectural insights. ## Star History [![Star History Chart](https://starchart.cc/alibaba/spring-ai-alibaba.svg?variant=adaptive)](https://starchart.cc/alibaba/spring-ai-alibaba) ---

Made with ❤️ by the Spring AI Alibaba Team