# yudao-agentscope-java **Repository Path**: jlynet-openSrc/yudao-agentscope-java ## Basic Information - **Project Name**: yudao-agentscope-java - **Description**: AgentScope Java 兼容维护版:为 Spring Boot 2.x / JDK 8 回迁可用能力;main 面向 Java 17+,覆盖 Spring Boot 3.x / 4.x。保留官方 Java 包名,提供独立 Maven 坐标。 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2026-11-23 - **Last Updated**: 2026-11-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README Docker Sandbox 在 JDK 8、17、25 的非 root 容器冷恢复验证中保留了 POSIX 文件模式和脚本可执行位。 发版记录见[芋道变更日志](CHANGELOG-YUDAO.md)。 上游源码已对齐至 `21be74a8a`。共用安装包已在 Boot 3.5.15/JDK 17、Boot 4.2.0/JDK 25 通过 Ollama 工具与文本回归。 Harness 与 AgentRun、Daytona、E2B、Kubernetes 沙箱模块通过工作区权限保留和子 Agent 等待逻辑定向回归。 > 版本命名:保留当前源码基线的官方版本号;共用现代制品不加 JDK 后缀,隔离维护的兼容路线添加 `jdk8` / `jdk17` / `jdk25`。开发版本使用 SNAPSHOT。JDK 路线后缀不等于最低字节码版本,框架依赖仍按 Boot 版本选择。 > 完整版本规则与预览命名见 [VERSIONING.md](VERSIONING.md)。 # yudao-agentscope-java yudao-agentscope-java 是 [AgentScope Java](https://github.com/agentscope-ai/agentscope-java) 的芋道社区兼容维护版本,并非官方发布。主要补充 **Spring Boot 2.x + JDK 8** 支持;`main` 以 JDK 17 为最低目标,由同一份核心和基础 starter 制品验证 Spring Boot 3.x、4.x 与 JDK 17、25,其他扩展仍需逐项验收。 ## 仓库与版本线 | 平台 | 仓库地址 | | --- | --- | | Gitee | [yudao-agentscope-java](https://gitee.com/yudaocode/yudao-agentscope-java) | | GitHub | [yudao-agentscope-java](https://github.com/yudaocode/yudao-agentscope-java) | | 分支 | 目标环境 | 源码开发版本 | Maven Central | 状态 | | --- | --- | --- | --- | --- | | [`main`](https://github.com/yudaocode/yudao-agentscope-java/tree/main) | Boot 3.x / 4.x,JDK 17 / 25 | `2.1.0-SNAPSHOT` | [2.1.0-preview-20261120](https://central.sonatype.com/artifact/cn.iocoder.agentscope/agentscope-bom/2.1.0-preview-20261120) | 核心和基础 starter 已完成同 jar 四组合验证,其他扩展验收中 | | [`main-jdk8`](https://github.com/yudaocode/yudao-agentscope-java/tree/main-jdk8) | Boot 2.x,JDK 8 | `2.1.0-jdk8-SNAPSHOT` | [2.1.0-jdk8-preview-20261120](https://central.sonatype.com/artifact/cn.iocoder.agentscope/agentscope-bom/2.1.0-jdk8-preview-20261120) | 核心、基础与 DashScope starter 已通过 Boot 2.7/JDK 8 验证,其他扩展移植中 | AgentScope 的现代制品由 Boot 3/4 共用,版本不带 JDK 后缀。当前分支:**`main`**。 Maven groupId 为 **`cn.iocoder.agentscope`**,artifactId 和 Java 包名沿用官方。同一个应用只选择一条版本线,同一项目的模块使用同一版本;替换已有依赖时,也要移除对应官方 groupId 下的同类模块,避免重复类。 Boot 3/4 共用的 JDK 17+ 预览版 [2.1.0-preview-20261120](https://central.sonatype.com/artifact/cn.iocoder.agentscope/agentscope-bom/2.1.0-preview-20261120) 已发布到 Maven Central。首批发布范围包括核心、基础 starter 和独立沙箱 SDK。Durable 开发组件、示例以及 Micronaut/Quarkus 扩展待后续发布。 ## 如何使用 在 Boot 3/4 宿主中引入 BOM 和基础 starter。基础 starter 提供配置与装配入口,模型 provider、凭据及 Agent 行为仍需按需配置: ```xml 2.1.0-preview-20261120 cn.iocoder.agentscope agentscope-bom ${yudao-agentscope.version} pom import cn.iocoder.agentscope agentscope-spring-boot-starter ``` 只使用 Java 核心 API 时,可将 starter 换为同 groupId 的 `agentscope-core`;Java 导入仍为 `io.agentscope.*`。模型扩展按实际需要单独引入,不能将核心和基础 starter 的验证结果理解为全部扩展兼容。 Boot 2.7/JDK 8 分支的支持模块、构建与 HTTP 依赖配置见 [Java 8 使用说明](https://github.com/yudaocode/yudao-agentscope-java/blob/main-jdk8/JAVA8-COMPATIBILITY.md)。 独立沙箱 SDK 通过 `cn.iocoder.agentscope:agentscope-runtime-sandbox-core` 按需引入,版本由 AgentScope BOM 管理。Boot 2 使用 `2.1.0-jdk8-SNAPSHOT`,Boot 3/4 共用 `2.1.0-preview-20261120`;不需要引入整个 AgentScope core。使用兼容 SandboxService 管理服务,或配置本机 Docker 与所需沙箱镜像。源码来源、构建、请求超时及资源关闭说明见 [Runtime sandbox 使用说明](agentscope-runtime-sandbox-core/README_zh.md)。外部平台与具体工具服务需按实际环境配置,不能将本地兼容测试理解为所有外部后端均已验收。 共用 `main` 的 `agentscope-extensions-jdbc` 已在 JDK 17 和 25 分别通过 MySQL 8.0 与 PostgreSQL 16 的 16 项 Docker 集成测试,均零跳过。可通过 `mvn -pl :agentscope-extensions-jdbc -am -Pintegration -Dtest=MysqlIntegrationTest,PostgresIntegrationTest -Dsurefire.failIfNoSpecifiedTests=false test` 复验。 共用 `main` 的持久化扩展也已在 JDK 17.0.21 和 25.0.3 各通过 24 项 Docker 测试。MongoDB 7 的索引生命周期、状态版本与存储契约共 22 项,Redis 7 Cluster 的多节点会话枚举与 CAS 共 2 项,均零跳过。这些是扩展模块的直接测试,Boot 3/4 基础 starter 的启动范围见上表。 `agentscope-extensions-rag-simple` 在 JDK 25.0.3 连接 ARM64 Docker 中的 Ollama 0.40.9,使用 `nomic-embed-text` 通过 7 项向量端点测试,零跳过。 ### 从源码构建开发版 需要调试源码时,在 JDK 17 下安装开发版: ```bash git clone -b main https://github.com/yudaocode/yudao-agentscope-java.git cd yudao-agentscope-java mvn -pl agentscope-dependencies-bom,agentscope-distribution/agentscope-bom,agentscope-extensions/agentscope-spring-boot-starters/agentscope-spring-boot-starter -am -DskipTests -Dmaven.javadoc.skip=true install ``` 下方逐字保留官方项目原始 README,其中的官方 Maven 坐标和发布状态仅针对上游项目;使用本兼容版时,以本节坐标、版本线和支持范围为准。 Durable 的本地 JDBC 与 HTTP 后端已用同一套本地安装 JAR 验证。Spring Boot 3.5.15 和 4.1.2 分别在 JDK 17、25 上各通过 2 项测试,覆盖 SQLite 会话与不可变文件跨 Spring 上下文重启,以及 loopback HTTP 写入与读取。 Spring Boot 3.5.15、4.1.2 分别在 JDK 17、25 通过 [Durable RocketMQ 集成测试](compatibility-tests/durable-rocketmq),每组 2 项。测试使用 Docker RocketMQ 5.3.2 与 PostgreSQL 17,覆盖正常投递和独立 worker JVM 在写入工具副作用后被强杀的场景。接替 worker 用原 execution ID 恢复,工具只执行一次,Brain 只应用一次结果。 Spring Boot 3.5.15、4.1.2 各在 JDK 17、25 连接 Docker MinIO,每组通过 [Durable S3 对象存储集成测试](compatibility-tests/durable-minio)两项。用例覆盖同一对象重复写入、更换客户端后读回,以及检测损坏并拒绝覆盖。 ## Ollama starter 按需引入 `cn.iocoder.agentscope:agentscope-ollama-spring-boot-starter`,设置 `agentscope.model.provider=ollama`、`agentscope.ollama.base-url` 和 `agentscope.ollama.model-name`。Boot 2.7 parent 需将 HttpClient 5 和 HttpCore 5 分别对齐到 5.6.5、5.4.4。 使用已安装的 starter 连接 Docker 内的 Ollama 0.40.9。Boot 2.7.18 / JDK 8、Boot 3.5.15 与 Boot 4.1.2 / JDK 17、25 五组均通过非流式和流式文本聊天测试,覆盖文本增量、结束原因和 token 用量。同一矩阵使用 `qwen3:0.6b` 验证自动装配的 ReActAgent 执行 Java 工具,并在最终回答中使用工具返回值。[接入及复验步骤](compatibility-tests/ollama-starter-chat/README.md) ---

