Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 2.21 KB

README.md

File metadata and controls

63 lines (45 loc) · 2.21 KB

Runtime Java Client

Java runtime client for OpenKruise Agents, providing data plane operations (command execution, filesystem, code interpreter).

Installation

<dependency>
    <groupId>io.openkruise</groupId>
    <artifactId>agents-client-runtime</artifactId>
    <version>0.6.0</version>
</dependency>

Overview

Class Description
RuntimeConfig Runtime connection configuration with Builder pattern, supports custom OkHttpClient
RuntimeClient Unified entry point: commands, files, codeInterpreter
Commands Command execution within the sandbox
Filesystem File operations within the sandbox
CodeInterpreter Code execution within the sandbox

Quick Start

K8s Direct Connect

Connect directly to a sandbox in a K8s cluster, bypassing the E2B control plane:

import io.openkruise.agents.client.runtime.*;

RuntimeConfig config = new RuntimeConfig.Builder()
    .domain("sandbox-gateway.sandbox-system.svc:7788")
    .scheme("http")
    .build();

try (RuntimeClient client = RuntimeClient.newFromK8s("default", "your-sandbox-name", config)) {
    // Execute command
    CommandResult result = client.commands.run("uname -a");
    System.out.println(result.getStdout());

    // File operations
    client.files.writeText("/tmp/test.txt", "Hello!");
    String content = client.files.readText("/tmp/test.txt");

    // Code interpreter
    Execution exec = client.codeInterpreter.runCode("print('Hello from Python!')");
}

Documentation

Examples