SkillBox
public class SkillBox
io/agentscope/core/skill/SkillBox.java:44–800技能 Box,让智能体以受控方式调用外部能力。位于 io.agentscope.core.skill 包。核心成员包括 copyForToolkit、getSkillPrompt、setExposeAllSkillMetadata、registration、bindToolkit、registerSkill。
Manages a collection of AgentSkill instances and exposes them as tools.
Since 2.0.0, SkillBox is intended for internal use only; prefer skill repositories
(AgentSkillRepository) for defining and loading skills.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
SkillRegistration | 类class | 技能注册,让智能体以受控方式调用外部能力。 Fluent builder for registering skills with optional configuration. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SkillBox(Toolkit toolkit) | 初始化 `SkillBox` 实例。 Creates a new instance. |
public SkillBox(Toolkit toolkit, String instruction) | 创建SkillBox 使用工具包和自定义技能提示词指令。 Creates a SkillBox with a toolkit and custom skill prompt instruction. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public SkillBox copyForToolkit(Toolkit toolkit) | 设置该参数。 Creates an agent-owned registry, prompt provider and loader bound to the given toolkit. |
public String getSkillPrompt() | 获取技能系统提示词用于已注册技能。 Gets the skill system prompt for registered skills. |
public String getSkillPrompt(SkillFilter filter) | 获取技能提示词。 Gets the skill system prompt filtered by the given `SkillFilter`. |
public void setExposeAllSkillMetadata(boolean exposeAllMetadata) | 设置 `setExposeAllSkillMetadata`。 Controls whether the skill prompt exposes all metadata fields or only the core fields. |
public SkillRegistration registration() | 返回注册。 Create a fluent builder for registering skills with optional configuration. |
public void bindToolkit(Toolkit toolkit) | 设置该参数。 Binds the shared toolkit to this skill box and its internal skill tool factory. |
public void registerSkill(AgentSkill skill) | 注册技能。 Registers an agent skill. |
public Set<String> getAllSkillIds() | 获取所有技能 IDs。 Gets all skill IDs. |
public AgentSkill getSkill(String skillId) | 获取技能。 Gets a skill by ID (latest version). |
public void removeSkill(String skillId) | 移除技能。 Removes a skill completely. |
public boolean exists(String skillId) | 判断数据是否存在。 Checks if a skill exists. |
public void registerSkillLoadTool() | 注册技能加载工具。 Registers skill access tools to the provided toolkit. |
public void setAutoUploadSkill(boolean autoUploadSkill) | 设置 `setAutoUploadSkill`。 Sets whether skill files are automatically uploaded. |
public boolean isAutoUploadSkill() | 判断是否 `isAutoUploadSkill`。 Checks whether skill files are automatically uploaded. |
public Path getCodeExecutionWorkDir() | 获取 `getCodeExecutionWorkDir`。 Gets the working directory for code execution. |
public void setWorkDir(Path workDir) | 设置 `setWorkDir`。 Sets a stable working directory for resource uploads and code execution. |
public AgentSkillPromptProvider getSkillPromptProvider() | 获取技能提示词提供者。 Exposes the skill prompt provider so callers (e.g. |
public Path getUploadDir() | 获取上传目录用于技能文件。 Gets the upload directory for skill files. |
public void uploadSkillFiles() | 执行上传技能文件相关操作。 Uploads skill files to the upload directory with the configured filter. |
构造器详情Constructor Detail
SkillBox
public SkillBox(Toolkit toolkit)
初始化 SkillBox 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
io/agentscope/core/skill/SkillBox.java:59–61SkillBox
public SkillBox(Toolkit toolkit, String instruction)
创建SkillBox 使用工具包和自定义技能提示词指令。
Creates a SkillBox with a toolkit and custom skill prompt instruction.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit to bind |
instruction | String | 指令(类型 `String`)。Custom instruction header (null or blank uses default) |
io/agentscope/core/skill/SkillBox.java:69–73方法详情Method Detail
copyForToolkit
public SkillBox copyForToolkit(Toolkit toolkit)
设置该参数。
Creates an agent-owned registry, prompt provider and loader bound to the given toolkit.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolkit | Toolkit | 智能体's 工具包。the agent's toolkit |
SkillBoxio/agentscope/core/skill/SkillBox.java:95–97getSkillPrompt
public String getSkillPrompt()
获取技能系统提示词用于已注册技能。
Gets the skill system prompt for registered skills.
Stringio/agentscope/core/skill/SkillBox.java:107–109getSkillPrompt
public String getSkillPrompt(SkillFilter filter)
获取技能提示词。
Gets the skill system prompt filtered by the given SkillFilter.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
filter | SkillFilter | 过滤条件(类型 `SkillFilter`)。the filter deciding which skills to include (null treated as all) |
Stringio/agentscope/core/skill/SkillBox.java:117–119setExposeAllSkillMetadata
public void setExposeAllSkillMetadata(boolean exposeAllMetadata)
设置 setExposeAllSkillMetadata。
Controls whether the skill prompt exposes all metadata fields or only the core fields.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
exposeAllMetadata | boolean | expose 所有元数据(类型 `boolean`)。`true` to expose all metadata, `false` to expose only the core fields |
io/agentscope/core/skill/SkillBox.java:130–132registration
public SkillRegistration registration()
返回注册。
Create a fluent builder for registering skills with optional configuration.
SkillRegistrationio/agentscope/core/skill/SkillBox.java:153–155bindToolkit
public void bindToolkit(Toolkit toolkit)
设置该参数。
Binds the shared toolkit to this skill box and its internal skill tool factory.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit to bind to the skill box |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if the toolkit is null
io/agentscope/core/skill/SkillBox.java:163–169registerSkill
public void registerSkill(AgentSkill skill)
注册技能。
Registers an agent skill.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skill | AgentSkill | 智能体技能到注册。The agent skill to register |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if skill is null
io/agentscope/core/skill/SkillBox.java:198–206getAllSkillIds
public Set<String> getAllSkillIds()
获取所有技能 IDs。
Gets all skill IDs.
Set<String>io/agentscope/core/skill/SkillBox.java:212–214getSkill
public AgentSkill getSkill(String skillId)
获取技能。
Gets a skill by ID (latest version).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillId | String | 技能标识。The skill ID |
AgentSkillIllegalArgumentException可能抛出 `IllegalArgumentException`。if skillId is null
io/agentscope/core/skill/SkillBox.java:245–250removeSkill
public void removeSkill(String skillId)
移除技能。
Removes a skill completely.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillId | String | 技能标识。The skill ID |
IllegalArgumentException可能抛出 `IllegalArgumentException`。if skillId is null
io/agentscope/core/skill/SkillBox.java:258–264exists
public boolean exists(String skillId)
判断数据是否存在。
Checks if a skill exists.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
skillId | String | 技能标识。The skill ID |
booleanIllegalArgumentException可能抛出 `IllegalArgumentException`。if skillId is null
io/agentscope/core/skill/SkillBox.java:273–278registerSkillLoadTool
public void registerSkillLoadTool()
注册技能加载工具。
Registers skill access tools to the provided toolkit.
IllegalArgumentException可能抛出 `IllegalArgumentException`。if toolkit is null
io/agentscope/core/skill/SkillBox.java:541–561setAutoUploadSkill
public void setAutoUploadSkill(boolean autoUploadSkill)
设置 setAutoUploadSkill。
Sets whether skill files are automatically uploaded.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
autoUploadSkill | boolean | auto 上传技能(类型 `boolean`)。true to automatically upload skill files |
io/agentscope/core/skill/SkillBox.java:568–570isAutoUploadSkill
public boolean isAutoUploadSkill()
判断是否 isAutoUploadSkill。
Checks whether skill files are automatically uploaded.
booleanio/agentscope/core/skill/SkillBox.java:577–579getCodeExecutionWorkDir
public Path getCodeExecutionWorkDir()
获取 getCodeExecutionWorkDir。
Gets the working directory for code execution.
Pathio/agentscope/core/skill/SkillBox.java:586–588setWorkDir
public void setWorkDir(Path workDir)
设置 setWorkDir。
Sets a stable working directory for resource uploads and code execution.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
workDir | Path | work 目录(类型 `Path`)。the directory under which `skills/ /` subtrees are written; `null` (the default) preserves the legacy per-instance tempdir behavior |
io/agentscope/core/skill/SkillBox.java:600–605getSkillPromptProvider
public AgentSkillPromptProvider getSkillPromptProvider()
获取技能提示词提供者。
Exposes the skill prompt provider so callers (e.g.
AgentSkillPromptProviderio/agentscope/core/skill/SkillBox.java:612–614getUploadDir
public Path getUploadDir()
获取上传目录用于技能文件。
Gets the upload directory for skill files.
Pathio/agentscope/core/skill/SkillBox.java:621–623uploadSkillFiles
public void uploadSkillFiles()
执行上传技能文件相关操作。
Uploads skill files to the upload directory with the configured filter.
io/agentscope/core/skill/SkillBox.java:694–762嵌套类详情Nested Class Detail
SkillRegistration
public static class SkillRegistration技能注册,让智能体以受控方式调用外部能力。位于 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.