AS AgentScopeAPI 手册 / API Reference

AgentGenerateTool

public class AgentGenerateTool
源码Source io/agentscope/harness/agent/tool/AgentGenerateTool.java:42–155

智能体 Generate 工具,封装可被智能体调用的能力。位于 io.agentscope.harness.agent.tool 包。核心成员包括 agentGenerate、AgentGenerateTool。

Tool that generates a new subagent spec from a natural-language description and either persists it to subagents/<name>.md (where io.agentscope.harness.agent.middleware.DynamicSubagentsMiddleware will pick it up on the next reasoning step) or returns the markdown for human review.

Wraps SubagentSpecGenerator; takes care of name validation, collision detection against the live DefaultAgentManager registry, and dry-run handling.

Not registered by io.agentscope.harness.agent.middleware.SubagentsMiddleware by default; callers must opt in via SubagentsMiddleware#enableAgentGenerateTool(...).

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentGenerateTool(SubagentSpecGenerator generator, DefaultAgentManager agentManager, AbstractFilesystem filesystem)
初始化 `AgentGenerateTool` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Mono<String> agentGenerate(RuntimeContext runtimeContext, String name, String description, Boolean dryRun)
执行 `agentGenerate` 方法。
Performs the agent generate operation.

构造器详情Constructor Detail

AgentGenerateTool

public AgentGenerateTool(SubagentSpecGenerator generator, DefaultAgentManager agentManager, AbstractFilesystem filesystem)

初始化 AgentGenerateTool 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
generatorSubagentSpecGeneratorgenerator(类型 `SubagentSpecGenerator`)。The generator.
agentManagerDefaultAgentManager智能体管理器(类型 `DefaultAgentManager`)。The agent manager.
filesystemAbstractFilesystem文件系统(类型 `AbstractFilesystem`)。The filesystem.
源码Source io/agentscope/harness/agent/tool/AgentGenerateTool.java:53–60

方法详情Method Detail

agentGenerate

public Mono<String> agentGenerate(RuntimeContext runtimeContext, String name, String description, Boolean dryRun)

执行 agentGenerate 方法。

Performs the agent generate operation.

参数Parameters
名称Name类型Type说明Description
runtimeContextRuntimeContext运行时上下文(类型 `RuntimeContext`)。The runtime context.
nameString名称(类型 `String`)。The name.
descriptionString描述(类型 `String`)。The description.
dryRunBooleandry 运行(类型 `Boolean`)。The dry run.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/harness/agent/tool/AgentGenerateTool.java:62–154
基于官方固定版本源码静态生成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.