SkillRegistration
public static class SkillRegistration
io/agentscope/core/skill/SkillBox.java:286–525技能注册,让智能体以受控方式调用外部能力。位于 io.agentscope.core.skill 包。核心成员包括 skill、toolkit、tool、agentTool、mcpClient、subAgent。
Fluent builder for registering skills with optional configuration.
This builder provides a clear, type-safe way to register skills with various options without method proliferation.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SkillRegistration(SkillBox skillBox) | 初始化 `SkillRegistration` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
SkillRegistration
public SkillRegistration(SkillBox skillBox)
初始化 SkillRegistration 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillBox | SkillBox | 技能 Box(类型 `SkillBox`)。The skill box. |
io/agentscope/core/skill/SkillBox.java:300–302方法详情Method Detail
skill
public SkillRegistration skill(AgentSkill skill)
设置技能到注册。
Set the skill to register.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skill | AgentSkill | 技能到注册。The skill to register |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:310–313toolkit
public SkillRegistration toolkit(Toolkit toolkit)
设置工具包。
Performs the toolkit operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:315–318tool
public SkillRegistration tool(Object toolObject)
设置工具。
Set the tool object to register (scans for @Tool methods).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolObject | Object | 工具对象(类型 `Object`)。Object containing @Tool annotated methods |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:326–329agentTool
public SkillRegistration agentTool(AgentTool agentTool)
设置AgentTool 实例到注册。
Set the AgentTool instance to register.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agentTool | AgentTool | AgentTool 实例。The AgentTool instance |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:337–340mcpClient
public SkillRegistration mcpClient(McpClientWrapper mcpClientWrapper)
设置MCP 客户端到注册。
Set the MCP client to register.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
mcpClientWrapper | McpClientWrapper | MCP 客户端包装器。The MCP client wrapper |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:348–351subAgent
public SkillRegistration subAgent(SubAgentProvider<?> provider)
设置子智能体。
Register a sub-agent as a tool with default configuration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
provider | SubAgentProvider<?> | 提供者(类型 `SubAgentProvider`)。Factory for creating agent instances (called for each invocation) |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:373–375subAgent
public SkillRegistration subAgent(SubAgentProvider<?> provider, SubAgentConfig config)
执行子智能体相关操作。
Register a sub-agent as a tool with custom configuration.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
provider | SubAgentProvider<?> | 提供者(类型 `SubAgentProvider`)。Factory for creating agent instances (called for each session) |
config | SubAgentConfig | 配置对象(类型 `SubAgentConfig`)。Configuration for the sub-agent tool, or null to use defaults (tool name derived from agent name, InMemoryAgentStateStore for state, events forwarded) |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:417–428enableTools
public SkillRegistration enableTools(List<String> enableTools)
设置列出的工具到启用来自 MCP 客户端。
Set the list of tools to enable from the MCP client.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
enableTools | List<String> | 启用工具(类型 `List`)。List of tool names to enable |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:438–441disableTools
public SkillRegistration disableTools(List<String> disableTools)
设置列出的工具到禁用来自 MCP 客户端。
Set the list of tools to disable from the MCP client.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
disableTools | List<String> | 禁用工具(类型 `List`)。List of tool names to disable |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:451–454presetParameters
public SkillRegistration presetParameters(Map<String, Map<String, Object>> presetParameters)
设置该参数。
Set preset parameters that will be automatically injected during tool execution.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
presetParameters | Map<String, Map<String, Object>> | preset 参数(类型 `Map >`)。Map from tool name to its preset parameters |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:472–476extendedModel
public SkillRegistration extendedModel(ExtendedModel extendedModel)
设置该参数。
Set the extended model for dynamic schema extension.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
extendedModel | ExtendedModel | extended 模型(类型 `ExtendedModel`)。The extended model |
SkillRegistrationio/agentscope/core/skill/SkillBox.java:484–487apply
public void apply()
执行 apply 方法。
Apply the registration with all configured options.
IllegalStateException可能抛出 `IllegalStateException`。if none of skill() was set, or toolkit() is required but not set
io/agentscope/core/skill/SkillBox.java:494–524