DockerSandboxState
public class DockerSandboxState extends SandboxState
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:30–257Docker 沙箱状态,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent.sandbox.impl.docker 包,继承自 SandboxState。核心成员包括 getContainerId、setContainerId、getContainerName、setContainerName、getImage、setImage。
Serializable state for a Docker-backed io.agentscope.harness.agent.sandbox.Sandbox.
Persisted after each call to enable transparent container resume. If the container
identified by #containerId is still alive on resume, the sandbox reconnects. If
it is stopped, it is restarted. If it has been removed, a new container is created and the
workspace is restored from snapshot.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getContainerId() | 获取容器标识。 Returns the Docker container ID. |
public void setContainerId(String containerId) | 设置容器标识。 Sets the Docker container ID. |
public String getContainerName() | 返回容器名称。 Returns the container name. |
public void setContainerName(String containerName) | 设置容器名称。 Sets the container name. |
public String getImage() | 获取图像。 Returns the Docker image used for this container. |
public void setImage(String image) | 设置图像。 Sets the Docker image. |
public String getWorkspaceRoot() | 获取工作区根。 Returns the workspace root path inside the container. |
public void setWorkspaceRoot(String workspaceRoot) | 设置工作区根。 Sets the workspace root path inside the container. |
public boolean isContainerOwned() | 判断是否 `isContainerOwned`。 Returns whether the SDK owns the container lifecycle. |
public void setContainerOwned(boolean containerOwned) | 设置 `setContainerOwned`。 Sets whether the SDK owns the container lifecycle. |
public Long getMemorySizeBytes() | 返回可选记忆限制 in 字节。 Returns the optional memory limit in bytes. |
public void setMemorySizeBytes(Long memorySizeBytes) | 设置记忆限制 in 字节。 Sets the memory limit in bytes. |
public Long getCpuCount() | 返回可选 CPU 数量限制。 Returns the optional CPU count limit. |
public void setCpuCount(Long cpuCount) | 设置CPU 数量限制。 Sets the CPU count limit. |
public int[] getExposedPorts() | 获取 `getExposedPorts`。 Returns the exposed port numbers. |
public void setExposedPorts(int[] exposedPorts) | 设置 `setExposedPorts`。 Sets the exposed port numbers. |
public String getNetwork() | 获取 `getNetwork`。 Returns the docker network mode or network name. |
public void setNetwork(String network) | 设置 `setNetwork`。 Sets the docker network mode or network name. |
public List<String> getAdditionalRunArgs() | 获取 `getAdditionalRunArgs`。 Returns additional raw arguments appended to `docker run`. |
public void setAdditionalRunArgs(List<String> additionalRunArgs) | 设置 `setAdditionalRunArgs`。 Sets additional raw arguments appended to `docker run`. |
方法详情Method Detail
getContainerId
public String getContainerId()
获取容器标识。
Returns the Docker container ID.
Stringio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:70–72setContainerId
public void setContainerId(String containerId)
设置容器标识。
Sets the Docker container ID.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerId | String | 容器标识(类型 `String`)。Docker container ID |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:79–81getContainerName
public String getContainerName()
返回容器名称。
Returns the container name.
Stringio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:88–90setContainerName
public void setContainerName(String containerName)
设置容器名称。
Sets the container name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerName | String | 容器名称(类型 `String`)。container name |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:97–99getImage
public String getImage()
获取图像。
Returns the Docker image used for this container.
Stringio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:106–108setImage
public void setImage(String image)
设置图像。
Sets the Docker image.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
image | String | 图像(类型 `String`)。Docker image |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:115–117getWorkspaceRoot
public String getWorkspaceRoot()
获取工作区根。
Returns the workspace root path inside the container.
Stringio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:124–126setWorkspaceRoot
public void setWorkspaceRoot(String workspaceRoot)
设置工作区根。
Sets the workspace root path inside the container.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workspaceRoot | String | 工作区根(类型 `String`)。absolute path inside the container |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:133–135isContainerOwned
public boolean isContainerOwned()
判断是否 isContainerOwned。
Returns whether the SDK owns the container lifecycle.
booleanio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:142–144setContainerOwned
public void setContainerOwned(boolean containerOwned)
设置 setContainerOwned。
Sets whether the SDK owns the container lifecycle.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
containerOwned | boolean | 容器 Owned(类型 `boolean`)。`true` if the SDK should stop and remove the container on shutdown |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:151–153getMemorySizeBytes
public Long getMemorySizeBytes()
返回可选记忆限制 in 字节。
Returns the optional memory limit in bytes.
Longio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:160–162setMemorySizeBytes
public void setMemorySizeBytes(Long memorySizeBytes)
设置记忆限制 in 字节。
Sets the memory limit in bytes.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
memorySizeBytes | Long | 记忆大小字节(类型 `Long`)。memory limit |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:169–171getCpuCount
public Long getCpuCount()
返回可选 CPU 数量限制。
Returns the optional CPU count limit.
Longio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:178–180setCpuCount
public void setCpuCount(Long cpuCount)
设置CPU 数量限制。
Sets the CPU count limit.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
cpuCount | Long | CPUs的数量。number of CPUs |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:187–189getExposedPorts
public int[] getExposedPorts()
获取 getExposedPorts。
Returns the exposed port numbers.
int[]io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:196–198setExposedPorts
public void setExposedPorts(int[] exposedPorts)
设置 setExposedPorts。
Sets the exposed port numbers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
exposedPorts | int[] | exposed Ports(类型 `int[]`)。port numbers |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:205–207getNetwork
public String getNetwork()
获取 getNetwork。
Returns the docker network mode or network name.
Stringio/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:214–216setNetwork
public void setNetwork(String network)
设置 setNetwork。
Sets the docker network mode or network name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
network | String | network(类型 `String`)。docker network value |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:223–230getAdditionalRunArgs
public List<String> getAdditionalRunArgs()
获取 getAdditionalRunArgs。
Returns additional raw arguments appended to docker run.
List<String>io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:237–239setAdditionalRunArgs
public void setAdditionalRunArgs(List<String> additionalRunArgs)
设置 setAdditionalRunArgs。
Sets additional raw arguments appended to docker run.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
additionalRunArgs | List<String> | additional 运行参数(类型 `List`)。additional docker run arguments |
io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:246–256