chickenlj/agentscope-runtime-java

A Runtime Framework for Agent Deployment and Tool Sandbox. AgentScope Runtime Java Implementation.

โ˜… 0Forks 0GitHub โ†—Compare

README

AgentScope Runtime for Java

License GitHub Stars GitHub Forks Maven central DingTalk

[Python Cookbook]

AgentScope Runtime Java

This is the java implementation of AgentScope Runtime. Please notice that this project is still experimental and under active development.


โœจ Key Features

  • Deployment Infrastructure: Built-in services for session management, memory, and sandbox environment control
  • Sandboxed Tool Execution: Isolated sandboxes ensure safe tool execution without system compromise
  • Developer Friendly: Simple deployment with powerful customization options
  • ๐Ÿšง Framework Agnostic: Not tied to any specific framework. Works seamlessly with popular open-source agent frameworks and custom implementations
  • ๐Ÿšง Observability: Comprehensive tracing and monitoring for runtime operations

๐Ÿ’ฌ Contact

Welcome to join our community on

DingTalk

๐Ÿ“‹ Table of Contents


๐Ÿš€ Quick Start

Prerequisites

  • Java 17+

Build from Source

mvn clean install -DskipTests

Add Dependency

<dependency>
	<groupId>io.agentscope</groupId>
	<artifactId>agentscope-runtime</artifactId>
	<version>0.1.0-SNAPSHOT</version>
</dependency>

Basic Agent Usage Example

The source code of the following example can be found in the examples directory.

This example demonstrates how to delegate a simple Spring AI Alibaba ReactAgent using AgentScope Runtime Agent.

public static void main(String[] args) {
	try {
		// Create Spring AI Alibaba ReactAgent Builder
		Builder builder = ReactAgent.builder()
			.name("saa_agent")
			.model(chatModel);

		// Create runtime agent proxy using the ReactAgent Builder
		SaaAgent saaAgent = SaaAgent.builder()
			.name("saa_agent_proxy")
			.description("An agent powered by Spring AI Alibaba ReactAgent")
			.reactAgentBuilder(builder)
			.build();

		// Create Runner with the SaaAgent
		Runner runner = new Runner(saaAgent, contextManager);

		// Create AgentRequest
		AgentRequest request = createAgentRequest("Hello, can you tell me a joke?");

		// Execute the agent and handle the response stream
		Flux<Event> eventStream = runner.streamQuery(request);

		eventStream.subscribe(
			event -> handleEvent(event),
			error -> System.err.println("Error occurred: " + error.getMessage()),
			() -> System.out.println("Conversation completed.")
		);

		// Wait a bit for async execution (in real applications, you'd handle this properly)
		Thread.sleep(5000);
	} catch (Exception e) {
		e.printStackTrace();
	}
}

Note

Supporting for AgentScope and other agents coming soon ...

Basic Sandbox Usage Example

Developers can tell the agent to use a specific tool and the execution of the tool will be delegated to the sandbox managed by AgentScope Runtime.

SaaAgent saaAgent = SaaAgent.builder()
	.name("saa_agent_proxy")
	.tools(List.of("run_python"))
	.description("An agent powered by Spring AI Alibaba ReactAgent.")
	.reactAgentBuilder(builder) //
	.build();

Runner runner = new Runner(saaAgent, contextManager);
AgentRequest request = createAgentRequest("What is the 8th number of Fibonacci?");
Flux<Event> eventStream = runner.streamQuery(request);

Note

Current version requires Docker to be installed and running on your system. Please refer to this tutorial for more details.

๐Ÿ”Œ Agent Framework Integration

AgentScope Runtime Java implementation currently can automatically load Agents developed using Spring AI Alibaba. More agent framework integrations coming soon!


๐Ÿ—๏ธ Deployment

AgentScope Java can expose Agents on a port in the form of standard A2A protocol.

Change the port through the application.yml file:

server:
  port: 8090

Run io.agentscope.runtime.engine.deployer.LocalDeployer to start the A2A server.


๐Ÿค Contributing

We welcome contributions from the community! Here's how you can help:

๐Ÿ› Bug Reports

  • Use GitHub Issues to report bugs
  • Include detailed reproduction steps
  • Provide system information and logs

๐Ÿ’ก Feature Requests

  • Discuss new ideas in GitHub Discussions
  • Follow the feature request template
  • Consider implementation feasibility

๐Ÿ”ง Code Contributions

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For detailed contributing guidelines, please see CONTRIBUTE.


Contributors

chickenlj

Issues