DistributedStore
public interface DistributedStore
io/agentscope/harness/agent/DistributedStore.java:74–385定义分布式存储契约的接口。位于 io.agentscope.harness.agent 包。核心成员包括 agentStateStore、baseStore、sandboxSnapshotSpec、sandboxExecutionGuard、messageBus、asyncToolRegistry。
One-stop configuration for distributed and persistent storage components.
Instead of configuring AgentStateStore, BaseStore,
SandboxSnapshotSpec, and SandboxExecutionGuard individually,
pass a single DistributedStore to
HarnessAgent.Builder#distributedStore(DistributedStore):
`// Single store — all components from Redis
DistributedStore store = RedisDistributedStore.fromJedis(jedis);
// Mixed stores — MySQL for state/files, Redis for sandbox lock/snapshot
DistributedStore store = DistributedStore.builder()
.agentStateStore(mysqlStore.agentStateStore())
.baseStore(mysqlStore.baseStore())
.sandboxSnapshotSpec(redisStore.sandboxSnapshotSpec())
.sandboxExecutionGuard(redisStore.sandboxExecutionGuard())
.build();
HarnessAgent.builder()
.distributedStore(store)
.filesystem(new RemoteFilesystemSpec()
.isolationScope(IsolationScope.USER))
.build();
`
distributedStore auto-wires AgentStateStore and sandbox components
(snapshot, execution guard). The workspace filesystem mode (RemoteFilesystemSpec,
DockerFilesystemSpec, etc.) is always configured explicitly by the user via
.filesystem(...).
Implementations are provided by extension modules:
-
agentscope-extensions-cos—CosDistributedStore -
agentscope-extensions-jdbc—JdbcDistributedStore -
agentscope-extensions-mongodb—MongoDistributedStore -
agentscope-extensions-oss—OssDistributedStore -
agentscope-extensions-redis—RedisDistributedStore
Priority: explicit builder methods (.stateStore(), .filesystem())
take precedence over distributedStore for the components they configure.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | 构建器,用于构建并配置目标实例。 Builder for composing a `DistributedStore` from individual components. |
CompositeDistributedStore | 记录record | 承载 Composite 分布式存储数据的记录类型。 A distributed store composed from individually specified components. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public AgentStateStore agentStateStore() | 创建`AgentStateStore`用于智能体会话状态持久化。 Creates the `AgentStateStore` for agent session state persistence. |
public BaseStore baseStore() | 创建`BaseStore`用于工作区文件系统 KV 存储。 Creates the `BaseStore` for workspace filesystem KV storage. |
default public SandboxSnapshotSpec sandboxSnapshotSpec()default | 创建`SandboxSnapshotSpec`用于沙箱快照持久化。 Creates the `SandboxSnapshotSpec` for sandbox snapshot persistence. |
default public SandboxExecutionGuard sandboxExecutionGuard()default | 返回沙箱执行守卫。 Creates the `SandboxExecutionGuard` for distributed sandbox concurrency control. |
default public MessageBus messageBus()default | 返回消息总线。 Creates a `MessageBus` for inbox-based message delivery and session event streaming. |
default public AsyncToolRegistry asyncToolRegistry()default | 返回异步工具注册表。 Creates an `AsyncToolRegistry` for tracking async tool executions. |
default public TaskRepository taskRepository()default | 返回任务仓库。 Creates a `TaskRepository` for distributed subagent background tasks. |
default public SessionTurnGate sessionTurnGate()default | 返回 `sessionTurnGate` 结果。 Creates a `SessionTurnGate` for distributed per-session turn serialization. |
default public TeamClient teamClient()default | 返回团队客户端。 Creates a `TeamClient` for AgentTeams coordination. |
static public Builder builder()static | 返回构建器实例。 Creates a builder for composing a `DistributedStore` from individual components,
potentially sourced from different store implementations. |
方法详情Method Detail
agentStateStore
public AgentStateStore agentStateStore()
创建AgentStateStore用于智能体会话状态持久化。
Creates the AgentStateStore for agent session state persistence.
AgentStateStoreio/agentscope/harness/agent/DistributedStore.java:81baseStore
public BaseStore baseStore()
创建BaseStore用于工作区文件系统 KV 存储。
Creates the BaseStore for workspace filesystem KV storage.
BaseStoreio/agentscope/harness/agent/DistributedStore.java:88sandboxSnapshotSpec
default public SandboxSnapshotSpec sandboxSnapshotSpec()
创建SandboxSnapshotSpec用于沙箱快照持久化。
Creates the SandboxSnapshotSpec for sandbox snapshot persistence.
SandboxSnapshotSpecio/agentscope/harness/agent/DistributedStore.java:98–100sandboxExecutionGuard
default public SandboxExecutionGuard sandboxExecutionGuard()
返回沙箱执行守卫。
Creates the SandboxExecutionGuard for distributed sandbox concurrency control.
SandboxExecutionGuardio/agentscope/harness/agent/DistributedStore.java:110–112messageBus
default public MessageBus messageBus()
返回消息总线。
Creates a MessageBus for inbox-based message delivery and session event streaming.
MessageBusio/agentscope/harness/agent/DistributedStore.java:123–125asyncToolRegistry
default public AsyncToolRegistry asyncToolRegistry()
返回异步工具注册表。
Creates an AsyncToolRegistry for tracking async tool executions.
AsyncToolRegistryio/agentscope/harness/agent/DistributedStore.java:135–137taskRepository
default public TaskRepository taskRepository()
返回任务仓库。
Creates a TaskRepository for distributed subagent background tasks.
TaskRepositoryio/agentscope/harness/agent/DistributedStore.java:148–150sessionTurnGate
default public SessionTurnGate sessionTurnGate()
返回 sessionTurnGate 结果。
Creates a SessionTurnGate for distributed per-session turn serialization.
SessionTurnGateio/agentscope/harness/agent/DistributedStore.java:165–167teamClient
default public TeamClient teamClient()
返回团队客户端。
Creates a TeamClient for AgentTeams coordination.
TeamClientio/agentscope/harness/agent/DistributedStore.java:177–179builder
static public Builder builder()
返回构建器实例。
Creates a builder for composing a DistributedStore from individual components, potentially sourced from different store implementations.
Builderio/agentscope/harness/agent/DistributedStore.java:200–202嵌套类详情Nested Class Detail
Builder
final class Builder构建器,用于构建并配置目标实例。位于 io.agentscope.harness.agent 包。核心成员包括 agentStateStore、baseStore、sandboxSnapshotSpec、sandboxExecutionGuard、messageBus、asyncToolRegistry。
Builder for composing a DistributedStore from individual components.
CompositeDistributedStore
record CompositeDistributedStore( AgentStateStore stateStore, BaseStore store, SandboxSnapshotSpec snapshotSpec, SandboxExecutionGuard executionGuard, MessageBus bus, AsyncToolRegistry toolRegistry, TaskRepository tasks, SessionTurnGate turnGate, TeamClient teams) implements DistributedStore承载 Composite 分布式存储数据的记录类型。位于 io.agentscope.harness.agent 包,实现 DistributedStore。核心成员包括 stateStore、store、snapshotSpec、executionGuard、bus、toolRegistry。
A distributed store composed from individually specified components.