阿里的又一个 AI 开源项目 AgentScope

https://github.com/agentscope-ai/agentscope-java

AgentScope Java is an agent-oriented programming framework for building LLM-powered applications. It provides everything you need to create intelligent agents: ReAct reasoning, tool calling, memory management, multi-agent collaboration, and more.
AgentScope Java是一个面向智能体编程的框架,用于构建基于大语言模型(LLM)的应用程序。它提供了创建智能代理所需的所有功能:ReAct推理、工具调用、记忆管理、多智能体协作等。
🎯 Smart Agents, Full Control
AgentScope adopts the ReAct (Reasoning-Acting) paradigm, enabling agents to autonomously plan and execute complex tasks. Unlike rigid workflow-based approaches, ReAct agents dynamically decide which tools to use and when, adapting to changing requirements in real-time.
However, autonomy without control is a liability in production. AgentScope provides comprehensive runtime intervention mechanisms:
- Safe Interruption - Pause agent execution at any point while preserving full context and tool state, enabling seamless resumption without data loss
- Graceful Cancellation - Terminate long-running or unresponsive tool calls without corrupting agent state, allowing immediate recovery and redirection
- Human-in-the-Loop - Inject corrections, additional context, or guidance at any reasoning step through the Hook system, maintaining human oversight over critical decisions
AgentScope采用ReAct(推理-行动)范式,使智能体能够自主规划并执行复杂任务。与基于固定工作流的方法不同,ReAct智能体可动态决定工具的使用时机,实时适应需求变化。
但在生产环境中,不受控的自主性可能带来风险。AgentScope提供全面的运行时干预机制:
安全中断 - 随时暂停智能体执行,完整保留上下文和工具状态,实现无数据丢失的断点续传 优雅终止 - 中止长时间运行或无响应的工具调用,不破坏智能体状态,支持即时恢复和任务重定向 人在回路 - 通过Hook系统在任何推理步骤注入修正指令、补充上下文或指导建议,确保人类对关键决策的监督权
🛠️ Built-in Tools
AgentScope includes production-ready tools that address common challenges in agent development:
- PlanNotebook - A structured task management system that decomposes complex objectives into ordered, trackable steps. Agents can create, modify, pause, and resume multiple concurrent plans, ensuring systematic execution of multi-step workflows.
- Structured Output - A self-correcting output parser that guarantees type-safe responses. When LLM output deviates from the expected format, the system automatically detects errors and guides the model to produce valid output, mapping results directly to Java POJOs without manual parsing.
- Long-term Memory - Persistent memory storage with semantic search capabilities across sessions. Supports automatic management, agent-controlled recording, or hybrid modes. Enables multi-tenant isolation for enterprise deployments where agents serve multiple users independently.
- RAG (Retrieval-Augmented Generation) - Seamless integration with enterprise knowledge bases. Supports both self-hosted embedding-based retrieval and managed services like Alibaba Cloud Bailian, grounding agent responses in authoritative data sources.
AgentScope 包含一系列生产级工具,可解决智能体开发中的常见挑战:
PlanNotebook(计划笔记本) - 结构化任务管理系统,将复杂目标分解为可追踪的有序步骤。支持智能体创建、修改、暂停和恢复多个并行计划,确保多步骤工作流的系统化执行。
Structured Output(结构化输出) - 具备自校正功能的输出解析器,保障类型安全的响应。当大语言模型输出偏离预期格式时,系统自动检测错误并引导模型生成有效输出,结果可直接映射到Java POJO对象,无需人工解析。
Long-term Memory(长期记忆) - 支持跨会话语义检索的持久化记忆存储。提供自动管理、智能体控制记录及混合模式三种管理方式。满足企业级多租户隔离需求,使智能体能够独立服务不同用户。
RAG(检索增强生成) - 与企业知识库无缝集成。既支持基于自托管嵌入向量的检索方案,也兼容阿里云百炼等托管服务,确保智能体响应基于权威数据源。
🔌 Seamless Integration
AgentScope is designed to integrate with existing enterprise infrastructure without requiring extensive modifications:
- MCP Protocol - Integrate with any MCP-compatible server to instantly extend agent capabilities. Connect to the growing ecosystem of MCP tools and services—from file systems and databases to web browsers and code interpreters—without writing custom integration code.
- A2A Protocol - Enable distributed multi-agent collaboration through standard service discovery. Register agent capabilities to Nacos or similar registries, allowing agents to discover and invoke each other as naturally as calling microservices.
🔌 无缝集成
AgentScope旨在无需大规模改造即可与现有企业基础设施集成:
MCP协议 - 与任何兼容MCP协议的服务器集成,即时扩展智能体能力。接入日益壮大的MCP工具和服务生态(从文件系统、数据库到网页浏览器和代码解释器),无需编写定制化集成代码。
A2A协议 - 通过标准服务发现实现分布式多智能体协作。将智能体能力注册至Nacos或类似注册中心,使智能体之间能像调用微服务般自然地发现并调用彼此。
JDK 版本最低 17
<dependency> <groupId>io.agentscope</groupId> <artifactId>agentscope</artifactId> <version>1.0.4</version> </dependency>ReActAgent agent = ReActAgent.builder() .name("Assistant") .sysPrompt("You are a helpful AI assistant.") .model(DashScopeChatModel.builder() .apiKey(System.getenv("DASHSCOPE_API_KEY")) .modelName("qwen-max") .build()) .build(); Msg response = agent.call(Msg.builder() .textContent("Hello!") .build()).block(); System.out.println(response.getTextContent());