AS AgentScopeAPI 手册 / API Reference

Builder

public static final class Builder
源码Source io/agentscope/harness/coding/CodingBootstrap.java:352–780

构建器,用于构建并配置目标实例。位于 io.agentscope.harness.coding 包。核心成员包括 cwd、configPath、skipConfigFile、model、abstractFilesystem、mainAgent。

A class in io.agentscope.harness.coding that deploys, schedules and serves agents. Declared in io.agentscope.harness.coding.

方法摘要Method Summary

方法Method说明Description
public Builder cwd(Path cwd)
设置该配置项。
Performs the cwd operation.
public Builder configPath(Path configPath)
设置配置路径。
Performs the config path operation.
public Builder skipConfigFile(boolean skip)
设置该配置项。
Performs the skip config file operation.
public Builder model(Model model)
设置模型。
Performs the model operation.
public Builder abstractFilesystem(AbstractFilesystem filesystem)
设置抽象文件系统。
Performs the abstract filesystem operation.
public Builder mainAgent(String agentId)
设置主智能体。
Performs the main agent operation.
public Builder agent(String agentId, HarnessAgent agent)
设置智能体。
Performs the agent operation.
public Builder configureAgent(String agentId, Consumer<HarnessAgent.Builder> customizer)
设置该配置项。
Performs the configure agent operation.
public Builder channel(Channel... channels)
设置渠道。
Performs the channel operation.
public Builder withDualCodingAgents(io.agentscope.core.tool.Toolkit codingToolkit, io.agentscope.core.tool.Toolkit reviewerToolkit)
设置该配置项。
Convenience method: registers the coding and reviewer agents using their respective factories (`CodingAgentFactory` / `ReviewerAgentFactory`).
public Builder withDualCodingAgents(io.agentscope.core.tool.Toolkit codingToolkit, io.agentscope.core.tool.Toolkit reviewerToolkit, BaseStore store)
设置该配置项。
Same as `#withDualCodingAgents(io.agentscope.core.tool.Toolkit, io.agentscope.core.tool.Toolkit)` but additionally registers the open-swe-style middleware stack (`MessageQueueMiddleware`, `ThreadBudgetMiddleware`, `ModelCallLimitMiddleware`) on both agents when `store` is non-null.
public CodingBootstrap build() throws IOException
构建并返回最终实例。
Assembles all agents and channels, wires the internal gateway, and returns a fully initialized `CodingBootstrap`.

方法详情Method Detail

cwd

public Builder cwd(Path cwd)

设置该配置项。

Performs the cwd operation.

参数Parameters
名称Name类型Type说明Description
cwdPathcwd(类型 `Path`)。The cwd.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:367–370

configPath

public Builder configPath(Path configPath)

设置配置路径。

Performs the config path operation.

参数Parameters
名称Name类型Type说明Description
configPathPath配置路径(类型 `Path`)。The config path.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:372–375

skipConfigFile

public Builder skipConfigFile(boolean skip)

设置该配置项。

Performs the skip config file operation.

参数Parameters
名称Name类型Type说明Description
skipbooleanskip(类型 `boolean`)。The skip.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:377–380

model

public Builder model(Model model)

设置模型。

Performs the model operation.

参数Parameters
名称Name类型Type说明Description
modelModel模型实例(类型 `Model`)。The model.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:382–385

abstractFilesystem

public Builder abstractFilesystem(AbstractFilesystem filesystem)

设置抽象文件系统。

Performs the abstract filesystem operation.

参数Parameters
名称Name类型Type说明Description
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:387–390

mainAgent

public Builder mainAgent(String agentId)

设置主智能体。

Performs the main agent operation.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:392–395

agent

public Builder agent(String agentId, HarnessAgent agent)

设置智能体。

Performs the agent operation.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
agentHarnessAgent智能体(类型 `HarnessAgent`)。The agent.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:397–402

configureAgent

public Builder configureAgent(String agentId, Consumer<HarnessAgent.Builder> customizer)

设置该配置项。

Performs the configure agent operation.

参数Parameters
名称Name类型Type说明Description
agentIdString智能体标识(类型 `String`)。The agent id.
customizerConsumer<HarnessAgent.Builder>customizer(类型 `Consumer`)。The customizer.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:404–409

channel

public Builder channel(Channel... channels)

设置渠道。

Performs the channel operation.

参数Parameters
名称Name类型Type说明Description
channels varargsChannel...渠道(类型 `Channel...`)。The channels.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:411–419

withDualCodingAgents

public Builder withDualCodingAgents(io.agentscope.core.tool.Toolkit codingToolkit, io.agentscope.core.tool.Toolkit reviewerToolkit)

设置该配置项。

Convenience method: registers the coding and reviewer agents using their respective factories (CodingAgentFactory / ReviewerAgentFactory).

参数Parameters
名称Name类型Type说明Description
codingToolkitio.agentscope.core.tool.Toolkitcoding 工具包(类型 `io.agentscope.core.tool.Toolkit`)。toolkit for the coding agent (may be null for empty)
reviewerToolkitio.agentscope.core.tool.Toolkitreviewer 工具包(类型 `io.agentscope.core.tool.Toolkit`)。toolkit for the reviewer agent (may be null for empty)
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:431–435

withDualCodingAgents

public Builder withDualCodingAgents(io.agentscope.core.tool.Toolkit codingToolkit, io.agentscope.core.tool.Toolkit reviewerToolkit, BaseStore store)

设置该配置项。

Same as #withDualCodingAgents(io.agentscope.core.tool.Toolkit, io.agentscope.core.tool.Toolkit) but additionally registers the open-swe-style middleware stack (MessageQueueMiddleware, ThreadBudgetMiddleware, ModelCallLimitMiddleware) on both agents when store is non-nu…

参数Parameters
名称Name类型Type说明Description
codingToolkitio.agentscope.core.tool.Toolkitcoding 工具包(类型 `io.agentscope.core.tool.Toolkit`)。The coding toolkit.
reviewerToolkitio.agentscope.core.tool.Toolkitreviewer 工具包(类型 `io.agentscope.core.tool.Toolkit`)。The reviewer toolkit.
storeBaseStore存储实例(类型 `BaseStore`)。The store.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:445–497

build

public CodingBootstrap build() throws IOException

构建并返回最终实例。

Assembles all agents and channels, wires the internal gateway, and returns a fully initialized CodingBootstrap.

返回Returns CodingBootstrap
返回CodingBootstrap。Returns coding bootstrap.
抛出Throws
  • IOException 可能抛出 `IOException`。Thrown when the operation cannot be completed.
源码Source io/agentscope/harness/coding/CodingBootstrap.java:575–722
基于官方固定版本源码静态生成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.