An agent-oriented programming framework for building LLM applications in Java.
AgentScope provides a comprehensive toolkit for creating intelligent agents with tool calling, memory management, multi-agent collaboration, and more.
Easy for beginners, powerful for experts.
- Transparent to Developers: Transparency is our FIRST principle. Prompt engineering, API invocation, agent building, workflow orchestration - all visible and controllable. No deep encapsulation or implicit magic.
- Realtime Steering: Native support for realtime interruption and customized handling.
- More Agentic: Support agentic tools management, agentic long-term memory control and agentic RAG, etc.
- Model Agnostic: Programming once, run with all models (DashScope, OpenAI, Anthropic, and more).
- LEGO-style Agent Building: All components are modular and independent.
- Multi-Agent Oriented: Designed for multi-agent, explicit message passing and workflow orchestration with Pipeline support.
- Reactive Architecture: Built on Project Reactor for efficient non-blocking async operations.
- Multimodal Support: Native support for vision, audio, and video content processing.
- Highly Customizable: Tools, prompt, agent, workflow, hooks, and visualization - customization is encouraged everywhere.
AgentScope Java requires JDK 17 or higher.
<dependency>
<groupId>io.agentscope</groupId>
<artifactId>agentscope</artifactId>
<version>1.0.0</version>
</dependency>Start with a basic ReActAgent that replies to user queries!
public static void main(String[] args) {
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 userMessage = Msg.builder()
.textContent("Hello, please introduce yourself.")
.build();
Msg response = agent.call(userMessage).block();
System.out.println("Agent Response: " + response.getTextContent());-
Define Tool
Define a tool class with methods annotated with
@Tool. Here's an exampleSimpleToolsclass with a time tool:public class SimpleTools { @Tool(name = "get_time", description = "Get current time string of a time zone") public String getTime( @ToolParam(name = "zone", description = "Time zone, e.g., Beijing") String zone) { LocalDateTime now = LocalDateTime.now(); return now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); } }
-
Register Tool to ReActAgent
Register the tool class through
Toolkitusing theregisterToolmethod:public static void main(String[] args) { Model model = DashScopeChatModel.builder() .apiKey(System.getenv("DASHSCOPE_API_KEY")) .modelName("qwen-max") .build(); Toolkit toolkit = new Toolkit(); toolkit.registerTool(new SimpleTools()); ReActAgent agent = ReActAgent.builder() .name("Assistant") .sysPrompt("You are a helpful AI assistant.") .model(model) .toolkit(toolkit) .build(); Msg userMessage = Msg.builder() .role(MsgRole.USER) .textContent("Please tell me the current time.") .build(); Msg response = agent.call(userMessage).block(); System.out.println("Agent Response: " + response.getTextContent()); }
- Multi-Agent Pipeline
- State & Session Management
- Multimodal (Vision/Audio)
- Structured Output
- MCP Integration
- RAG
- Planning
- AgentScope Studio
In December, we will further release best practices for context management and reinforcement learning based on Trinity-RFT.
On the technical evolution front, we are continuously exploring more efficient and intelligent context engineering and multi-Agent collaboration paradigms, committed to supporting the construction of more powerful AI applications.
Additionally, addressing the "80/20 rule" characteristic of Agent traffic (where the top 20% of Agents handle 80% of traffic), we will fully advance Serverless architecture, achieving millisecond-level cold starts and hybrid deployment to help developers handle high concurrency while significantly reducing deployment costs and improving efficiency.
AgentScope is released under Apache License 2.0.