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 |
|---|---|---|
stateStore | AgentStateStore | 状态存储(类型 `AgentStateStore`)。The state store. |
agentId | String | 智能体标识(类型 `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 |
|---|---|---|
key | SandboxIsolationKey | 键(类型 `SandboxIsolationKey`)。The key. |
Optional<String>返回可选。Returns optional.
IOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:44–56save
public void save(SandboxIsolationKey key, String json) throws IOException
保存数据到持久化存储。
Performs the save operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | SandboxIsolationKey | 键(类型 `SandboxIsolationKey`)。The key. |
json | String | JSON(类型 `String`)。The json. |
IOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:58–65delete
public void delete(SandboxIsolationKey key) throws IOException
删除数据。
Performs the delete operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
key | SandboxIsolationKey | 键(类型 `SandboxIsolationKey`)。The key. |
IOException可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source
io/agentscope/harness/agent/sandbox/SessionSandboxStateStore.java:67–76