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.1</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.1</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.

If you only need a bare ReActAgent without workspace / persistence / sandbox, depend on agentscope-core alone.

Hello AgentScope!

Start your first agent with AgentScope Java 2.0:

import io.agentscope.core.agent.RuntimeContext;
import io.agentscope.core.message.UserMessage;
import io.agentscope.harness.agent.HarnessAgent;
import java.nio.file.Paths;

public class FirstAgent {
    public static void main(String[] args) {
        HarnessAgent agent = HarnessAgent.builder()
                .name("assistant")
                .sysPrompt("You are a helpful AI assistant.")
                // ModelRegistry resolves the string and reads the matching
                // API-key env var (e.g. OPENAI_API_KEY or DEEPSEEK_API_KEY)
                // automatically.
                // Examples: "openai:gpt-4.1", "openai:o3",
                // "deepseek:deepseek-v4-flash", "dashscope:qwen-plus",
                // "anthropic:claude-sonnet-4-7", "ollama:llama3"
                .model("dashscope:qwen-plus")
                // Or pass a ChatModel object directly:
                // .model(OpenAIChatModel.builder().model("gpt-4.1").build())
                .workspace(Paths.get(".agentscope/workspace"))
                .build();

        RuntimeContext ctx = RuntimeContext.builder()
                .sessionId("demo").userId("alice").build();

        // Blocking call
        agent.call(new UserMessage("Hello!"), ctx).block();

        // Or stream events for real-time UI rendering
        agent.streamEvents(new UserMessage("Summarize today in three bullets."), ctx)
                .doOnNext(event -> {
                    switch (event.getType()) {
                        case TEXT_BLOCK_DELTA -> System.out.print(
                                ((io.agentscope.core.event.TextBlockDeltaEvent) event).getDelta());
                        case TOOL_CALL_START -> System.out.println(
                                "\n[tool] " + ((io.agentscope.core.event.ToolCallStartEvent) event).getToolCallName());
                        default -> { }
                    }
                })
                .blockLast();
    }
}

AgentScope Service

AgentScope Service — an Agent Control Plane built on AgentScope Harness that provides:

agentscope-service-architecture.png

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)

agentic
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
57.4 MB
Stars
6K
Age
1y
Commits · 90 Days