AS AgentScopeAPI 手册 / API Reference

SkillRegistration

public static class SkillRegistration
源码Source 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

方法Method说明Description
public SkillRegistration skill(AgentSkill skill)
设置技能到注册。
Set the skill to register.
public SkillRegistration toolkit(Toolkit toolkit)
设置工具包。
Performs the toolkit operation.
public SkillRegistration tool(Object toolObject)
设置工具。
Set the tool object to register (scans for @Tool methods).
public SkillRegistration agentTool(AgentTool agentTool)
设置AgentTool 实例到注册。
Set the AgentTool instance to register.
public SkillRegistration mcpClient(McpClientWrapper mcpClientWrapper)
设置MCP 客户端到注册。
Set the MCP client to register.
public SkillRegistration subAgent(SubAgentProvider<?> provider)
设置子智能体。
Register a sub-agent as a tool with default configuration.
public SkillRegistration subAgent(SubAgentProvider<?> provider, SubAgentConfig config)
执行子智能体相关操作。
Register a sub-agent as a tool with custom configuration.
public SkillRegistration enableTools(List<String> enableTools)
设置列出的工具到启用来自 MCP 客户端。
Set the list of tools to enable from the MCP client.
public SkillRegistration disableTools(List<String> disableTools)
设置列出的工具到禁用来自 MCP 客户端。
Set the list of tools to disable from the MCP client.
public SkillRegistration presetParameters(Map<String, Map<String, Object>> presetParameters)
设置该参数。
Set preset parameters that will be automatically injected during tool execution.
public SkillRegistration extendedModel(ExtendedModel extendedModel)
设置该参数。
Set the extended model for dynamic schema extension.
public void apply()
执行 `apply` 方法。
Apply the registration with all configured options.

构造器详情Constructor Detail

SkillRegistration

public SkillRegistration(SkillBox skillBox)

初始化 SkillRegistration 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
skillBoxSkillBox技能 Box(类型 `SkillBox`)。The skill box.
源码Source io/agentscope/core/skill/SkillBox.java:300–302

方法详情Method Detail

skill

public SkillRegistration skill(AgentSkill skill)

设置技能到注册。

Set the skill to register.

参数Parameters
名称Name类型Type说明Description
skillAgentSkill技能到注册。The skill to register
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:310–313

toolkit

public SkillRegistration toolkit(Toolkit toolkit)

设置工具包。

Performs the toolkit operation.

参数Parameters
名称Name类型Type说明Description
toolkitToolkit工具包(类型 `Toolkit`)。The toolkit.
返回Returns SkillRegistration
返回SkillRegistration。Returns skill registration.
源码Source io/agentscope/core/skill/SkillBox.java:315–318

tool

public SkillRegistration tool(Object toolObject)

设置工具。

Set the tool object to register (scans for @Tool methods).

参数Parameters
名称Name类型Type说明Description
toolObjectObject工具对象(类型 `Object`)。Object containing @Tool annotated methods
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:326–329

agentTool

public SkillRegistration agentTool(AgentTool agentTool)

设置AgentTool 实例到注册。

Set the AgentTool instance to register.

参数Parameters
名称Name类型Type说明Description
agentToolAgentToolAgentTool 实例。The AgentTool instance
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:337–340

mcpClient

public SkillRegistration mcpClient(McpClientWrapper mcpClientWrapper)

设置MCP 客户端到注册。

Set the MCP client to register.

参数Parameters
名称Name类型Type说明Description
mcpClientWrapperMcpClientWrapperMCP 客户端包装器。The MCP client wrapper
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:348–351

subAgent

public SkillRegistration subAgent(SubAgentProvider<?> provider)

设置子智能体。

Register a sub-agent as a tool with default configuration.

参数Parameters
名称Name类型Type说明Description
providerSubAgentProvider<?>提供者(类型 `SubAgentProvider`)。Factory for creating agent instances (called for each invocation)
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:373–375

subAgent

public SkillRegistration subAgent(SubAgentProvider<?> provider, SubAgentConfig config)

执行子智能体相关操作。

Register a sub-agent as a tool with custom configuration.

另见See also @see SubAgentConfig, @see SubAgentConfig#defaults()
参数Parameters
名称Name类型Type说明Description
providerSubAgentProvider<?>提供者(类型 `SubAgentProvider`)。Factory for creating agent instances (called for each session)
configSubAgentConfig配置对象(类型 `SubAgentConfig`)。Configuration for the sub-agent tool, or null to use defaults (tool name derived from agent name, InMemoryAgentStateStore for state, events forwarded)
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:417–428

enableTools

public SkillRegistration enableTools(List<String> enableTools)

设置列出的工具到启用来自 MCP 客户端。

Set the list of tools to enable from the MCP client.

参数Parameters
名称Name类型Type说明Description
enableToolsList<String>启用工具(类型 `List`)。List of tool names to enable
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:438–441

disableTools

public SkillRegistration disableTools(List<String> disableTools)

设置列出的工具到禁用来自 MCP 客户端。

Set the list of tools to disable from the MCP client.

参数Parameters
名称Name类型Type说明Description
disableToolsList<String>禁用工具(类型 `List`)。List of tool names to disable
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:451–454

presetParameters

public SkillRegistration presetParameters(Map<String, Map<String, Object>> presetParameters)

设置该参数。

Set preset parameters that will be automatically injected during tool execution.

参数Parameters
名称Name类型Type说明Description
presetParametersMap<String, Map<String, Object>>preset 参数(类型 `Map >`)。Map from tool name to its preset parameters
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:472–476

extendedModel

public SkillRegistration extendedModel(ExtendedModel extendedModel)

设置该参数。

Set the extended model for dynamic schema extension.

参数Parameters
名称Name类型Type说明Description
extendedModelExtendedModelextended 模型(类型 `ExtendedModel`)。The extended model
返回Returns SkillRegistration
返回SkillRegistration。This builder for chaining
源码Source io/agentscope/core/skill/SkillBox.java:484–487

apply

public void apply()

执行 apply 方法。

Apply the registration with all configured options.

抛出Throws
  • IllegalStateException 可能抛出 `IllegalStateException`。if none of skill() was set, or toolkit() is required but not set
源码Source io/agentscope/core/skill/SkillBox.java:494–524
基于官方固定版本源码静态生成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.