java.lang.Object
io.agentscope.extensions.sandbox.kubernetes.client.SandboxClient
All Implemented Interfaces:
AutoCloseable

public class SandboxClient extends Object implements AutoCloseable
Client for managing agent-sandbox lifecycles.

Mirrors the Python SDK's SandboxClient: creates SandboxClaims against a warm pool, waits for readiness, and returns Sandbox handles for command / file operations.

  • Constructor Details

    • SandboxClient

      public SandboxClient()
    • SandboxClient

      public SandboxClient(SandboxConnectionConfig connectionConfig)
    • SandboxClient

      public SandboxClient(SandboxConnectionConfig connectionConfig, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient)
    • SandboxClient

      public SandboxClient(SandboxConnectionConfig connectionConfig, io.fabric8.kubernetes.client.KubernetesClient kubernetesClient, Duration requestTimeout, Duration perAttemptTimeout)
  • Method Details

    • createSandbox

      public Sandbox createSandbox(CreateSandboxOptions options)
      Creates a sandbox from the given options.
      Parameters:
      options - create options
      Returns:
      sandbox handle
    • createSandbox

      public Sandbox createSandbox(String warmPool)
      Convenience overload matching the Python SDK signature.
      Parameters:
      warmPool - warm pool name
      Returns:
      sandbox handle
    • createSandbox

      public Sandbox createSandbox(String warmPool, String namespace)
      Convenience overload with namespace.
      Parameters:
      warmPool - warm pool name
      namespace - namespace
      Returns:
      sandbox handle
    • getSandbox

      public Sandbox getSandbox(String claimName, String namespace)
      Re-attaches to an existing SandboxClaim.
      Parameters:
      claimName - claim name
      namespace - namespace
      Returns:
      sandbox handle
    • getSandbox

      public Sandbox getSandbox(String claimName, String namespace, long resolveTimeoutSeconds)
      Re-attaches to an existing SandboxClaim.
      Parameters:
      claimName - claim name
      namespace - namespace
      resolveTimeoutSeconds - timeout for name resolution
      Returns:
      sandbox handle
    • listActiveSandboxes

      public List<String> listActiveSandboxes()
      Returns (namespace, claimName) pairs tracked by this client.
      Returns:
      active sandbox keys as namespace/claimName strings
    • listAllSandboxes

      public List<String> listAllSandboxes(String namespace)
      Lists all SandboxClaim names in the cluster for the given namespace.
      Parameters:
      namespace - namespace
      Returns:
      claim names
    • listAllSandboxes

      public List<String> listAllSandboxes(String namespace, String labelSelector)
      Lists SandboxClaim names, optionally filtered by label selector.
      Parameters:
      namespace - namespace
      labelSelector - optional label selector
      Returns:
      claim names
    • deleteSandbox

      public void deleteSandbox(String claimName, String namespace)
      Stops the client-side connection and deletes the Kubernetes claim.
      Parameters:
      claimName - claim name
      namespace - namespace
    • deleteAll

      public void deleteAll()
      Deletes all sandboxes tracked by this client.
    • getSandboxClaimWarmPoolName

      public String getSandboxClaimWarmPoolName(String claimName, String namespace)
      Returns the warm pool name referenced by a claim.
      Parameters:
      claimName - claim name
      namespace - namespace
      Returns:
      warm pool name
    • getK8sHelper

      public K8sHelper getK8sHelper()
    • getConnectionConfig

      public SandboxConnectionConfig getConnectionConfig()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable