AS AgentScopeAPI 手册 / API Reference

DistributedStore

public interface DistributedStore
源码Source 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.

返回Returns AgentStateStore
一种分布式智能体状态存储;必须不为`null`。a distributed agent state store; must not be `null`
源码Source io/agentscope/harness/agent/DistributedStore.java:81

baseStore

public BaseStore baseStore()

创建BaseStore用于工作区文件系统 KV 存储。

Creates the BaseStore for workspace filesystem KV storage.

返回Returns BaseStore
一种分布式基类存储;必须不为`null`。a distributed base store; must not be `null`
源码Source io/agentscope/harness/agent/DistributedStore.java:88

sandboxSnapshotSpec

default public SandboxSnapshotSpec sandboxSnapshotSpec()
default

创建SandboxSnapshotSpec用于沙箱快照持久化。

Creates the SandboxSnapshotSpec for sandbox snapshot persistence.

返回Returns SandboxSnapshotSpec
一种沙箱快照规格;必须不为`null`。a sandbox snapshot spec; must not be `null`
源码Source io/agentscope/harness/agent/DistributedStore.java:98–100

sandboxExecutionGuard

default public SandboxExecutionGuard sandboxExecutionGuard()
default

返回沙箱执行守卫。

Creates the SandboxExecutionGuard for distributed sandbox concurrency control.

返回Returns SandboxExecutionGuard
一种沙箱执行守卫;必须不为`null`。a sandbox execution guard; must not be `null`
源码Source io/agentscope/harness/agent/DistributedStore.java:110–112

messageBus

default public MessageBus messageBus()
default

返回消息总线。

Creates a MessageBus for inbox-based message delivery and session event streaming.

返回Returns MessageBus
一种消息总线,或`null`到使用工作区默认。a message bus, or `null` to use the workspace default
源码Source io/agentscope/harness/agent/DistributedStore.java:123–125

asyncToolRegistry

default public AsyncToolRegistry asyncToolRegistry()
default

返回异步工具注册表。

Creates an AsyncToolRegistry for tracking async tool executions.

返回Returns AsyncToolRegistry
一种异步工具注册表,或`null`到使用工作区默认。an async tool registry, or `null` to use the workspace default
源码Source io/agentscope/harness/agent/DistributedStore.java:135–137

taskRepository

default public TaskRepository taskRepository()
default

返回任务仓库。

Creates a TaskRepository for distributed subagent background tasks.

返回Returns TaskRepository
一种任务仓库,或`null`到使用工作区默认。a task repository, or `null` to use the workspace default
源码Source io/agentscope/harness/agent/DistributedStore.java:148–150

sessionTurnGate

default public SessionTurnGate sessionTurnGate()
default

返回 sessionTurnGate 结果。

Creates a SessionTurnGate for distributed per-session turn serialization.

返回Returns SessionTurnGate
返回SessionTurnGate。a session turn gate, or `null` to use the process-local default
源码Source io/agentscope/harness/agent/DistributedStore.java:165–167

teamClient

default public TeamClient teamClient()
default

返回团队客户端。

Creates a TeamClient for AgentTeams coordination.

返回Returns TeamClient
返回TeamClient。a team client, or `null` when teams mode is unavailable
源码Source io/agentscope/harness/agent/DistributedStore.java:177–179

builder

static public Builder builder()
static

返回构建器实例。

Creates a builder for composing a DistributedStore from individual components, potentially sourced from different store implementations.

返回Returns Builder
一种新的构建器。a new builder
源码Source io/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.

基于官方固定版本源码静态生成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.