AS AgentScopeAPI 手册 / API Reference

Builder

@SuppressWarnings("deprecation") public static class Builder
源码Source io/agentscope/core/ReActAgent.java:4798–5657

链式配置 ReActAgent 的名称、模型、工具、状态存储、权限与中间件,最后调用 build() 得到实例。位于 io.agentscope.core 包。核心成员包括 name、description、checkRunning、sysPrompt、model、toolkit。

A class in io.agentscope.core that drives agent reasoning, tool calls and conversation execution. Declared in io.agentscope.core.

方法摘要Method Summary

方法Method说明Description
public Builder name(String name)
设置智能体名称。
Sets the name for this agent.
public Builder description(String description)
设置智能体描述。
Performs the description operation.
public Builder checkRunning(boolean checkRunning)
deprecated
设置检查运行中。
Performs the check running operation.
public Builder sysPrompt(String sysPrompt)
设置系统提示词。
Sets the system prompt for this agent.
public Builder model(Model model)
设置聊天模型,可传模型实例或模型 ID。
Sets the language model for this agent.
public Builder model(String modelId)
设置聊天模型,可传模型实例或模型 ID。
Configures the model from a string id resolved via `ModelRegistry`: a named registration (`ModelRegistry#register(String, Model)`) or an extension provider pattern such as `openai:gpt-5.5`, `dashscope:qwen-max`, ` anthropic:claude-sonnet-4-5`, `gemini:gemini-2.0-flash`, or `ollama:llama3`.
public Builder toolkit(Toolkit toolkit)
设置工具注册表。
Sets the toolkit containing available tools for this agent.
public Builder maxIters(int maxIters)
设置推理—行动循环的最大迭代次数。
Sets the maximum number of reasoning-acting iterations.
public Builder hook(Hook hook)
设置钩子。
Adds a hook for monitoring and intercepting agent execution events.
public Builder hooks(List<Hook> hooks)
设置该配置项。
Adds multiple hooks for monitoring and intercepting agent execution events.
public Builder middleware(MiddlewareBase middleware)
追加一个中间件。
Adds a middleware for intercepting agent execution.
public Builder middlewares(List<? extends MiddlewareBase> middlewares)
批量设置中间件。
Adds multiple middlewares for intercepting agent execution.
public Builder enableMetaTool(boolean enableMetaTool)
启用元数据工具。
Enables or disables the meta-tool functionality.
public Builder enableTaskList()
启用任务列表。
Enables the built-in task-list capability (`todo_write` tool + per-turn reminder).
public Builder enableTaskList(boolean enabled)
启用任务列表。
Enables or disables the built-in task-list capability.
public Builder enablePendingToolRecovery(boolean enable)
启用该配置。
Enables or disables automatic recovery from orphaned pending tool calls.
public Builder modelExecutionConfig(ExecutionConfig modelExecutionConfig)
设置执行配置用于模型 API 调用。
Sets the execution configuration for model API calls.
public Builder toolExecutionConfig(ExecutionConfig toolExecutionConfig)
设置工具执行配置。
Sets the execution configuration for tool executions.
public Builder generateOptions(GenerateOptions generateOptions)
设置该配置项。
Sets the generation options for model API calls.
public Builder toolExecutionContext(ToolExecutionContext toolExecutionContext)
deprecated
设置工具执行上下文用于此智能体。
Sets the tool execution context for this agent.
public Builder stateStore(AgentStateStore stateStore)
设置跨会话的状态存储。
Sets the `AgentStateStore` backing automatic AgentState load (at construction) and save (after every successful `call()` and on graceful shutdown).
public Builder conflictPolicy(ConflictPolicy conflictPolicy)
设置该配置项。
Sets the policy applied when an optimistic-concurrency save of `agent_state` conflicts with another writer's update.
public Builder defaultSessionId(String sessionId)
设置默认会话 ID。
Sets the builder-time fallback `sessionId` used to persist `agent_state` when a call does not supply a `sessionId` on its `RuntimeContext`.
public Builder maxRetries(int maxRetries)
设置最大重试。
Sets the model-call retry budget (max attempts including the first try).
public Builder fallbackModel(Model fallbackModel)
设置回退模型。
Sets the fallback model invoked after the primary model exhausts its retry budget.
public Builder fallbackModel(String modelId)
设置回退模型。
Convenience overload that resolves `modelId` via `io.agentscope.core.model.ModelRegistry#resolve(String)` (named registration or `provider:model` pattern like `openai:gpt-5.5`, `dashscope:qwen-max`).
public Builder failoverListener(FailoverListener failoverListener)
设置故障转移监听器。
Sets the listener notified when the fallback model takes over from a failed primary model.
public Builder stopOnReject(boolean stopOnReject)
设置停止 On 拒绝。
Controls whether a permission rejection of any tool call terminates the reasoning loop (instead of feeding the rejection back into the next reasoning round).
public Builder permissionContext(PermissionContextState permissionContext)
设置权限上下文。
Sets the `PermissionContextState` consulted by the `PermissionEngine` during tool execution.
public Builder longTermMemory(LongTermMemory longTermMemory)
deprecated
设置该配置项。
Performs the long term memory operation.
public Builder longTermMemoryMode(LongTermMemoryMode mode)
deprecated
设置该配置项。
Performs the long term memory mode operation.
public Builder longTermMemoryAsyncRecord(boolean asyncRecord)
deprecated
设置该配置项。
Performs the long term memory async record operation.
public Builder knowledge(Knowledge knowledge)
deprecated
挂载一个知识库用于 RAG。
Performs the knowledge operation.
public Builder knowledges(List<Knowledge> knowledges)
deprecated
设置该配置项。
Performs the knowledges operation.
public Builder ragMode(RAGMode mode)
deprecated
选择知识库的注入模式。
Performs the rag mode operation.
public Builder retrieveConfig(RetrieveConfig config)
deprecated
设置检索配置。
Retrieves the config.
public Builder skillBox(SkillBox skillBox)
deprecated
设置该配置项。
Performs the skill box operation.
public Builder skillRepository(AgentSkillRepository repo)
设置技能仓库。
Adds a single `AgentSkillRepository` to the layered skill stack.
public Builder skillRepositories(List<AgentSkillRepository> repos)
设置该配置项。
Replaces the current repository list with the supplied collection.
public Builder skillFilter(SkillFilter filter)
设置技能过滤器。
Builder-time `SkillFilter` applied by the auto-installed `DynamicSkillMiddleware`.
public Builder dynamicSkillsEnabled(boolean enabled)
设置该配置项。
Toggles automatic installation of `DynamicSkillMiddleware`.
public Builder skillCodeExecutionEnabled(boolean enabled)
设置该配置项。
Enables the code-execution prompt block emitted by `io.agentscope.core.skill.AgentSkillPromptProvider`.
public Builder skillWorkDir(Path dir)
设置该配置项。
Sets a stable working directory used by `DynamicSkillMiddleware` for `uploadSkillFiles`.
public static Builder fromAgent(ReActAgent agent)
static
设置来自智能体。
Returns a new `Builder` pre-populated with the given agent's observable configuration: name, description, system prompt, model, maxIters, generateOptions, and a defensive copy of the toolkit.
public ReActAgent build()
构建 ReActAgent 实例。
Builds and returns a new ReActAgent instance with the configured settings.

