AS AgentScopeAPI 手册 / API Reference

DockerSandboxState

public class DockerSandboxState extends SandboxState
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:30–257

Docker 沙箱状态,承载智能体的部署、调度与服务化运行。位于 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.

返回Returns String
返回字符串结果。container ID, or `null` if the container has not been created yet
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:70–72

setContainerId

public void setContainerId(String containerId)

设置容器标识。

Sets the Docker container ID.

参数Parameters
名称Name类型Type说明Description
containerIdString容器标识(类型 `String`)。Docker container ID
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:79–81

getContainerName

public String getContainerName()

返回容器名称。

Returns the container name.

返回Returns String
返回字符串结果。container name
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:88–90

setContainerName

public void setContainerName(String containerName)

设置容器名称。

Sets the container name.

参数Parameters
名称Name类型Type说明Description
containerNameString容器名称(类型 `String`)。container name
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:97–99

getImage

public String getImage()

获取图像。

Returns the Docker image used for this container.

返回Returns String
返回字符串结果。Docker image
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:106–108

setImage

public void setImage(String image)

设置图像。

Sets the Docker image.

参数Parameters
名称Name类型Type说明Description
imageString图像(类型 `String`)。Docker image
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:115–117

getWorkspaceRoot

public String getWorkspaceRoot()

获取工作区根。

Returns the workspace root path inside the container.

返回Returns String
返回字符串结果。workspace root path
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:124–126

setWorkspaceRoot

public void setWorkspaceRoot(String workspaceRoot)

设置工作区根。

Sets the workspace root path inside the container.

参数Parameters
名称Name类型Type说明Description
workspaceRootString工作区根(类型 `String`)。absolute path inside the container
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:133–135

isContainerOwned

public boolean isContainerOwned()

判断是否 isContainerOwned。

Returns whether the SDK owns the container lifecycle.

返回Returns boolean
返回布尔值,表示判断结果。`true` if the SDK manages container creation and removal
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:142–144

setContainerOwned

public void setContainerOwned(boolean containerOwned)

设置 setContainerOwned。

Sets whether the SDK owns the container lifecycle.

参数Parameters
名称Name类型Type说明Description
containerOwnedboolean容器 Owned(类型 `boolean`)。`true` if the SDK should stop and remove the container on shutdown
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:151–153

getMemorySizeBytes

public Long getMemorySizeBytes()

返回可选记忆限制 in 字节。

Returns the optional memory limit in bytes.

返回Returns Long
返回数值结果。memory limit or `null`
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:160–162

setMemorySizeBytes

public void setMemorySizeBytes(Long memorySizeBytes)

设置记忆限制 in 字节。

Sets the memory limit in bytes.

参数Parameters
名称Name类型Type说明Description
memorySizeBytesLong记忆大小字节(类型 `Long`)。memory limit
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:169–171

getCpuCount

public Long getCpuCount()

返回可选 CPU 数量限制。

Returns the optional CPU count limit.

返回Returns Long
返回数值结果。CPU count or `null`
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:178–180

setCpuCount

public void setCpuCount(Long cpuCount)

设置CPU 数量限制。

Sets the CPU count limit.

参数Parameters
名称Name类型Type说明Description
cpuCountLongCPUs的数量。number of CPUs
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:187–189

getExposedPorts

public int[] getExposedPorts()

获取 getExposedPorts。

Returns the exposed port numbers.

返回Returns int[]
返回int[]。port numbers array
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:196–198

setExposedPorts

public void setExposedPorts(int[] exposedPorts)

设置 setExposedPorts。

Sets the exposed port numbers.

参数Parameters
名称Name类型Type说明Description
exposedPortsint[]exposed Ports(类型 `int[]`)。port numbers
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:205–207

getNetwork

public String getNetwork()

获取 getNetwork。

Returns the docker network mode or network name.

返回Returns String
返回字符串结果。docker network value, or `null` when unset
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:214–216

setNetwork

public void setNetwork(String network)

设置 setNetwork。

Sets the docker network mode or network name.

参数Parameters
名称Name类型Type说明Description
networkStringnetwork(类型 `String`)。docker network value
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:223–230

getAdditionalRunArgs

public List<String> getAdditionalRunArgs()

获取 getAdditionalRunArgs。

Returns additional raw arguments appended to docker run.

返回Returns List<String>
返回列出。additional docker run arguments
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:237–239

setAdditionalRunArgs

public void setAdditionalRunArgs(List<String> additionalRunArgs)

设置 setAdditionalRunArgs。

Sets additional raw arguments appended to docker run.

参数Parameters
名称Name类型Type说明Description
additionalRunArgsList<String>additional 运行参数(类型 `List`)。additional docker run arguments
源码Source io/agentscope/harness/agent/sandbox/impl/docker/DockerSandboxState.java:246–256

继承成员Inherited Members

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.