Builder
public static class Builder
源码Source
io/agentscope/core/agent/user/UserAgent.java:278–355UserAgent的构建器。位于 io.agentscope.core.agent.user 包。核心成员包括 name、description、checkRunning、inputMethod、hooks、build。
Builder for UserAgent.
Provides fluent API for configuring agent name, input method, and hooks. The name is required; other properties have sensible defaults.
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Builder name(String name) | 设置智能体名称(必填)。 Set the agent name (required). |
public Builder description(String description) | 设置该配置项。 Set the agent description. |
public Builder checkRunning(boolean checkRunning) | 设置checkRunning 开关。 Set the checkRunning flag. |
public Builder inputMethod(UserInputBase inputMethod) | 设置输入方法。 Set the input method for user interaction. |
public Builder hooks(List<Hook> hooks) | 设置该配置项。 Set the hooks for monitoring agent execution. |
public UserAgent build() | 构建UserAgent 实例。 Build the UserAgent instance. |
方法详情Method Detail
name
public Builder name(String name)
设置智能体名称(必填)。
Set the agent name (required).
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
name | String | 智能体名称。The agent name |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/agent/user/UserAgent.java:293–296description
public Builder description(String description)
设置该配置项。
Set the agent description.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
description | String | 描述(类型 `String`)。The agent description |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/agent/user/UserAgent.java:304–307checkRunning
public Builder checkRunning(boolean checkRunning)
设置checkRunning 开关。
Set the checkRunning flag.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
checkRunning | boolean | checkRunning 开关。The checkRunning flag |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/agent/user/UserAgent.java:315–318inputMethod
public Builder inputMethod(UserInputBase inputMethod)
设置输入方法。
Set the input method for user interaction.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputMethod | UserInputBase | 输入方法(类型 `UserInputBase`)。The input method implementation (defaults to StreamUserInput with System.in/out) |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/agent/user/UserAgent.java:327–330hooks
public Builder hooks(List<Hook> hooks)
设置该配置项。
Set the hooks for monitoring agent execution.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
hooks | List<Hook> | hooks(类型 `List`)。List of hooks |
Builder返回当前实例,以支持链式调用。This builder
源码Source
io/agentscope/core/agent/user/UserAgent.java:338–341build
public UserAgent build()
构建UserAgent 实例。
Build the UserAgent instance.
UserAgent一种新的UserAgent 实例。A new UserAgent instance
IllegalArgumentException可能抛出 `IllegalArgumentException`。if name is null or empty
源码Source
io/agentscope/core/agent/user/UserAgent.java:349–354