agentscope-java README

The project's README from github.com/agentscope-ai/agentscope-java. As one markdown file: README.md.

AgentScope Logo

中文主页 | 日本語ホームページ | Documentation

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.

agentscope

News

Community

Welcome to join our community on

Discord DingTalk WeChat

Quickstart

Installation

AgentScope Java requires JDK 17 or higher.

Maven

<dependency>
    <groupId>io.agentscope</groupId>
    <artifactId>agentscope-harness</artifactId>
    <version>2.0.3</version>
</dependency>

Model providers are shipped as separate extension modules in 2.0. Add the one you need — for example, DashScope:

<dependency>
    <groupId>io.agentscope</groupId>
    <artifactId>agentscope-extensions-model-dashscope</artifactId>
    <version>2.0.3</version>
</dependency>

Other options: agentscope-extensions-model-openai, agentscope-extensions-model-anthropic, agentscope-extensions-model-gemini, agentscope-extensions-model-ollama. See the Model docs for details.

For typed text and image classification, see OpenAI Decisions, 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:

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. Both also record Harness conversation history by default. Introduce AgentSession when work must continue after a page closes, queue while busy or resume after interruption. The recoverable chat example 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:

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:

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:

For the complete architecture overview, see the documentation.

Contributing

We welcome contributions from the community! Please refer to our CONTRIBUTING.md for guidelines on how to contribute.

License

AgentScope is released under Apache License 2.0.

Contributors

All thanks to our contributors:

agentscope-java (agentscope-ai/agentscope-java)

Searching Database…

What is this?AgentScope Java 2.0 is a production-ready Java framework for building distributed, enterprise-grade AI agents that handle long-running, complex tasks safely, with built-in multi-agent orchestration, sandboxing, and human-in-the-loop control.
Is it a bare agent library or a full platform?It is layered: 'agentscope-core' gives you a plain ReActAgent, 'HarnessAgent' adds production engineering (memory, sub-agents, middleware) on top, and the optional AgentScope Service adds a control-plane dashboard for managing many agents across different runtimes.
How do I add it to a Java project?Add the AgentScope Maven dependency plus the model-provider extension module you need (for example dashscope, openai, anthropic, gemini, or ollama). If you only want a bare ReActAgent without workspace, persistence, or sandbox, you can depend on 'agentscope-core' alone.
What do I need installed before I start?You need JDK 17 or higher and Maven to build with it; running the full distributed/enterprise features additionally requires a backing store such as Redis, MySQL, PostgreSQL, OSS, or COS.
What's involved in running this at full capability?Core agent code is simple, but enterprise features like multi-tenant isolation, secure sandboxing, and zero-downtime session recovery need extra infrastructure — Docker or Kubernetes for sandboxes, plus Redis/MySQL/PostgreSQL for distributed state.
Who is this aimed at?It's aimed at Java teams building production agents that must scale across replicas, serve multiple tenants, and run untrusted tool code safely — not at hobbyists wanting a quick single-process chatbot.
What is AgentScope Service?It is an optional Agent Control Plane and Dashboard for registering, discovering, and coordinating agents across runtimes — including AgentScope, LangChain, ADK, and Claude/Qoder — from a single place.
What does the self-evolution skill repository do?Successful task patterns are auto-saved as Markdown 'skills' that are shared across sessions and loaded on demand, letting agents improve over repeated runs without retraining.
How does human-in-the-loop approval work here?The permission system has three states per tool call — allow, require approval, or deny — so sensitive actions pause and surface through the event stream for a human to confirm before executing.
Can an agent delegate work to sub-agents?Yes. Agents declare child agent specs in Markdown and use 'agentspawn'/'agentsend' at runtime to delegate work synchronously or in the background, with events forwarded in real time across replicas.
Size
62.9 MB
Stars
6.4K
Age
1y
Commits · 90 Days