AS AgentScopeAPI 手册 / API Reference

Builder

public static class Builder
源码Source io/agentscope/core/agent/user/UserAgent.java:278–355

UserAgent的构建器。位于 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
nameString智能体名称。The agent name
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/agent/user/UserAgent.java:293–296

description

public Builder description(String description)

设置该配置项。

Set the agent description.

参数Parameters
名称Name类型Type说明Description
descriptionString描述(类型 `String`)。The agent description
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/agent/user/UserAgent.java:304–307

checkRunning

public Builder checkRunning(boolean checkRunning)

设置checkRunning 开关。

Set the checkRunning flag.

参数Parameters
名称Name类型Type说明Description
checkRunningbooleancheckRunning 开关。The checkRunning flag
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/agent/user/UserAgent.java:315–318

inputMethod

public Builder inputMethod(UserInputBase inputMethod)

设置输入方法。

Set the input method for user interaction.

参数Parameters
名称Name类型Type说明Description
inputMethodUserInputBase输入方法(类型 `UserInputBase`)。The input method implementation (defaults to StreamUserInput with System.in/out)
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/agent/user/UserAgent.java:327–330

hooks

public Builder hooks(List<Hook> hooks)

设置该配置项。

Set the hooks for monitoring agent execution.

参数Parameters
名称Name类型Type说明Description
hooksList<Hook>hooks(类型 `List`)。List of hooks
返回Returns Builder
返回当前实例,以支持链式调用。This builder
源码Source io/agentscope/core/agent/user/UserAgent.java:338–341

build

public UserAgent build()

构建UserAgent 实例。

Build the UserAgent instance.

返回Returns UserAgent
一种新的UserAgent 实例。A new UserAgent instance
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if name is null or empty
源码Source io/agentscope/core/agent/user/UserAgent.java:349–354
基于官方固定版本源码静态生成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.