Interface DistributedStore
- All Known Implementing Classes:
DistributedStore.CompositeDistributedStore
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—CosDistributedStoreagentscope-extensions-jdbc—JdbcDistributedStoreagentscope-extensions-mongodb—MongoDistributedStoreagentscope-extensions-oss—OssDistributedStoreagentscope-extensions-redis—RedisDistributedStore
Priority: explicit builder methods (.stateStore(), .filesystem())
take precedence over distributedStore for the components they configure.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classBuilder for composing aDistributedStorefrom individual components.static final recordA distributed store composed from individually specified components. -
Method Summary
Modifier and TypeMethodDescriptionio.agentscope.core.state.AgentStateStoreCreates theAgentStateStorefor agent session state persistence.default AsyncToolRegistryCreates anAsyncToolRegistryfor tracking async tool executions.Creates theBaseStorefor workspace filesystem KV storage.static DistributedStore.Builderbuilder()Creates a builder for composing aDistributedStorefrom individual components, potentially sourced from different store implementations.default MessageBusCreates aMessageBusfor inbox-based message delivery and session event streaming.default SandboxExecutionGuardCreates theSandboxExecutionGuardfor distributed sandbox concurrency control.default SandboxSnapshotSpecCreates theSandboxSnapshotSpecfor sandbox snapshot persistence.default SessionTurnGateCreates aSessionTurnGatefor distributed per-session turn serialization.default TaskRepositoryCreates aTaskRepositoryfor distributed subagent background tasks.default TeamClientCreates aTeamClientfor AgentTeams coordination.
-
Method Details
-
agentStateStore
io.agentscope.core.state.AgentStateStore agentStateStore()Creates theAgentStateStorefor agent session state persistence.- Returns:
- a distributed agent state store; must not be
null
-
baseStore
BaseStore baseStore()Creates theBaseStorefor workspace filesystem KV storage.- Returns:
- a distributed base store; must not be
null
-
sandboxSnapshotSpec
Creates theSandboxSnapshotSpecfor sandbox snapshot persistence.Override this when the store supports binary blob storage suitable for Docker sandbox snapshots. The default returns
NoopSnapshotSpec(no snapshots).- Returns:
- a sandbox snapshot spec; must not be
null
-
sandboxExecutionGuard
Creates theSandboxExecutionGuardfor distributed sandbox concurrency control.Override this when the store supports distributed locking. The default returns a no-op guard (no cross-node coordination).
- Returns:
- a sandbox execution guard; must not be
null
-
messageBus
Creates aMessageBusfor inbox-based message delivery and session event streaming.Override this when the store supports real-time transport (e.g. Redis Pub/Sub). The default returns
null, which signals HarnessAgent to fall back to a workspace-backed implementation created from the resolvedAbstractFilesystem.- Returns:
- a message bus, or
nullto use the workspace default
-
asyncToolRegistry
Creates anAsyncToolRegistryfor tracking async tool executions.Override this when the store supports persistent key-value storage. The default returns
null, which signals HarnessAgent to fall back to a workspace-backed implementation.- Returns:
- an async tool registry, or
nullto use the workspace default
-
taskRepository
Creates aTaskRepositoryfor distributed subagent background tasks.Override this when the store supports hosted task persistence (e.g. control-plane
/api/v1/dp/tasks/*). The default returnsnull, which signals HarnessAgent to fall back to a workspace-backedWorkspaceTaskRepository.- Returns:
- a task repository, or
nullto use the workspace default
-
sessionTurnGate
Creates aSessionTurnGatefor distributed per-session turn serialization.Override this when the store supports hosted locks (e.g. control-plane
/api/v1/dp/locks/*). The default returnsnull, which signals HarnessAgent to use the gateway's built-inLocalSessionTurnGate.When a distributed turn gate is used, configure
ReActAgentconflictPolicytoFAILso concurrent state writes surface as errors rather than silent overwrites.- Returns:
- a session turn gate, or
nullto use the process-local default
-
teamClient
Creates aTeamClientfor AgentTeams coordination.Override when the store hosts team task/message APIs (control plane) or can back a local CAS client. The default returns
null.- Returns:
- a team client, or
nullwhen teams mode is unavailable
-
builder
Creates a builder for composing aDistributedStorefrom individual components, potentially sourced from different store implementations.Example — MySQL for state and files, Redis for sandbox:
DistributedStore mysql = MysqlDistributedStore.create(dataSource); DistributedStore redis = RedisDistributedStore.fromJedis(jedis); DistributedStore mixed = DistributedStore.builder() .agentStateStore(mysql.agentStateStore()) .baseStore(mysql.baseStore()) .sandboxSnapshotSpec(redis.sandboxSnapshotSpec()) .sandboxExecutionGuard(redis.sandboxExecutionGuard()) .build();- Returns:
- a new builder
-