AS AgentScopeAPI 手册 / API Reference

SkillBox

public class SkillBox
源码Source 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.

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

SkillBox

public SkillBox(Toolkit toolkit, String instruction)

创建SkillBox 使用工具包和自定义技能提示词指令。

Creates a SkillBox with a toolkit and custom skill prompt instruction.

参数Parameters
名称Name类型Type说明Description
toolkitToolkit工具包(类型 `Toolkit`)。The toolkit to bind
instructionString指令(类型 `String`)。Custom instruction header (null or blank uses default)
源码Source 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.

参数Parameters
名称Name类型Type说明Description
toolkitToolkit智能体's 工具包。the agent's toolkit
返回Returns SkillBox
返回SkillBox。an independent skill box
源码Source io/agentscope/core/skill/SkillBox.java:95–97

getSkillPrompt

public String getSkillPrompt()

获取技能系统提示词用于已注册技能。

Gets the skill system prompt for registered skills.

返回Returns String
返回字符串结果。The skill system prompt, or empty string if no skills exist
源码Source io/agentscope/core/skill/SkillBox.java:107–109

getSkillPrompt

public String getSkillPrompt(SkillFilter filter)

获取技能提示词。

Gets the skill system prompt filtered by the given SkillFilter.

参数Parameters
名称Name类型Type说明Description
filterSkillFilter过滤条件(类型 `SkillFilter`)。the filter deciding which skills to include (null treated as all)
返回Returns String
返回字符串结果。The skill system prompt, or empty string if no skills pass the filter
源码Source io/agentscope/core/skill/SkillBox.java:117–119

setExposeAllSkillMetadata

public void setExposeAllSkillMetadata(boolean exposeAllMetadata)

设置 setExposeAllSkillMetadata。

Controls whether the skill prompt exposes all metadata fields or only the core fields.

参数Parameters
名称Name类型Type说明Description
exposeAllMetadatabooleanexpose 所有元数据(类型 `boolean`)。`true` to expose all metadata, `false` to expose only the core fields
源码Source io/agentscope/core/skill/SkillBox.java:130–132

registration

public SkillRegistration registration()

返回注册。

Create a fluent builder for registering skills with optional configuration.

返回Returns SkillRegistration
一种新的ToolRegistration 构建器。A new ToolRegistration builder
源码Source io/agentscope/core/skill/SkillBox.java:153–155

bindToolkit

public void bindToolkit(Toolkit toolkit)

设置该参数。

Binds the shared toolkit to this skill box and its internal skill tool factory.

参数Parameters
名称Name类型Type说明Description
toolkitToolkit工具包(类型 `Toolkit`)。The toolkit to bind to the skill box
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if the toolkit is null
源码Source io/agentscope/core/skill/SkillBox.java:163–169

registerSkill

public void registerSkill(AgentSkill skill)

注册技能。

Registers an agent skill.

参数Parameters
名称Name类型Type说明Description
skillAgentSkill智能体技能到注册。The agent skill to register
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if skill is null
源码Source io/agentscope/core/skill/SkillBox.java:198–206

getAllSkillIds

public Set<String> getAllSkillIds()

获取所有技能 IDs。

Gets all skill IDs.

返回Returns Set<String>
返回设置。All skill IDs
源码Source io/agentscope/core/skill/SkillBox.java:212–214

getSkill

public AgentSkill getSkill(String skillId)

获取技能。

Gets a skill by ID (latest version).

参数Parameters
名称Name类型Type说明Description
skillIdString技能标识。The skill ID
返回Returns AgentSkill
返回AgentSkill。The skill instance, or null if not found
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if skillId is null
源码Source io/agentscope/core/skill/SkillBox.java:245–250

removeSkill

public void removeSkill(String skillId)

移除技能。

Removes a skill completely.

参数Parameters
名称Name类型Type说明Description
skillIdString技能标识。The skill ID
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if skillId is null
源码Source io/agentscope/core/skill/SkillBox.java:258–264

exists

public boolean exists(String skillId)

判断数据是否存在。

Checks if a skill exists.

参数Parameters
名称Name类型Type说明Description
skillIdString技能标识。The skill ID
返回Returns boolean
返回布尔值,表示判断结果。true if the skill exists, false otherwise
抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if skillId is null
源码Source io/agentscope/core/skill/SkillBox.java:273–278

registerSkillLoadTool

public void registerSkillLoadTool()

注册技能加载工具。

Registers skill access tools to the provided toolkit.

抛出Throws
  • IllegalArgumentException 可能抛出 `IllegalArgumentException`。if toolkit is null
源码Source io/agentscope/core/skill/SkillBox.java:541–561

setAutoUploadSkill

public void setAutoUploadSkill(boolean autoUploadSkill)

设置 setAutoUploadSkill。

Sets whether skill files are automatically uploaded.

参数Parameters
名称Name类型Type说明Description
autoUploadSkillbooleanauto 上传技能(类型 `boolean`)。true to automatically upload skill files
源码Source io/agentscope/core/skill/SkillBox.java:568–570

isAutoUploadSkill

public boolean isAutoUploadSkill()

判断是否 isAutoUploadSkill。

Checks whether skill files are automatically uploaded.

返回Returns boolean
返回布尔值,表示判断结果。true if skill files are automatically uploaded
源码Source io/agentscope/core/skill/SkillBox.java:577–579

getCodeExecutionWorkDir

public Path getCodeExecutionWorkDir()

获取 getCodeExecutionWorkDir。

Gets the working directory for code execution.

返回Returns Path
返回路径。The working directory path, or null if using temporary directory
源码Source io/agentscope/core/skill/SkillBox.java:586–588

setWorkDir

public void setWorkDir(Path workDir)

设置 setWorkDir。

Sets a stable working directory for resource uploads and code execution.

参数Parameters
名称Name类型Type说明Description
workDirPathwork 目录(类型 `Path`)。the directory under which `skills/ /` subtrees are written; `null` (the default) preserves the legacy per-instance tempdir behavior
源码Source io/agentscope/core/skill/SkillBox.java:600–605

getSkillPromptProvider

public AgentSkillPromptProvider getSkillPromptProvider()

获取技能提示词提供者。

Exposes the skill prompt provider so callers (e.g.

返回Returns AgentSkillPromptProvider
返回AgentSkillPromptProvider。Returns agent skill prompt provider.
源码Source io/agentscope/core/skill/SkillBox.java:612–614

getUploadDir

public Path getUploadDir()

获取上传目录用于技能文件。

Gets the upload directory for skill files.

返回Returns Path
返回路径。The upload directory path, or null if not configured
源码Source io/agentscope/core/skill/SkillBox.java:621–623

uploadSkillFiles

public void uploadSkillFiles()

执行上传技能文件相关操作。

Uploads skill files to the upload directory with the configured filter.

源码Source 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.

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