AgentScope Java vs Spring AI: Which Multi‑Agent Framework Wins for Java Developers?
This article introduces AgentScope, Alibaba's open‑source Java multi‑agent framework, compares its design, advantages, and use cases with Spring AI Alibaba, showcases key features such as ReAct reasoning, built‑in RAG and memory, and provides quick‑start code examples and the project repository.
What is AgentScope?
AgentScope is an open‑source multi‑agent development framework for Java, providing an agent‑centric paradigm that turns large language models (LLMs) into autonomous, collaborative AI workers. It includes built‑in reasoning, tool invocation, memory management, and retrieval‑augmented generation (RAG). Java and Python versions are aligned.
Key technical features
Autonomous reasoning – Implements the ReAct reasoning‑action loop; agents decide when and which tools to use. Safety interrupts and human‑in‑the‑loop hooks allow supervision of critical steps.
Production‑grade tools – PlanNotebook automatically decomposes goals into steps; a structured output parser maps results to Java POJOs; long‑term memory with semantic search enables personalized services.
Ecosystem integration – Native support for the MCP context protocol and the A2A distributed multi‑agent protocol; service discovery via Nacos; seamless calls to external services such as GitHub or weather APIs.
Built‑in RAG – Knowledge module parses PDF/Word/Markdown, splits text, vectorizes, and stores vectors in Milvus, DashVector or other vector databases, reducing hallucinations.
High‑performance runtime – Built on Project Reactor for non‑blocking, high‑concurrency execution suitable for AI‑augmented customer service or data‑analysis assistants.
Quick start
Add the all‑in‑one Maven/Gradle package and the Spring Boot starter.
<!-- Maven core dependency -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope</artifactId>
<version>1.0.4</version>
</dependency>
<!-- Spring Boot starter -->
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope-spring-boot-starter</artifactId>
<version>1.0.4</version>
</dependency>
<!-- OpenAI model dependency (optional) -->
<dependency>
<groupId>com.openai</groupId>
<artifactId>openai-java</artifactId>
</dependency>Example: create a ReAct agent that uses the Qwen‑Plus model.
// Create QwenPlus model
DashScopeChatModel model = DashScopeChatModel.builder()
.apiKey(apiKey)
.modelName("qwen-plus")
.build();
// Build a ReAct agent
ReActAgent agent = ReActAgent.builder()
.name("AI Assistant")
.sysPrompt("You are a friendly AI assistant that answers in one sentence.")
.model(model)
.build();
// Send a message and print the response
Msg response = agent.call(Msg.builder().textContent("Introduce AI in one sentence").build()).block();
System.out.println(response.getTextContent());Output example: Artificial intelligence enables machines to simulate human learning, reasoning, and decision‑making.
Multi‑turn conversation with memory
AgentScope automatically manages conversation memory, so agents remember previous exchanges without explicit context handling.
List<String> questions = new ArrayList<>();
questions.add("My name is Zhang San");
questions.add("I am 25 years old");
questions.add("Summarize my info");
for (String q : questions) {
Msg res = agent.call(Msg.builder().textContent(q).build()).block();
System.out.println("Q: " + q + "
A: " + res.getTextContent() + "
");
}Result: Name Zhang San, age 25.
Multi‑agent collaboration
Define agents with distinct roles (e.g., planner and executor) and let them cooperate to solve complex tasks.
ReActAgent planner = ReActAgent.builder()
.name("Planning Expert")
.sysPrompt("You are an experienced planning expert, good at task decomposition.")
.model(model)
.build();
ReActAgent executor = ReActAgent.builder()
.name("Execution Expert")
.sysPrompt("You are an execution expert, turning plans into concrete steps.")
.model(model)
.build();Project repository
Official Java repository: https://github.com/agentscope-ai/agentscope-java
Supported models include Tongyi Qianwen, DeepSeek, GPT‑4, and locally hosted Ollama models.
Java Backend Technology
Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
