AS AgentScopeAPI 手册 / API Reference

SessionSandboxStateStore

public final class SessionSandboxStateStore
源码Source io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:32–103

会话沙箱状态存储,负责持久化与读取数据。位于 io.agentscope.harness.agent.sandbox 包。核心成员包括 load、save、delete、SessionSandboxStateStore。

Sandbox state store backed by the generic AgentScope AgentStateStore abstraction.

This store keeps sandbox lifecycle state in the same state backend as ReActAgent runtime state. As a result, providing a distributed AgentStateStore implementation (for example Redis) automatically enables distributed sandbox resume state.

构造器摘要Constructor Summary

构造器Constructor说明Description
public SessionSandboxStateStore(AgentStateStore stateStore, String agentId)
初始化 `SessionSandboxStateStore` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Optional<String> load(SandboxIsolationKey key) throws IOException
从持久化存储恢复数据。
Performs the load operation.
public void save(SandboxIsolationKey key, String json) throws IOException
保存数据到持久化存储。
Performs the save operation.
public void delete(SandboxIsolationKey key) throws IOException
删除数据。
Performs the delete operation.

构造器详情Constructor Detail

SessionSandboxStateStore

public SessionSandboxStateStore(AgentStateStore stateStore, String agentId)

初始化 SessionSandboxStateStore 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
stateStoreAgentStateStore状态存储(类型 `AgentStateStore`)。The state store.
agentIdString智能体标识(类型 `String`)。The agent id.
源码Source io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:39–42

方法详情Method Detail

load

public Optional<String> load(SandboxIsolationKey key) throws IOException

从持久化存储恢复数据。

Performs the load operation.

参数Parameters
名称Name类型Type说明Description
keySandboxIsolationKey键(类型 `SandboxIsolationKey`)。The key.
返回Returns Optional<String>
返回可选。Returns optional.
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:44–56

save

public void save(SandboxIsolationKey key, String json) throws IOException

保存数据到持久化存储。

Performs the save operation.

参数Parameters
名称Name类型Type说明Description
keySandboxIsolationKey键(类型 `SandboxIsolationKey`)。The key.
jsonStringJSON(类型 `String`)。The json.
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:58–65

delete

public void delete(SandboxIsolationKey key) throws IOException

删除数据。

Performs the delete operation.

参数Parameters
名称Name类型Type说明Description
keySandboxIsolationKey键(类型 `SandboxIsolationKey`)。The key.
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:67–76
基于官方固定版本源码静态生成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.