Class Sandbox
java.lang.Object
io.agentscope.extensions.sandbox.kubernetes.client.Sandbox
Handle for a running Sandbox instance. Provides command execution and file I/O
via
commands() and files().
Mirrors the Python SDK's Sandbox class.
-
Constructor Summary
ConstructorsConstructorDescriptionSandbox(String claimName, String sandboxId, String namespace, SandboxConnectionConfig connectionConfig, K8sHelper k8sHelper) Sandbox(String claimName, String sandboxId, String namespace, SandboxConnectionConfig connectionConfig, K8sHelper k8sHelper, Duration requestTimeout, Duration perAttemptTimeout) -
Method Summary
Modifier and TypeMethodDescriptionvoidCloses the client-side connection but leaves the remote Kubernetes resources running.commands()Returns the command executor, or null if the connection has been closed.files()Returns the filesystem API, or null if the connection has been closed.getPodIp()Selects a pod IP from the Sandbox status (prefers IPv4).Fetches the Sandbox object from Kubernetes and retrieves its current pod name.Fetches the sandbox name hash from the status selector label.booleanisActive()Whether the client-side connection is still active.status()Retrieves the current status of the Sandbox.voidPermanently deletes the SandboxClaim and closes the client-side connection.
-
Constructor Details
-
Sandbox
public Sandbox(String claimName, String sandboxId, String namespace, SandboxConnectionConfig connectionConfig, K8sHelper k8sHelper) -
Sandbox
-
-
Method Details
-
claimName
-
sandboxId
-
namespace
-
commands
Returns the command executor, or null if the connection has been closed.- Returns:
- command executor
-
files
Returns the filesystem API, or null if the connection has been closed.- Returns:
- filesystem
-
isActive
public boolean isActive()Whether the client-side connection is still active.- Returns:
- true if active
-
getPodName
Fetches the Sandbox object from Kubernetes and retrieves its current pod name.- Returns:
- pod name
-
getPodIp
Selects a pod IP from the Sandbox status (prefers IPv4).- Returns:
- pod IP or null
-
getSandboxNameHash
Fetches the sandbox name hash from the status selector label.- Returns:
- hash or null
-
status
Retrieves the current status of the Sandbox.- Returns:
- status pair
-
closeConnection
public void closeConnection()Closes the client-side connection but leaves the remote Kubernetes resources running. -
terminate
public void terminate()Permanently deletes the SandboxClaim and closes the client-side connection. Idempotent.
-