AS AgentScopeAPI 手册 / API Reference

SandboxClient

public interface SandboxClient<O extends SandboxClientOptions>
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:25–48

定义沙箱客户端契约的接口。位于 io.agentscope.harness.agent.sandbox 包。核心成员包括 create、resume、delete、serializeState、deserializeState。

Factory for creating and resuming Sandbox instances.

方法摘要Method Summary

方法Method说明Description
public Sandbox create(WorkspaceSpec workspaceSpec, SandboxSnapshotSpec snapshotSpec, O options)
创建并返回实例。
Creates a new sandbox with the given workspace spec and snapshot spec.
public Sandbox resume(SandboxState state)
设置恢复。
Resumes a sandbox from previously serialized `SandboxState`.
public void delete(Sandbox sandbox)
删除数据。
Performs the delete operation.
public String serializeState(SandboxState state)
执行状态。
Performs the serialize state operation.
public SandboxState deserializeState(String json)
执行状态。
Performs the deserialize state operation.
default public SandboxState deserializeState(String json, SandboxSnapshotSpec snapshotSpec)
default
执行状态。
Performs the deserialize state operation.

方法详情Method Detail

create

public Sandbox create(WorkspaceSpec workspaceSpec, SandboxSnapshotSpec snapshotSpec, O options)

创建并返回实例。

Creates a new sandbox with the given workspace spec and snapshot spec.

参数Parameters
名称Name类型Type说明Description
workspaceSpecWorkspaceSpec工作区规格(类型 `WorkspaceSpec`)。The workspace spec.
snapshotSpecSandboxSnapshotSpec快照规格(类型 `SandboxSnapshotSpec`)。The snapshot spec.
optionsO选项(类型 `O`)。The options.
返回Returns Sandbox
返回沙箱。Returns sandbox.
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:32

resume

public Sandbox resume(SandboxState state)

设置恢复。

Resumes a sandbox from previously serialized SandboxState.

参数Parameters
名称Name类型Type说明Description
stateSandboxState状态对象(类型 `SandboxState`)。The state.
返回Returns Sandbox
返回沙箱。Returns sandbox.
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:37

delete

public void delete(Sandbox sandbox)

删除数据。

Performs the delete operation.

参数Parameters
名称Name类型Type说明Description
sandboxSandbox沙箱(类型 `Sandbox`)。The sandbox.
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:39

serializeState

public String serializeState(SandboxState state)

执行状态。

Performs the serialize state operation.

参数Parameters
名称Name类型Type说明Description
stateSandboxState状态对象(类型 `SandboxState`)。The state.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:41

deserializeState

public SandboxState deserializeState(String json)

执行状态。

Performs the deserialize state operation.

参数Parameters
名称Name类型Type说明Description
jsonStringJSON(类型 `String`)。The json.
返回Returns SandboxState
返回SandboxState。Returns sandbox state.
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:43

deserializeState

default public SandboxState deserializeState(String json, SandboxSnapshotSpec snapshotSpec)
default

执行状态。

Performs the deserialize state operation.

参数Parameters
名称Name类型Type说明Description
jsonStringJSON(类型 `String`)。The json.
snapshotSpecSandboxSnapshotSpec快照规格(类型 `SandboxSnapshotSpec`)。The snapshot spec.
返回Returns SandboxState
返回SandboxState。Returns sandbox state.
源码Source io/agentscope/harness/agent/sandbox/SandboxClient.java:45–47
基于官方固定版本源码静态生成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.