Class DockerSandboxClientOptions

java.lang.Object
io.agentscope.harness.agent.sandbox.SandboxClientOptions
io.agentscope.harness.agent.sandbox.impl.docker.DockerSandboxClientOptions

public class DockerSandboxClientOptions extends SandboxClientOptions
Configuration options for the Docker sandbox client.

Describes the Docker container configuration used when creating or resuming a DockerSandbox. The Docker CLI must be available on the host system's PATH.

  • Constructor Details

    • DockerSandboxClientOptions

      public DockerSandboxClientOptions()
  • Method Details

    • getType

      public String getType()
      Description copied from class: SandboxClientOptions
      Returns the type discriminator used in JSON serialization.
      Specified by:
      getType in class SandboxClientOptions
      Returns:
      type string (e.g. "docker")
    • createClient

      public SandboxClient<DockerSandboxClientOptions> createClient()
      Creates a DockerSandboxClient for these options.
      Specified by:
      createClient in class SandboxClientOptions
      Returns:
      new Docker sandbox client
    • getImage

      public String getImage()
      Returns the Docker image name.
      Returns:
      Docker image
    • image

      public DockerSandboxClientOptions image(String image)
      Sets the Docker image name.
      Parameters:
      image - Docker image (e.g. python:3.12-slim)
      Returns:
      this options instance
    • setImage

      public void setImage(String image)
      Sets the Docker image name.
      Parameters:
      image - Docker image
    • getWorkspaceRoot

      public String getWorkspaceRoot()
      Returns the workspace root path inside the container.
      Overrides:
      getWorkspaceRoot in class SandboxClientOptions
      Returns:
      workspace root
    • workspaceRoot

      public DockerSandboxClientOptions workspaceRoot(String workspaceRoot)
      Sets the workspace root path inside the container.
      Parameters:
      workspaceRoot - absolute path inside the container
      Returns:
      this options instance
    • setWorkspaceRoot

      public void setWorkspaceRoot(String workspaceRoot)
      Sets the workspace root path inside the container.
      Parameters:
      workspaceRoot - absolute path inside the container
    • getEnvironment

      public Map<String,String> getEnvironment()
      Returns the container environment variables.
      Returns:
      environment variable map
    • setEnvironment

      public void setEnvironment(Map<String,String> environment)
      Sets the container environment variables.
      Parameters:
      environment - key-value pairs
    • getMemorySizeBytes

      public Long getMemorySizeBytes()
      Returns the optional memory limit in bytes.
      Returns:
      memory limit or null if not set
    • memorySizeBytes

      public DockerSandboxClientOptions memorySizeBytes(Long memorySizeBytes)
      Sets the memory limit in bytes.
      Parameters:
      memorySizeBytes - memory limit (e.g. 512 * 1024 * 1024L)
      Returns:
      this options instance
    • setMemorySizeBytes

      public void setMemorySizeBytes(Long memorySizeBytes)
      Sets the memory limit in bytes.
      Parameters:
      memorySizeBytes - memory limit in bytes
    • getCpuCount

      public Long getCpuCount()
      Returns the optional CPU count limit.
      Returns:
      CPU count or null if not set
    • cpuCount

      public DockerSandboxClientOptions cpuCount(Long cpuCount)
      Sets the CPU count limit.
      Parameters:
      cpuCount - number of CPUs (e.g. 2L)
      Returns:
      this options instance
    • setCpuCount

      public void setCpuCount(Long cpuCount)
      Sets the CPU count limit.
      Parameters:
      cpuCount - number of CPUs
    • getExposedPorts

      public int[] getExposedPorts()
      Returns the host ports to expose.
      Returns:
      exposed ports array
    • exposedPorts

      public DockerSandboxClientOptions exposedPorts(int... exposedPorts)
      Sets the host ports to expose from the container.
      Parameters:
      exposedPorts - port numbers
      Returns:
      this options instance
    • setExposedPorts

      public void setExposedPorts(int[] exposedPorts)
      Sets the host ports to expose from the container.
      Parameters:
      exposedPorts - port numbers
    • getNetwork

      public String getNetwork()
      Returns the docker network mode or network name.
      Returns:
      docker network value, or null when unset
    • network

      public DockerSandboxClientOptions network(String network)
      Sets the docker network mode or network name.
      Parameters:
      network - docker network value
      Returns:
      this options instance
    • setNetwork

      public void setNetwork(String network)
      Sets the docker network mode or network name.
      Parameters:
      network - docker network value
    • getAdditionalRunArgs

      public List<String> getAdditionalRunArgs()
      Returns additional raw arguments appended to docker run.
      Returns:
      additional docker run arguments
    • additionalRunArgs

      public DockerSandboxClientOptions additionalRunArgs(String... additionalRunArgs)
      Appends additional raw arguments to docker run before the image name.
      Parameters:
      additionalRunArgs - additional docker run arguments
      Returns:
      this options instance
    • setAdditionalRunArgs

      public void setAdditionalRunArgs(List<String> additionalRunArgs)
      Sets the additional raw arguments appended to docker run.
      Parameters:
      additionalRunArgs - additional docker run arguments