Builder
public static class Builder
io/agentscope/core/a2a/agent/A2aAgent.java:289–441构建器,用于构建并配置目标实例。位于 io.agentscope.core.a2a.agent 包。核心成员包括 name、agentCard、agentCardResolver、a2aAgentConfig、memory、checkRunning。
A class in io.agentscope.core.a2a.agent that supports discovery, delegation and collaboration between agents. Declared in io.agentscope.core.a2a.agent.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder name(String name) | 设置名称的A2aAgent。 Set the name of the A2aAgent. |
public Builder agentCard(AgentCard agentCard) | 设置`AgentCard`用于 A2aAgent。 Set the `AgentCard` for the A2aAgent. |
public Builder agentCardResolver(AgentCardResolver agentCardResolver) | 设置`AgentCardResolver`用于 A2aAgent。 Set the `AgentCardResolver` for the A2aAgent. |
public Builder a2aAgentConfig(A2aAgentConfig a2aAgentConfig) | 设置`A2aAgentConfig`用于 A2aAgent。 Set the `A2aAgentConfig` for the A2aAgent. |
public Builder memory(Memory memory) | 设置`Memory`用于 A2aAgent。 Set the `Memory` for the A2aAgent. |
public Builder checkRunning(boolean checkRunning) | 设置检查运行中。 Set whether to check the running status of the A2aAgent. |
public Builder hook(Hook hook) | 设置钩子。 Add a `Hook` to the A2aAgent. |
public Builder hooks(List<Hook> hooks) | 设置该配置项。 Add multiple `Hook`s to the A2aAgent. |
public A2aAgent build() | 构建A2aAgent 实例。 Build the A2aAgent instance. |
方法详情Method Detail
name
public Builder name(String name)
设置名称的A2aAgent。
Set the name of the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 名称到设置。the name to set |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:309–312agentCard
public Builder agentCard(AgentCard agentCard)
设置AgentCard用于 A2aAgent。
Set the AgentCard for the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentCard | AgentCard | AgentCard 到设置。the AgentCard to set |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:323–325agentCardResolver
public Builder agentCardResolver(AgentCardResolver agentCardResolver)
设置AgentCardResolver用于 A2aAgent。
Set the AgentCardResolver for the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentCardResolver | AgentCardResolver | 智能体卡片解析器(类型 `AgentCardResolver`)。the AgentCardResolver to set, null value will be ignored. |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:336–349a2aAgentConfig
public Builder a2aAgentConfig(A2aAgentConfig a2aAgentConfig)
设置A2aAgentConfig用于 A2aAgent。
Set the A2aAgentConfig for the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
a2aAgentConfig | A2aAgentConfig | A2aAgentConfig 到设置。the A2aAgentConfig to set |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:357–360memory
public Builder memory(Memory memory)
设置Memory用于 A2aAgent。
Set the Memory for the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
memory | Memory | 记忆到设置。the Memory to set |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:370–373checkRunning
public Builder checkRunning(boolean checkRunning)
设置检查运行中。
Set whether to check the running status of the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
checkRunning | boolean | 检查运行中(类型 `boolean`)。true to check the running status, false to ignore |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:383–386hook
public Builder hook(Hook hook)
设置钩子。
Add a Hook to the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
hook | Hook | 钩子到添加。the Hook to add |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:394–397hooks
public Builder hooks(List<Hook> hooks)
设置该配置项。
Add multiple Hooks to the A2aAgent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
hooks | List<Hook> | hooks(类型 `List`)。the list of Hooks to add |
Builderio/agentscope/core/a2a/agent/A2aAgent.java:405–408build
public A2aAgent build()
构建A2aAgent 实例。
Build the A2aAgent instance.
A2aAgentIllegalArgumentException当if agentCardResolver是不设置时抛出 `IllegalArgumentException`。if agentCardResolver is not set
io/agentscope/core/a2a/agent/A2aAgent.java:416–431