-
Notifications
You must be signed in to change notification settings - Fork 159
Description
Currently, the agent-sandbox project provides a Python SDK (agentic-sandbox-client) that simplifies the lifecycle management and interaction with sandboxes.
However, developers building Go-based AI agents or platform services lack a native Go client to programmatically manage SandboxClaims and execute commands within sandboxes. Since Google ADK provides GO as well, an example code interpreter could give simple use case.
Given that the core controllers and CRDs are already written in Go, providing a Go client would offer better integration for the Kubernetes ecosystem and high-performance agentic applications.
Proposed Solution
Implement a Go client in clients/go/agentic-sandbox-client that provides feature parity with the Python client. The client should abstract the complexities of:
- Lifecycle Management: Creating a SandboxClaim from a SandboxTemplate, waiting for the sandbox to become ready, and ensuring cleanup.
- Connectivity: Automatically handling the connection to the sandbox-router-svc (e.g., via port-forwarding or direct service access).
- Core Execution API: Providing an easy-to-use interface for Run, Read, and Write operations.
Desired API Example
The Go client should feel "native" to Go developers, potentially looking like this:
ctx := context.Background()
client, err := sandbox.NewClient(kubeConfig, sandbox.Options{
Namespace: "default",
TemplateName: "python-runtime-template",
})
if err != nil {
log.Fatal(err)
}
// Ensure cleanup on exit
defer client.Close(ctx)
// Execute a command
result, err := client.Run(ctx, "echo 'Hello from Go!'")
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Stdout)
// File operations
err = client.WriteFile(ctx, "/tmp/test.txt", []byte("data"))
data, err := client.ReadFile(ctx, "/tmp/test.txt")Key Features to Implement
-
Client Struct: A main client handling Kubernetes client-go or controller-runtime interactions.
-
Wait-for-Ready Logic: Polling/Watching the SandboxClaim status until it reaches the Ready phase.
-
Router Communication: Implementation of the protocol used to talk to the sandbox-router (HTTP/gRPC) including necessary tunneling logic.
-
Context Support: Full support for context.Context for timeouts and cancellation.
-
The implementation should reside in a new directory: clients/go/agentic-sandbox-client.
-
It should leverage existing types from api/v1alpha1.
-
Documentation and an example (e.g., examples/go-client-usage) should be included. KI KO