SubAgentTool
public class SubAgentTool implements AgentTool
io/agentscope/core/tool/subagent/SubAgentTool.java:62–587子智能体工具,封装可被智能体调用的能力。位于 io.agentscope.core.tool.subagent 包,实现 AgentTool。核心成员包括 getName、getDescription、getParameters、callAsync、SubAgentTool。
AgentTool implementation that wraps a sub-agent for multi-turn conversation.
This tool allows an agent to be called as a tool by other agents, supporting multi-turn conversation with session management. Each session maintains its own agent instance and state.
Thread safety is ensured by using SubAgentProvider to create a fresh agent instance
for each new session.
The tool exposes two parameters:
-
session_id- Optional. Omit to start a new session, provide to continue an existing one. -
message- Required. The message to send to the agent.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SubAgentTool(SubAgentProvider<?> agentProvider, SubAgentConfig config) | 创建新的SubAgentTool。 Creates a new SubAgentTool. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getName() | 获取名称。 Returns the name. |
public String getDescription() | 获取 `getDescription`。 Returns the description. |
public Map<String, Object> getParameters() | 获取参数。 Returns the parameters. |
public Mono<ToolResultBlock> callAsync(ToolCallParam param) | 调用异步。 Calls the async. |
构造器详情Constructor Detail
SubAgentTool
public SubAgentTool(SubAgentProvider<?> agentProvider, SubAgentConfig config)
创建新的SubAgentTool。
Creates a new SubAgentTool.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentProvider | SubAgentProvider<?> | 智能体提供者(类型 `SubAgentProvider`)。Provider for creating agent instances |
config | SubAgentConfig | 用于工具的配置。Configuration for the tool |
io/agentscope/core/tool/subagent/SubAgentTool.java:83–93方法详情Method Detail
getName
public String getName()
获取名称。
Returns the name.
Stringio/agentscope/core/tool/subagent/SubAgentTool.java:95–98getDescription
public String getDescription()
获取 getDescription。
Returns the description.
Stringio/agentscope/core/tool/subagent/SubAgentTool.java:100–103getParameters
public Map<String, Object> getParameters()
获取参数。
Returns the parameters.
Map<String, Object>io/agentscope/core/tool/subagent/SubAgentTool.java:105–108callAsync
public Mono<ToolResultBlock> callAsync(ToolCallParam param)
调用异步。
Calls the async.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
param | ToolCallParam | 参数(类型 `ToolCallParam`)。The param. |
Mono<ToolResultBlock>io/agentscope/core/tool/subagent/SubAgentTool.java:110–113