AS AgentScopeAPI 手册 / API Reference

SubAgentConfig

public class SubAgentConfig
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:61–242

子智能体配置,保存相关配置项。位于 io.agentscope.core.tool.subagent 包。核心成员包括 defaults、builder、getToolName、getDescription、isForwardEvents、getStreamOptions。

Configuration for sub-agent registration.

This class provides configuration options for how a sub-agent is exposed as a tool. It supports smart defaults that derive tool name and description from the agent itself.

Sub-agents operate in conversation mode, supporting multi-turn dialogue with session management. The tool exposes two parameters:

  • message - Required. The message to send to the agent.

  • conversation_id - Optional. Omit to start a new conversation, provide to continue an existing one.

Default Behavior:

  • Tool name: derived from agent name (e.g., "ResearchAgent" → "call_researchagent")

  • Description: uses agent's description, or generates a default

  • AgentStateStore: uses InMemoryAgentStateStore for conversation state management

  • Event forwarding: enabled by default

Example usage:

`// Minimal configuration - uses all defaults
SubAgentConfig config = SubAgentConfig.defaults();

// Custom configuration with persistent session
SubAgentConfig config = SubAgentConfig.builder()
.toolName("ask_expert")
.description("Ask the expert a question")
.stateStore(new JsonFileAgentStateStore(Path.of("sessions")))
.build();
`

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
SubAgentConfig的构建器。
Builder for SubAgentConfig.

方法摘要Method Summary

方法Method说明Description
public static SubAgentConfig defaults()
static
创建默认配置。
Creates a default configuration.
public static Builder builder()
static
创建新的构建器。
Creates a new builder.
public String getToolName()
获取工具名称。
Gets the tool name override.
public String getDescription()
获取 `getDescription`。
Gets the description override.
public boolean isForwardEvents()
判断是否 `isForwardEvents`。
Gets whether to forward sub-agent events to the parent agent.
public StreamOptions getStreamOptions()
获取流选项。
Gets the stream options for event forwarding.
public AgentStateStore getStateStore()
获取会话用于会话状态管理。
Gets the session for conversation state management.

方法详情Method Detail

defaults

public static SubAgentConfig defaults()
static

创建默认配置。

Creates a default configuration.

返回Returns SubAgentConfig
返回SubAgentConfig。Default configuration
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:85–87

builder

public static Builder builder()
static

创建新的构建器。

Creates a new builder.

返回Returns Builder
返回当前实例,以支持链式调用。New builder instance
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:94–96

getToolName

public String getToolName()

获取工具名称。

Gets the tool name override.

返回Returns String
返回字符串结果。Tool name, or null to derive from agent
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:103–105

getDescription

public String getDescription()

获取 getDescription。

Gets the description override.

返回Returns String
返回字符串结果。Description, or null to derive from agent
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:112–114

isForwardEvents

public boolean isForwardEvents()

判断是否 isForwardEvents。

Gets whether to forward sub-agent events to the parent agent.

返回Returns boolean
返回布尔值,表示判断结果。true if events should be forwarded (default: true)
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:124–126

getStreamOptions

public StreamOptions getStreamOptions()

获取流选项。

Gets the stream options for event forwarding.

返回Returns StreamOptions
返回StreamOptions。Stream options, or null to use defaults
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:136–138

getStateStore

public AgentStateStore getStateStore()

获取会话用于会话状态管理。

Gets the session for conversation state management.

返回Returns AgentStateStore
返回AgentStateStore。The session instance (never null)
源码Source io/agentscope/core/tool/subagent/SubAgentConfig.java:148–150

嵌套类详情Nested Class Detail

Builder

public static class Builder

SubAgentConfig的构建器。位于 io.agentscope.core.tool.subagent 包。核心成员包括 toolName、description、forwardEvents、streamOptions、stateStore、build。

Builder for SubAgentConfig.

基于官方固定版本源码静态生成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.