AS AgentScopeAPI 手册 / API Reference

Builder

final class Builder
源码Source io/agentscope/harness/agent/DistributedStore.java:207–323

构建器,用于构建并配置目标实例。位于 io.agentscope.harness.agent 包。核心成员包括 agentStateStore、baseStore、sandboxSnapshotSpec、sandboxExecutionGuard、messageBus、asyncToolRegistry。

Builder for composing a DistributedStore from individual components.

方法摘要Method Summary

方法Method说明Description
public Builder agentStateStore(AgentStateStore agentStateStore)
设置智能体状态存储。
Sets the agent state store component.
public Builder baseStore(BaseStore baseStore)
设置基类存储。
Sets the base store component for workspace filesystem KV.
public Builder sandboxSnapshotSpec(SandboxSnapshotSpec sandboxSnapshotSpec)
设置沙箱快照规格。
Sets the sandbox snapshot spec.
public Builder sandboxExecutionGuard(SandboxExecutionGuard sandboxExecutionGuard)
设置沙箱执行守卫。
Sets the sandbox execution guard for distributed concurrency control.
public Builder messageBus(MessageBus messageBus)
设置消息总线。
Performs the message bus operation.
public Builder asyncToolRegistry(AsyncToolRegistry asyncToolRegistry)
设置异步工具注册表。
Performs the async tool registry operation.
public Builder taskRepository(TaskRepository taskRepository)
设置任务仓库。
Performs the task repository operation.
public Builder sessionTurnGate(SessionTurnGate sessionTurnGate)
设置该配置项。
Sets the session turn gate for distributed per-session turn serialization.
public Builder teamClient(TeamClient teamClient)
设置AgentTeams 客户端。
Sets the AgentTeams client.
public DistributedStore build()
构建并返回最终实例。
Builds the composite `DistributedStore`.

方法详情Method Detail

agentStateStore

public Builder agentStateStore(AgentStateStore agentStateStore)

设置智能体状态存储。

Sets the agent state store component.

参数Parameters
名称Name类型Type说明Description
agentStateStoreAgentStateStore状态存储到使用。the state store to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/harness/agent/DistributedStore.java:227–230

baseStore

public Builder baseStore(BaseStore baseStore)

设置基类存储。

Sets the base store component for workspace filesystem KV.

参数Parameters
名称Name类型Type说明Description
baseStoreBaseStore基类存储到使用。the base store to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/harness/agent/DistributedStore.java:238–241

sandboxSnapshotSpec

public Builder sandboxSnapshotSpec(SandboxSnapshotSpec sandboxSnapshotSpec)

设置沙箱快照规格。

Sets the sandbox snapshot spec.

参数Parameters
名称Name类型Type说明Description
sandboxSnapshotSpecSandboxSnapshotSpec快照规格到使用。the snapshot spec to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/harness/agent/DistributedStore.java:249–252

sandboxExecutionGuard

public Builder sandboxExecutionGuard(SandboxExecutionGuard sandboxExecutionGuard)

设置沙箱执行守卫。

Sets the sandbox execution guard for distributed concurrency control.

参数Parameters
名称Name类型Type说明Description
sandboxExecutionGuardSandboxExecutionGuard执行守卫到使用。the execution guard to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/harness/agent/DistributedStore.java:260–263

messageBus

public Builder messageBus(MessageBus messageBus)

设置消息总线。

Performs the message bus operation.

参数Parameters
名称Name类型Type说明Description
messageBusMessageBus消息总线(类型 `MessageBus`)。The message bus.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/agent/DistributedStore.java:265–268

asyncToolRegistry

public Builder asyncToolRegistry(AsyncToolRegistry asyncToolRegistry)

设置异步工具注册表。

Performs the async tool registry operation.

参数Parameters
名称Name类型Type说明Description
asyncToolRegistryAsyncToolRegistry异步工具注册表(类型 `AsyncToolRegistry`)。The async tool registry.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/agent/DistributedStore.java:270–273

taskRepository

public Builder taskRepository(TaskRepository taskRepository)

设置任务仓库。

Performs the task repository operation.

参数Parameters
名称Name类型Type说明Description
taskRepositoryTaskRepository任务仓库(类型 `TaskRepository`)。The task repository.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/agent/DistributedStore.java:275–278

sessionTurnGate

public Builder sessionTurnGate(SessionTurnGate sessionTurnGate)

设置该配置项。

Sets the session turn gate for distributed per-session turn serialization.

参数Parameters
名称Name类型Type说明Description
sessionTurnGateSessionTurnGate会话轮次 Gate(类型 `SessionTurnGate`)。the turn gate to use
返回Returns Builder
返回当前实例,以支持链式调用。this builder
源码Source io/agentscope/harness/agent/DistributedStore.java:286–289

teamClient

public Builder teamClient(TeamClient teamClient)

设置AgentTeams 客户端。

Sets the AgentTeams client.

参数Parameters
名称Name类型Type说明Description
teamClientTeamClient团队客户端(类型 `TeamClient`)。The team client.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/agent/DistributedStore.java:292–295

build

public DistributedStore build()

构建并返回最终实例。

Builds the composite DistributedStore.

返回Returns DistributedStore
返回DistributedStore。a new distributed store composed from the configured components
抛出Throws
  • NullPointerException 当if agentStateStore 或 baseStore是不设置时抛出 `NullPointerException`。if agentStateStore or baseStore is not set
源码Source io/agentscope/harness/agent/DistributedStore.java:303–322
基于官方固定版本源码静态生成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.