SubAgentConfig
public class SubAgentConfig
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
InMemoryAgentStateStorefor 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()
创建默认配置。
Creates a default configuration.
SubAgentConfigio/agentscope/core/tool/subagent/SubAgentConfig.java:85–87builder
public static Builder builder()
创建新的构建器。
Creates a new builder.
Builderio/agentscope/core/tool/subagent/SubAgentConfig.java:94–96getToolName
public String getToolName()
获取工具名称。
Gets the tool name override.
Stringio/agentscope/core/tool/subagent/SubAgentConfig.java:103–105getDescription
public String getDescription()
获取 getDescription。
Gets the description override.
Stringio/agentscope/core/tool/subagent/SubAgentConfig.java:112–114isForwardEvents
public boolean isForwardEvents()
判断是否 isForwardEvents。
Gets whether to forward sub-agent events to the parent agent.
booleanio/agentscope/core/tool/subagent/SubAgentConfig.java:124–126getStreamOptions
public StreamOptions getStreamOptions()
获取流选项。
Gets the stream options for event forwarding.
StreamOptionsio/agentscope/core/tool/subagent/SubAgentConfig.java:136–138getStateStore
public AgentStateStore getStateStore()
获取会话用于会话状态管理。
Gets the session for conversation state management.
AgentStateStoreio/agentscope/core/tool/subagent/SubAgentConfig.java:148–150嵌套类详情Nested Class Detail
Builder
public static class BuilderSubAgentConfig的构建器。位于 io.agentscope.core.tool.subagent 包。核心成员包括 toolName、description、forwardEvents、streamOptions、stateStore、build。
Builder for SubAgentConfig.