Builder
public static final class Builder
io/agentscope/harness/agent/gateway/GatewayBootstrap.java:176–330构建器,用于构建并配置目标实例。位于 io.agentscope.harness.agent.gateway 包。核心成员包括 agent、mainAgent、channel、configureAllAgents、distributedStore、runtimeContextResolver。
A class in io.agentscope.harness.agent.gateway that deploys, schedules and serves agents. Declared in io.agentscope.harness.agent.gateway.
方法摘要Method Summary
方法详情Method Detail
agent
public Builder agent(String id, HarnessAgent agent)
设置智能体。
Registers a pre-built agent under the given id.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
agent | HarnessAgent | 智能体(类型 `HarnessAgent`)。The agent. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:188–193agent
public Builder agent(String id, Consumer<HarnessAgent.Builder> configurator)
设置智能体。
Registers an agent declared via a builder lambda.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
configurator | Consumer<HarnessAgent.Builder> | configurator(类型 `Consumer`)。The configurator. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:199–209mainAgent
public Builder mainAgent(String id)
设置主智能体。
Sets the main agent id (used as the routing fallback).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
id | String | 标识(类型 `String`)。The id. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:215–218channel
public Builder channel(Channel... channels)
设置渠道。
Registers one or more external channels for gateway management.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channels varargs | Channel... | 渠道(类型 `Channel...`)。The channels. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:221–226configureAllAgents
public Builder configureAllAgents(Consumer<HarnessAgent.Builder> customizer)
设置该配置项。
Applies a customizer to every agent builder created via the lambda-based #agent(String, Consumer) method.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
customizer | Consumer<HarnessAgent.Builder> | customizer(类型 `Consumer`)。The customizer. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:232–235distributedStore
public Builder distributedStore(DistributedStore store)
设置分布式存储。
Sets the distributed store used to build a durable SubagentRegistry, making subagents exposed via expose_to_user resolvable and re-materializable across nodes / restarts.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
store | DistributedStore | 存储实例(类型 `DistributedStore`)。The store. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:244–247runtimeContextResolver
public Builder runtimeContextResolver(ChannelRuntimeContextResolver resolver)
设置运行时上下文解析器。
Sets a ChannelRuntimeContextResolver that supplies / replaces caller RuntimeContext on each Gateway turn before identity fields are applied.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
resolver | ChannelRuntimeContextResolver | 解析器(类型 `ChannelRuntimeContextResolver`)。The resolver. |
Builderio/agentscope/harness/agent/gateway/GatewayBootstrap.java:254–257build
public GatewayBootstrap build()
构建并返回最终实例。
Builds the gateway bootstrap.
GatewayBootstrapIllegalStateException可能抛出 `IllegalStateException`。if no agents are registered
io/agentscope/harness/agent/gateway/GatewayBootstrap.java:264–329