AS AgentScopeAPI 手册 / API Reference

RemoteSandboxSnapshot

@JsonIgnoreProperties(ignoreUnknown = true) public class RemoteSandboxSnapshot implements SandboxSnapshot
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:35–116

远程沙箱快照,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent.sandbox.snapshot 包,实现 SandboxSnapshot。核心成员包括 persist、restore、isRestorable、getId、getType、RemoteSandboxSnapshot。

Snapshot backed by a RemoteSnapshotClient (e.g. S3, OSS, GCS).

This class delegates all operations to the provided client. The client is responsible for authentication, retry logic, and network error handling.

Note: RemoteSandboxSnapshot is not directly serializable to JSON because RemoteSnapshotClient cannot be serialized. When persisting session state, only the id is needed — the client is re-injected from the builder at resume time.

构造器摘要Constructor Summary

构造器Constructor说明Description
public RemoteSandboxSnapshot(String id)
初始化 `RemoteSandboxSnapshot` 实例。
Creates a new instance.
public RemoteSandboxSnapshot(RemoteSnapshotClient client, String id)
创建远程快照。
Creates a remote snapshot.

方法摘要Method Summary

方法Method说明Description
public void persist(InputStream workspaceArchive) throws Exception
设置该参数。
{@inheritDoc}
public InputStream restore() throws Exception
返回 `restore` 结果。
{@inheritDoc}
public boolean isRestorable() throws Exception
判断是否 `isRestorable`。
{@inheritDoc}
public String getId()
获取标识。
Returns the id.
public String getType()
获取类型。
Returns the type.

构造器详情Constructor Detail

RemoteSandboxSnapshot

public RemoteSandboxSnapshot(String id)

初始化 RemoteSandboxSnapshot 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:41–44

RemoteSandboxSnapshot

public RemoteSandboxSnapshot(RemoteSnapshotClient client, String id)

创建远程快照。

Creates a remote snapshot.

参数Parameters
名称Name类型Type说明Description
clientRemoteSnapshotClient客户端(类型 `RemoteSnapshotClient`)。the remote storage client to delegate operations to
idString标识(类型 `String`)。unique identifier for this snapshot
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:52–55

方法详情Method Detail

persist

public void persist(InputStream workspaceArchive) throws Exception

设置该参数。

{@inheritDoc} Uploads the archive via RemoteSnapshotClient#upload.

参数Parameters
名称Name类型Type说明Description
workspaceArchiveInputStream工作区归档(类型 `InputStream`)。The workspace archive.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:62–69

restore

public InputStream restore() throws Exception

返回 restore 结果。

{@inheritDoc} Downloads the archive via RemoteSnapshotClient#download.

返回Returns InputStream
返回InputStream。Returns input stream.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:76–83

isRestorable

public boolean isRestorable() throws Exception

判断是否 isRestorable。

{@inheritDoc} Checks existence via RemoteSnapshotClient#exists.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
抛出Throws
  • Exception 可能抛出 `Exception`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:90–97

getId

public String getId()

获取标识。

Returns the id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:99–102

getType

public String getType()

获取类型。

Returns the type.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/sandbox/snapshot/RemoteSandboxSnapshot.java:104–107

继承成员Inherited Members

继承自Methods inherited from SandboxSnapshot
基于官方固定版本源码静态生成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.