方法详情Method Detail

name

public Builder name(String name)

设置名称用于此智能体。

Sets the name for this agent.

参数Parameters
名称Name类型Type说明Description
nameString智能体名称。The agent name, must not be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4888–4891

description

public Builder description(String description)

设置该配置项。

Performs the description operation.

参数Parameters
名称Name类型Type说明Description
descriptionString描述(类型 `String`)。The description.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:4893–4896

checkRunning

public Builder checkRunning(boolean checkRunning)
deprecated

设置检查运行中。

Performs the check running operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。No longer enforced; per-session serialization handles concurrency.
参数Parameters
名称Name类型Type说明Description
checkRunningboolean检查运行中(类型 `boolean`)。The check running.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:4899–4902

sysPrompt

public Builder sysPrompt(String sysPrompt)

设置系统提示词用于此智能体。

Sets the system prompt for this agent.

参数Parameters
名称Name类型Type说明Description
sysPromptString系统提示词。The system prompt, can be null or empty
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4910–4913

model

public Builder model(Model model)

设置模型。

Sets the language model for this agent.

参数Parameters
名称Name类型Type说明Description
modelModel聊天模型实例或模型 ID。The language model to use for reasoning, must not be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4921–4924

model

public Builder model(String modelId)

设置模型。

Configures the model from a string id resolved via ModelRegistry: a named registration (ModelRegistry#register(String, Model)) or an extension provider pattern such as openai:gpt-5.5, dashscope:qwen-max, anthropic:claude-sonnet-4-5, gemini:gemini-2.0-flash, or `olla…

参数Parameters
名称Name类型Type说明Description
modelIdString模型标识(类型 `String`)。registry id or `provider:model` string
返回Returns Builder
返回当前实例,以支持链式调用。this builder
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if the id cannot be resolved
源码Source io/agentscope/core/ReActAgent.java:4937–4940

toolkit

public Builder toolkit(Toolkit toolkit)

设置工具包。

Sets the toolkit containing available tools for this agent.

参数Parameters
名称Name类型Type说明Description
toolkitToolkit工具注册表。The toolkit with available tools, must not be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4951–4954

maxIters

public Builder maxIters(int maxIters)

设置最大迭代次数。

Sets the maximum number of reasoning-acting iterations.

参数Parameters
名称Name类型Type说明Description
maxItersint推理—行动循环的最大迭代次数。Maximum iterations, must be positive
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4962–4965

hook

public Builder hook(Hook hook)

设置钩子。

Adds a hook for monitoring and intercepting agent execution events.

另见See also @see Hook, @see Hook#tools()
参数Parameters
名称Name类型Type说明Description
hookHook钩子(类型 `Hook`)。The hook to add, must not be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4979–4982

hooks

public Builder hooks(List<Hook> hooks)

设置该配置项。

Adds multiple hooks for monitoring and intercepting agent execution events.

另见See also @see Hook, @see Hook#tools()
参数Parameters
名称Name类型Type说明Description
hooksList<Hook>hooks(类型 `List`)。The list of hooks to add, must not be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:4995–4998

middleware

public Builder middleware(MiddlewareBase middleware)

设置中间件。

Adds a middleware for intercepting agent execution.

参数Parameters
名称Name类型Type说明Description
middlewareMiddlewareBase中间件到添加。the middleware to add
返回Returns Builder
返回当前实例,以支持链式调用。this builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5006–5009

middlewares

public Builder middlewares(List<? extends MiddlewareBase> middlewares)

设置该配置项。

Adds multiple middlewares for intercepting agent execution.

参数Parameters
名称Name类型Type说明Description
middlewaresList<? extends MiddlewareBase>中间件列表(类型 `List`)。the list of middlewares to add
返回Returns Builder
返回当前实例,以支持链式调用。this builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5017–5020

enableMetaTool

public Builder enableMetaTool(boolean enableMetaTool)

启用元数据工具。

Enables or disables the meta-tool functionality.

参数Parameters
名称Name类型Type说明Description
enableMetaToolboolean启用元数据工具(类型 `boolean`)。true to enable meta-tool, false to disable
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5032–5035

enableTaskList

public Builder enableTaskList()

启用任务列表。

Enables the built-in task-list capability (todo_write tool + per-turn reminder).

返回Returns Builder
返回当前实例,以支持链式调用。this builder for chaining
源码Source io/agentscope/core/ReActAgent.java:5044–5046

enableTaskList

public Builder enableTaskList(boolean enabled)

启用任务列表。

Enables or disables the built-in task-list capability.

参数Parameters
名称Name类型Type说明Description
enabledboolean已启用(类型 `boolean`)。true to enable the task list
返回Returns Builder
返回当前实例,以支持链式调用。this builder for chaining
源码Source io/agentscope/core/ReActAgent.java:5059–5062

enablePendingToolRecovery

public Builder enablePendingToolRecovery(boolean enable)

启用该配置。

Enables or disables automatic recovery from orphaned pending tool calls.

参数Parameters
名称Name类型Type说明Description
enableboolean启用(类型 `boolean`)。true to enable auto-recovery, false to disable
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5077–5080

modelExecutionConfig

public Builder modelExecutionConfig(ExecutionConfig modelExecutionConfig)

设置执行配置用于模型 API 调用。

Sets the execution configuration for model API calls.

另见See also @see ExecutionConfig
参数Parameters
名称Name类型Type说明Description
modelExecutionConfigExecutionConfig模型执行配置(类型 `ExecutionConfig`)。The execution configuration for model calls, can be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5093–5096

toolExecutionConfig

public Builder toolExecutionConfig(ExecutionConfig toolExecutionConfig)

设置工具执行配置。

Sets the execution configuration for tool executions.

另见See also @see ExecutionConfig
参数Parameters
名称Name类型Type说明Description
toolExecutionConfigExecutionConfig工具执行配置(类型 `ExecutionConfig`)。The execution configuration for tool calls, can be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5109–5112

generateOptions

public Builder generateOptions(GenerateOptions generateOptions)

设置该配置项。

Sets the generation options for model API calls.

另见See also @see GenerateOptions
参数Parameters
名称Name类型Type说明Description
generateOptionsGenerateOptionsgenerate 选项(类型 `GenerateOptions`)。The generation options for model calls, can be null
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5142–5145

toolExecutionContext

public Builder toolExecutionContext(ToolExecutionContext toolExecutionContext)
deprecated

设置工具执行上下文用于此智能体。

Sets the tool execution context for this agent.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。Use `RuntimeContext` with `agent.call(msg, runtimeContext)` or register POJOs directly via `RuntimeContext.builder().put(Type, value)`.
参数Parameters
名称Name类型Type说明Description
toolExecutionContextToolExecutionContext工具执行上下文。The tool execution context
返回Returns Builder
返回当前实例,以支持链式调用。This builder instance for method chaining
源码Source io/agentscope/core/ReActAgent.java:5155–5159

stateStore

public Builder stateStore(AgentStateStore stateStore)

设置状态存储。

Sets the AgentStateStore backing automatic AgentState load (at construction) and save (after every successful call() and on graceful shutdown).

参数Parameters
名称Name类型Type说明Description
stateStoreAgentStateStore会话状态存储。The state store.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5166–5169

conflictPolicy

public Builder conflictPolicy(ConflictPolicy conflictPolicy)

设置该配置项。

Sets the policy applied when an optimistic-concurrency save of agent_state conflicts with another writer's update.

参数Parameters
名称Name类型Type说明Description
conflictPolicyConflictPolicyconflict 策略(类型 `ConflictPolicy`)。The conflict policy.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5176–5179

defaultSessionId

public Builder defaultSessionId(String sessionId)

设置默认会话标识。

Sets the builder-time fallback sessionId used to persist agent_state when a call does not supply a sessionId on its RuntimeContext.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5187–5190

maxRetries

public Builder maxRetries(int maxRetries)

设置最大重试。

Sets the model-call retry budget (max attempts including the first try).

参数Parameters
名称Name类型Type说明Description
maxRetriesint最大重试(类型 `int`)。The max retries.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5196–5202

fallbackModel

public Builder fallbackModel(Model fallbackModel)

设置回退模型。

Sets the fallback model invoked after the primary model exhausts its retry budget.

参数Parameters
名称Name类型Type说明Description
fallbackModelModel回退模型(类型 `Model`)。The fallback model.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5208–5211

fallbackModel

public Builder fallbackModel(String modelId)

设置回退模型。

Convenience overload that resolves modelId via io.agentscope.core.model.ModelRegistry#resolve(String) (named registration or provider:model pattern like openai:gpt-5.5, dashscope:qwen-max).

参数Parameters
名称Name类型Type说明Description
modelIdString模型标识(类型 `String`)。The model id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if the id cannot be resolved
源码Source io/agentscope/core/ReActAgent.java:5220–5223

failoverListener

public Builder failoverListener(FailoverListener failoverListener)

设置故障转移监听器。

Sets the listener notified when the fallback model takes over from a failed primary model.

另见See also @see FailoverListener for the threading and failure contract
参数Parameters
名称Name类型Type说明Description
failoverListenerFailoverListener故障转移监听器(类型 `FailoverListener`)。The failover listener.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5231–5234

stopOnReject

public Builder stopOnReject(boolean stopOnReject)

设置停止 On 拒绝。

Controls whether a permission rejection of any tool call terminates the reasoning loop (instead of feeding the rejection back into the next reasoning round).

参数Parameters
名称Name类型Type说明Description
stopOnRejectboolean停止 On 拒绝(类型 `boolean`)。The stop on reject.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5241–5244

permissionContext

public Builder permissionContext(PermissionContextState permissionContext)

设置权限上下文。

Sets the PermissionContextState consulted by the PermissionEngine during tool execution.

参数Parameters
名称Name类型Type说明Description
permissionContextPermissionContextState权限上下文(类型 `PermissionContextState`)。The permission context.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5250–5253

longTermMemory

public Builder longTermMemory(LongTermMemory longTermMemory)
deprecated

设置该配置项。

Performs the long term memory operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. Long-term memory is being redesigned around the upcoming reme base class. Hooks added through this path still work.
参数Parameters
名称Name类型Type说明Description
longTermMemoryLongTermMemorylong Term 记忆(类型 `LongTermMemory`)。The long term memory.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5265–5269

longTermMemoryMode

public Builder longTermMemoryMode(LongTermMemoryMode mode)
deprecated

设置该配置项。

Performs the long term memory mode operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. See `#longTermMemory`.
参数Parameters
名称Name类型Type说明Description
modeLongTermMemoryMode模式(类型 `LongTermMemoryMode`)。The mode.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5274–5278

longTermMemoryAsyncRecord

public Builder longTermMemoryAsyncRecord(boolean asyncRecord)
deprecated

设置该配置项。

Performs the long term memory async record operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. See `#longTermMemory`.
参数Parameters
名称Name类型Type说明Description
asyncRecordboolean异步记录(类型 `boolean`)。The async record.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5283–5287

knowledge

public Builder knowledge(Knowledge knowledge)
deprecated

设置知识库。

Performs the knowledge operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. RAG is being redesigned; legacy adapters remain functional.
参数Parameters
名称Name类型Type说明Description
knowledgeKnowledge用于 RAG 的知识库。The knowledge.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5292–5298

knowledges

public Builder knowledges(List<Knowledge> knowledges)
deprecated

设置该配置项。

Performs the knowledges operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. See `#knowledge`.
参数Parameters
名称Name类型Type说明Description
knowledgesList<Knowledge>knowledges(类型 `List`)。The knowledges.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5303–5309

ragMode

public Builder ragMode(RAGMode mode)
deprecated

设置该配置项。

Performs the rag mode operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. See `#knowledge`.
参数Parameters
名称Name类型Type说明Description
modeRAGMode模式(类型 `RAGMode`)。The mode.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5314–5320

retrieveConfig

public Builder retrieveConfig(RetrieveConfig config)
deprecated

设置检索配置。

Retrieves the config.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. See `#knowledge`.
参数Parameters
名称Name类型Type说明Description
configRetrieveConfig配置对象(类型 `RetrieveConfig`)。The config.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5325–5331

skillBox

public Builder skillBox(SkillBox skillBox)
deprecated

设置该配置项。

Performs the skill box operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。since 2.0.0. Skills now flow through `#skillRepository` / `#skillRepositories`; legacy `io.agentscope.core.skill.SkillBox` instances are still accepted for source compatibility, but combining a `skillBox(...)` with `skillRepository(...)` is untested — new code should prefer `#skillRepository(AgentSkillRepository)`.
参数Parameters
名称Name类型Type说明Description
skillBoxSkillBox技能 Box(类型 `SkillBox`)。The skill box.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5340–5344

skillRepository

public Builder skillRepository(AgentSkillRepository repo)

设置技能仓库。

Adds a single AgentSkillRepository to the layered skill stack.

参数Parameters
名称Name类型Type说明Description
repoAgentSkillRepository仓库(类型 `AgentSkillRepository`)。The repo.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5356–5361

skillRepositories

public Builder skillRepositories(List<AgentSkillRepository> repos)

设置该配置项。

Replaces the current repository list with the supplied collection.

参数Parameters
名称Name类型Type说明Description
reposList<AgentSkillRepository>repos(类型 `List`)。The repos.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5367–5377

skillFilter

public Builder skillFilter(SkillFilter filter)

设置技能过滤器。

Builder-time SkillFilter applied by the auto-installed DynamicSkillMiddleware.

参数Parameters
名称Name类型Type说明Description
filterSkillFilter过滤条件(类型 `SkillFilter`)。The filter.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5383–5386

dynamicSkillsEnabled

public Builder dynamicSkillsEnabled(boolean enabled)

设置该配置项。

Toggles automatic installation of DynamicSkillMiddleware.

参数Parameters
名称Name类型Type说明Description
enabledboolean已启用(类型 `boolean`)。The enabled.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5394–5397

skillCodeExecutionEnabled

public Builder skillCodeExecutionEnabled(boolean enabled)

设置该配置项。

Enables the code-execution prompt block emitted by io.agentscope.core.skill.AgentSkillPromptProvider.

参数Parameters
名称Name类型Type说明Description
enabledboolean已启用(类型 `boolean`)。The enabled.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5413–5416

skillWorkDir

public Builder skillWorkDir(Path dir)

设置该配置项。

Sets a stable working directory used by DynamicSkillMiddleware for uploadSkillFiles.

参数Parameters
名称Name类型Type说明Description
dirPath目录(类型 `Path`)。The dir.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5423–5426

fromAgent

public static Builder fromAgent(ReActAgent agent)
static

设置来自智能体。

Returns a new Builder pre-populated with the given agent's observable configuration: name, description, system prompt, model, maxIters, generateOptions, and a defensive copy of the toolkit.

参数Parameters
名称Name类型Type说明Description
agentReActAgent智能体(类型 `ReActAgent`)。The agent.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/ReActAgent.java:5435–5451

build

public ReActAgent build()

构建并返回最终实例。

Builds and returns a new ReActAgent instance with the configured settings.

返回Returns ReActAgent
一种新的ReActAgent 实例。A new ReActAgent instance
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if required parameters are missing or invalid
源码Source io/agentscope/core/ReActAgent.java:5585–5636
基于官方固定版本源码静态生成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.