Class DockerSandboxClientOptions
java.lang.Object
io.agentscope.harness.agent.sandbox.SandboxClientOptions
io.agentscope.harness.agent.sandbox.impl.docker.DockerSandboxClientOptions
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadditionalRunArgs(String... additionalRunArgs) Appends additional raw arguments todocker runbefore the image name.Sets the CPU count limit.Creates aDockerSandboxClientfor these options.exposedPorts(int... exposedPorts) Sets the host ports to expose from the container.Returns additional raw arguments appended todocker run.Returns the optional CPU count limit.Returns the container environment variables.int[]Returns the host ports to expose.getImage()Returns the Docker image name.Returns the optional memory limit in bytes.Returns the docker network mode or network name.getType()Returns the type discriminator used in JSON serialization.Returns the workspace root path inside the container.Sets the Docker image name.memorySizeBytes(Long memorySizeBytes) Sets the memory limit in bytes.Sets the docker network mode or network name.voidsetAdditionalRunArgs(List<String> additionalRunArgs) Sets the additional raw arguments appended todocker run.voidsetCpuCount(Long cpuCount) Sets the CPU count limit.voidsetEnvironment(Map<String, String> environment) Sets the container environment variables.voidsetExposedPorts(int[] exposedPorts) Sets the host ports to expose from the container.voidSets the Docker image name.voidsetMemorySizeBytes(Long memorySizeBytes) Sets the memory limit in bytes.voidsetNetwork(String network) Sets the docker network mode or network name.voidsetWorkspaceRoot(String workspaceRoot) Sets the workspace root path inside the container.workspaceRoot(String workspaceRoot) Sets the workspace root path inside the container.
-
Constructor Details
-
DockerSandboxClientOptions
public DockerSandboxClientOptions()
-
-
Method Details
-
getType
Description copied from class:SandboxClientOptionsReturns the type discriminator used in JSON serialization.- Specified by:
getTypein classSandboxClientOptions- Returns:
- type string (e.g. "docker")
-
createClient
Creates aDockerSandboxClientfor these options.- Specified by:
createClientin classSandboxClientOptions- Returns:
- new Docker sandbox client
-
getImage
Returns the Docker image name.- Returns:
- Docker image
-
image
Sets the Docker image name.- Parameters:
image- Docker image (e.g.python:3.12-slim)- Returns:
- this options instance
-
setImage
Sets the Docker image name.- Parameters:
image- Docker image
-
getWorkspaceRoot
Returns the workspace root path inside the container.- Overrides:
getWorkspaceRootin classSandboxClientOptions- Returns:
- workspace root
-
workspaceRoot
Sets the workspace root path inside the container.- Parameters:
workspaceRoot- absolute path inside the container- Returns:
- this options instance
-
setWorkspaceRoot
Sets the workspace root path inside the container.- Parameters:
workspaceRoot- absolute path inside the container
-
getEnvironment
Returns the container environment variables.- Returns:
- environment variable map
-
setEnvironment
Sets the container environment variables.- Parameters:
environment- key-value pairs
-
getMemorySizeBytes
Returns the optional memory limit in bytes.- Returns:
- memory limit or
nullif not set
-
memorySizeBytes
Sets the memory limit in bytes.- Parameters:
memorySizeBytes- memory limit (e.g.512 * 1024 * 1024L)- Returns:
- this options instance
-
setMemorySizeBytes
Sets the memory limit in bytes.- Parameters:
memorySizeBytes- memory limit in bytes
-
getCpuCount
Returns the optional CPU count limit.- Returns:
- CPU count or
nullif not set
-
cpuCount
Sets the CPU count limit.- Parameters:
cpuCount- number of CPUs (e.g.2L)- Returns:
- this options instance
-
setCpuCount
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
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
Returns the docker network mode or network name.- Returns:
- docker network value, or
nullwhen unset
-
network
Sets the docker network mode or network name.- Parameters:
network- docker network value- Returns:
- this options instance
-
setNetwork
Sets the docker network mode or network name.- Parameters:
network- docker network value
-
getAdditionalRunArgs
Returns additional raw arguments appended todocker run.- Returns:
- additional docker run arguments
-
additionalRunArgs
Appends additional raw arguments todocker runbefore the image name.- Parameters:
additionalRunArgs- additional docker run arguments- Returns:
- this options instance
-
setAdditionalRunArgs
Sets the additional raw arguments appended todocker run.- Parameters:
additionalRunArgs- additional docker run arguments
-