AgentScope Logo

[**中文主页**](https://github.com/agentscope-ai/agentscope-java/blob/main/README_zh.md) | [**日本語ホームページ**](https://github.com/agentscope-ai/agentscope-java/blob/main/README_ja.md) | [**Documentation**](https://java.agentscope.io/)

discord docs Maven Central JDK 17+ license Ask DeepWiki

## What is AgentScope Java 2.0? AgentScope Java 2.0 is a production-ready framework for building distributed, enterprise-grade agents, providing essential abstractions that work with rising model capability and built-in support for long-running, safely-controlled agent execution. - [**Event System** →](https://java.agentscope.io/dev/en/docs/building-blocks/message-and-event.html) A unified event stream with 32 typed events for real-time frontend rendering and human-in-the-loop. - [**Permission System** →](https://java.agentscope.io/dev/en/docs/building-blocks/permission-system.html) Tool-call gating: allow / require user approval / deny. - [**Middleware** →](https://java.agentscope.io/dev/en/docs/building-blocks/middleware.html) AOP-style hook interception for flexibly extending the reasoning-acting loop. - [**Workspace & Sandbox** →](https://java.agentscope.io/dev/en/docs/harness/workspace.html) Run tools in isolated environments — local, Docker, Kubernetes, or AgentRun cloud sandbox. - [**Multi-Agent Orchestration** →](https://java.agentscope.io/dev/en/docs/harness/subagent.html) Multiple subagent definition patterns with `agent_spawn` / `agent_send` and real-time event forwarding. - [**Distributed Deployment** →](https://java.agentscope.io/dev/en/docs/others/going-to-production.html) True distributed session and memory management (Redis / MySQL / PostgreSQL / OSS / COS) with cross-replica session recovery. - [**Agent Evolution** →](https://help.aliyun.com/zh/document_detail/3042583.html) Provides Agent observability and auditing, Agent evaluation and experimentation, and Agent asset management and continuous optimization. agentscope ## News - **[2026-07] `v2.0.0 GA`:** First production-ready release! Dual-layer agent architecture, event stream, permission system, middleware, workspace sandbox, multi-agent orchestration, and distributed deployment all ready. [Docs](https://java.agentscope.io/) | [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v2.0.0) - **[2026-07] `v2.0.0-RC5`:** Model provider modularization; unified DataBlock multimodal support; native structured output; Channel IM integration; Tencent Cloud COS state persistence. [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v2.0.0-RC5) - **[2026-06] `v2.0.0-RC4`:** Async tool execution and scheduled wakeup dispatching; subagent cross-replica routing and session recovery. [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v2.0.0-RC4) - **[2026-06] `v2.0.0-RC3`:** Unified `call()` / `streamEvents()` execution core; `AgentResultEvent`, `CustomEvent`, `HintBlockEvent` new event types. [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v2.0.0-RC3) - **[2026-06] `v2.0.0-RC2`:** Fully stateless agent; one-line DistributedBackend; subagent event forwarding; Channel module (DingTalk, Feishu, WeCom); A2A / AG-UI protocol support. [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v2.0.0-RC2) - **[2026-05] `v2.0.0-RC1`:** First 2.0 RC — harness engineering, enterprise distributed deployment, event stream / message model / middleware / HITL full redesign. [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v2.0.0-RC1) - **[2026-05] `v1.1.0`:** Introduced `agentscope-harness` and `HarnessAgent`; Workspace (persona / memory / skills / subagents); pluggable filesystem (local / shared store / sandbox); session persistence with cross-process resume; layered memory and context compaction; declarative subagent orchestration. [Release Notes](https://github.com/agentscope-ai/agentscope-java/releases/tag/v1.1.0-RC1) ## Community Welcome to join our community on | [Discord](https://discord.gg/eYMpfnkG8h) | DingTalk | WeChat | |--------------------------------------------------------------|-----------------------------------------------------------------------|--------------------------------------------------------------| | | | | ## Quickstart ### Installation > AgentScope Java requires **JDK 17** or higher. #### Maven ```xml io.agentscope agentscope-harness 2.0.3 ``` Model providers are shipped as separate extension modules in 2.0. Add the one you need — for example, DashScope: ```xml io.agentscope agentscope-extensions-model-dashscope 2.0.3 ``` Other options: `agentscope-extensions-model-openai`, `agentscope-extensions-model-anthropic`, `agentscope-extensions-model-gemini`, `agentscope-extensions-model-ollama`. See the [Model docs](https://java.agentscope.io/dev/en/docs/building-blocks/model.html) for details. For typed text and image classification, see [OpenAI Decisions](docs/dev/en/integration/judge/openai-decisions.md), available in `2.1.0-SNAPSHOT` builds containing the extension. To use the reasoning and tool APIs of `ReActAgent` and compose application capabilities yourself, depend on `agentscope-core` and your model extension. ## Hello AgentScope! Configure a shared Builder at startup, then use `builder.build()` to create and close an Agent for each request. The same identity and persistent storage keep the conversation across instances. Set `DASHSCOPE_API_KEY` before running: ```java import io.agentscope.core.agent.RuntimeContext; import io.agentscope.core.event.TextBlockDeltaEvent; import io.agentscope.core.event.ToolCallStartEvent; import io.agentscope.core.message.UserMessage; import io.agentscope.harness.agent.HarnessAgent; import java.nio.file.Paths; public class FirstAgent { // Configure once at startup; requests only call build(). private static final HarnessAgent.Builder AGENT_BUILDER = HarnessAgent.builder() .name("assistant") .agentId("assistant") .sysPrompt("You are a helpful AI assistant.") .model("dashscope:qwen-plus") .workspace(Paths.get(".agentscope/workspace")); public static void main(String[] args) { try (HarnessAgent agent = AGENT_BUILDER.build()) { RuntimeContext ctx = RuntimeContext.builder() .sessionId("demo").userId("alice").build(); agent.call(new UserMessage("Hello!"), ctx).block(); } // COMMENT_Summarize today in three bullets. try (HarnessAgent agent = AGENT_BUILDER.build()) { RuntimeContext ctx = RuntimeContext.builder() .sessionId("demo").userId("alice").build(); agent.streamEvents(new UserMessage("Summarize today in three bullets."), ctx) .doOnNext(event -> { switch (event.getType()) { case TEXT_BLOCK_DELTA -> System.out.print( ((TextBlockDeltaEvent) event).getDelta()); case TOOL_CALL_START -> System.out.println( "\n[tool] " + ((ToolCallStartEvent) event).getToolCallName()); default -> { } } }) .blockLast(); } } } ``` Start with `call` / `streamEvents` for ordinary replies, multi-turn chat and workflow steps; follow the [Quick Start](https://java.agentscope.io/dev/en/docs/quickstart). Both also record Harness conversation history by default. Introduce [AgentSession](https://java.agentscope.io/dev/en/docs/harness/session-log) when work must continue after a page closes, queue while busy or resume after interruption. The [recoverable chat example](./agentscope-examples/agents/agentscope-chat/README.md) shows the full integration. ## Key Design AgentScope Java 2.0 is a major step up from a "build an agent" toolkit toward a complete platform for **running agents in production**. The improvements fall into three focus areas: ### 1 · Harness Engineering — built for long-running, complex tasks A bare ReAct loop solves one reasoning turn. **HarnessAgent** layers engineering infrastructure on top of ReActAgent via Middleware and Toolkit channels — the reasoning core stays untouched, capabilities layer on: - **Self-evolution & skill repository** — successful patterns auto-save as Markdown skills, shared across sessions and loaded on demand - **Layered memory** — in-context conversation + agent-curated `MEMORY.md` + on-disk fact log, with auto-compaction to bound the prompt - **Sub-agents** — declare child agent specs in Markdown, `agent_spawn` / `agent_send` at runtime, sync or background delegation - **Auto context management** — structured compaction preserves goals / state / findings / next steps; oversized tool results offload to disk - **Plan Mode** — read-only planning state for long tasks, plan files persist and drive execution ### 2 · Enterprise-grade distributed deployment Production agents must serve many tenants, run untrusted code safely, and survive rolling restarts. AgentScope 2.0 is built for stateless horizontal scaling: - **Multi-tenant isolation** — `session` / `user` / `agent` / `org` dimension isolation, `RuntimeContext` keys flow through workspace paths, KV namespaces, and sandbox state slots - **Secure sandbox** — local subprocess / Docker / Kubernetes / E2B cloud sandbox, with snapshot and resume - **Permission control** — three-state engine (allow / approve / deny), sensitive tools require HITL approval - **Session recovery** — `AgentStateStore` (in-memory / JSON file / MySQL / Redis / PostgreSQL) backs zero-downtime rolling deploys ### 3 · Foundation framework — a leaner, more developer-friendly core Messages, events, and the extension model are smaller, more orthogonal — HITL and event streaming are part of how the framework runs, not add-ons: - **Event stream** — 32 typed events covering model calls, text deltas, tool execution, and user confirmations in real time - **Message model** — text / files / images / audio / video / tool results unified into `ContentBlock`, role-strict validation at construction - **Middleware** — `onAgent` / `onReasoning` / `onActing` / `onModelCall` / `onSystemPrompt` / `onAgentStateReady` six stages replace v1's flat hooks - **HITL first class** — confirm tool arguments, approve sensitive actions, hand off to external systems, agent pauses and resumes exactly For the complete architecture overview, see the [documentation](https://java.agentscope.io/dev/en/docs/index.html). ## Contributing We welcome contributions from the community! Please refer to our [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to contribute. ## License AgentScope is released under Apache License 2.0. ## Contributors All thanks to our contributors: