Build Agents in a Safer Environment

Agent Sandbox

Quickstart

Spin up an isolated sandbox and run code in a few lines with the SDK.


from k8s_agent_sandbox import SandboxClient

client = SandboxClient()

sandbox = client.create_sandbox(
    warmpool="example-sandbox-pool",
    namespace="default",
)
try:
    result = sandbox.commands.run("echo 'Hello from Agent Sandbox!'")
    print(result.stdout)
    # Hello from Agent Sandbox!
finally:
    sandbox.terminate()
  

Read the full Python SDK quickstart →


package main
import (
	"context"
	"fmt"
	"log"

	"sigs.k8s.io/agent-sandbox/clients/go/sandbox"
)
func main() {
	ctx := context.Background()

	// Connect to your cluster and ensure sandboxes are cleaned up.
	client, err := sandbox.NewClient(ctx, sandbox.Options{
		WarmPoolName: "example-sandbox-pool",
		Namespace:    "default",
	})
	if err != nil {
		log.Fatal(err)
	}
	defer client.DeleteAll(ctx)

	// Create a sandbox and run a command.
	// CreateSandbox arguments take precedence over options passed with Options
	
	sb, err := client.CreateSandbox(ctx, "example-sandbox-pool", "default")
	if err != nil {
		log.Print(err)
		return
	}
	result, err := sb.Run(ctx, "echo 'Hello from the sandbox!'")
	if err != nil {
		log.Print(err)
		return
	}
	fmt.Println(result.Stdout)
}
  

Read the full Go SDK quickstart →

Agent Sandbox provides a secure and isolated execution layer to safely deploy autonomous AI agents on Kubernetes that generate and run untrusted code at scale.

Use Cases

Enable Complex Agentic Workloads

Safely execute arbitrary, untrusted code in a fully isolated environment to enable high-risk applications like stateful code interpretation, agentic web browsing, complex "computer use" tasks, and sophisticated data analysis

Decoupled Isolation. Built for Choice

Interoperability is core to Agent Sandbox with a standardized Kubernetes API that fully decouples the execution layer from the underlying isolation technology. This abstraction supports various backends, including gVisor and Kata Containers, allowing you to select the isolation method that perfectly aligns with your specific security, performance, and workload needs

Contributions welcome!

We do a Pull Request contributions workflow on GitHub.

Read more

Connect with us

Talk to contributors on #agent-sandbox channel

Read more

Join the mailing group

Join the conversation on the mailing group

Read more