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

阿里的又一个 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());

https://agentscope.io/

Read more

【入门篇】一键搞定 Java 环境配置,从 0 跑出你的第一个程序

【入门篇】一键搞定 Java 环境配置,从 0 跑出你的第一个程序

🎬 博主名称:超级苦力怕 🔥 个人专栏:《Java成长录》《AI 工具使用目录》 🚀 每一次思考都是突破的前奏,每一次复盘都是精进的开始! 前言 本文主要内容:介绍 Java 语言的发展背景、运行架构,以及如何搭建开发环境。 适合人群:尚未入门的 Java 学习者。 阅读收益:看完你将对 Java 有一个初步认知,并完成 JDK + IDEA 的环境搭建,为后续学习变量、数据类型和流程控制打下基础。 文章目录 * 前言 * 1. Java概述 * 1.1 什么是 Java * 2. 环境准备 * 2.1 JDK的配置 * 2.1.1 JDK概述 * 2.1.2 快速下载

Java 时间类(中):JDK8 全新时间 API 详细教程

Java 时间类(中):JDK8 全新时间 API 详细教程

🏠个人主页:黎雁 🎬作者简介:C/C++/JAVA后端开发学习者 ❄️个人专栏:C语言、数据结构(C语言)、EasyX、JAVA、游戏、规划、程序人生 ✨ 从来绝巘须孤往,万里同尘即玉京 文章目录 * Java 时间类(中):JDK8 全新时间 API 详细教程 🕘 * 📝 文章摘要 * 🧠 上篇知识回顾 * 一、JDK8 时间类整体架构 🏛 * 二、ZoneId 时区类 🌍 * 1. 核心作用 * 2. 常用方法 * 3. 代码示例 * 三、Instant 时间戳类 ⚡ * 1. 核心作用 * 2. 常用方法 * 3. 代码示例 * 四、ZonedDateTime

Java foreach在lambda的foreach遍历中退出操作(lambda foreach break)

在 Java 中,我们常用 Collection.forEach()(Lambda 形式)遍历集合,但会发现一个问题:Lambda forEach 中无法直接使用 break 或 continue 关键字(因为 break 是用于跳出循环语句块,而 Lambda 表达式是一个函数式接口实现,并非循环语句块本身)。 本文将详细讲解:如何在 Lambda forEach 中实现类似 break 的退出效果,以及 Java 中其他常见的循环退出操作,帮你彻底理清遍历退出的各种场景。 一、先明确:Lambda forEach 中无法直接使用 break/continue 首先要强调一个核心结论:Collection.forEach(Consumer) 中的 Lambda 表达式,无法直接使用

【IntelliJ IDEA 】常用配置与使用技巧(1) 创建你的第一个Java工程项目

【IntelliJ IDEA 】常用配置与使用技巧(1) 创建你的第一个Java工程项目

🚀 个人主页 极客小俊 ✍🏻 作者简介:程序猿、设计师、技术分享 🐋 希望大家多多支持, 我们一起学习和进步! 🏅 欢迎评论 ❤️点赞💬评论 📂收藏 📂加关注 首先我们来了解一下在IntelliJ IDEA中的工程结构: 使用IntelliJ IDEA创建的项目工程是一个分层结构 具体是从外到内分别为:工程project-->模块model--->包package–>类java class 所以IntelliJ IDEA当中创建一个项目工程也是从外到内来进行创建的! 如图 那么熟悉了IntelliJ IDEA的项目工程管理结构之后,现在我们就可以开始新建项目了 ! 创建项目 这里我们就来创建一个Java空项目 我们先创建一个空Java项目文件目录,这里我创建在D盘, 路径为D:\java_demo\intellij_demo 然后打开打开IntelliJ IDEA 点击new Project 如图 接下来选择左边的Java, 然后再右侧Project SDK中选择之前安装好的JDK版本路径,有的时候软件会自动帮你监测到,