类 SkillBox
AgentSkill instances and exposes them as tools.-
嵌套类概要
嵌套类修饰符和类型类说明static class已过时。Fluent builder for registering skills with optional configuration. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidbindToolkit(Toolkit toolkit) 已过时。Binds a toolkit to the skill box.void已过时。Deactivates all skills.boolean已过时。Checks if a skill exists.已过时。Gets all skill IDs.已过时。Gets the working directory for code execution.已过时。Gets a skill by ID (latest version).已过时。Gets the skill system prompt for registered skills.getSkillPrompt(SkillFilter filter) 已过时。Gets the skill system prompt filtered by the givenSkillFilter.已过时。Exposes the skill prompt provider so callers (e.g.已过时。Gets the upload directory for skill files.boolean已过时。Checks whether skill files are automatically uploaded.booleanisSkillActive(String skillId) 已过时。Where the skill is active.voidregisterSkill(AgentSkill skill) 已过时。Registers an agent skill.void已过时。Registers skill access tools to the provided toolkit.已过时。Create a fluent builder for registering skills with optional configuration.voidremoveSkill(String skillId) 已过时。Removes a skill completely.voidsetAutoUploadSkill(boolean autoUploadSkill) 已过时。Sets whether skill files are automatically uploaded.voidsetExposeAllSkillMetadata(boolean exposeAllMetadata) 已过时。Controls whether the skill prompt exposes all metadata fields or only the core fields.voidsetSkillActive(String skillId, boolean active) 已过时。Sets the activation state of a specific skill.voidsetWorkDir(Path workDir) 已过时。Sets a stable working directory for resource uploads and code execution.void已过时。Synchronize tool group states based on skill activation status with a specific toolkit.void已过时。Uploads skill files to the upload directory with the configured filter.
-
构造器详细资料
-
SkillBox
已过时。 -
SkillBox
已过时。Creates a SkillBox with a toolkit and custom skill prompt instruction.- 参数:
toolkit- The toolkit to bindinstruction- Custom instruction header (null or blank uses default)
-
-
方法详细资料
-
getSkillPrompt
已过时。Gets the skill system prompt for registered skills.This prompt provides information about available skills that the agent can dynamically load and use during execution.
- 返回:
- The skill system prompt, or empty string if no skills exist
-
getSkillPrompt
已过时。Gets the skill system prompt filtered by the givenSkillFilter.- 参数:
filter- the filter deciding which skills to include (null treated as all)- 返回:
- The skill system prompt, or empty string if no skills pass the filter
-
setExposeAllSkillMetadata
public void setExposeAllSkillMetadata(boolean exposeAllMetadata) 已过时。Controls whether the skill prompt exposes all metadata fields or only the core fields.When disabled, only
name,description, andskill-idare included in the skill prompt.- 参数:
exposeAllMetadata-trueto expose all metadata,falseto expose only the core fields
-
registration
已过时。Create a fluent builder for registering skills with optional configuration.Example usage:
// Register skill skillBox.registration() .skill(skill) .apply(); // Register skill with tool skillBox.registration() .skill(skill) // same reference skill will not be registered again .tool(toolObject) .apply();- 返回:
- A new ToolRegistration builder
-
bindToolkit
已过时。Binds a toolkit to the skill box.This method binds the toolkit to both the skill box and its internal skill tool factory. Since ReActAgent uses a deep copy of the Toolkit, rebinding is necessary to ensure the skill tool factory references the correct toolkit instance.
- 参数:
toolkit- The toolkit to bind to the skill box- 抛出:
IllegalArgumentException- if the toolkit is null
-
syncToolGroupStates
public void syncToolGroupStates()已过时。Synchronize tool group states based on skill activation status with a specific toolkit.Updates the toolkit's tool groups to reflect the current activation state of skills. Active skills will have their tool groups enabled, inactive skills will have their tool groups disabled.
-
isSkillActive
已过时。Where the skill is active. If a skill is active, this means skill is being using by LLM. LLM use load tool activate the skill.- 参数:
skillId-- 返回:
- true if the skill is active
-
registerSkill
已过时。Registers an agent skill.Skills can be dynamically loaded by agents using skill access tools. When a skill is loaded, its associated tools become available to the agent.
Version Management:
- First registration: Creates initial version of the skill
- Subsequent registrations with same skill object (by reference): No new version created
- Registrations with different skill object: Creates new version (snapshot)
Usage example:
AgentSkill mySkill = new AgentSkill("my_skill", "Description", "Content", null); skillBox.registerSkill(mySkill); skillBox.registerSkill(my_skill); // do nothing- 参数:
skill- The agent skill to register- 抛出:
IllegalArgumentException- if skill is null
-
getAllSkillIds
已过时。Gets all skill IDs.- 返回:
- All skill IDs
-
getSkill
已过时。Gets a skill by ID (latest version).- 参数:
skillId- The skill ID- 返回:
- The skill instance, or null if not found
- 抛出:
IllegalArgumentException- if skillId is null
-
removeSkill
已过时。Removes a skill completely.- 参数:
skillId- The skill ID- 抛出:
IllegalArgumentException- if skillId is null
-
exists
已过时。Checks if a skill exists.- 参数:
skillId- The skill ID- 返回:
- true if the skill exists, false otherwise
- 抛出:
IllegalArgumentException- if skillId is null
-
setSkillActive
已过时。Sets the activation state of a specific skill.When a skill is set to inactive, its associated tool group will be disabled in the underlying toolkit, preventing the agent from accessing its tools until it is activated again.
This method automatically synchronizes the state change with the bound toolkit.
Warning on Deactivation: Setting a skill to inactive only unbinds its associated tool group. It does not automatically remove the skill's context or prompt instructions from the agent's memory. This is a risky operation, as the agent might still attempt to invoke the inactive tool based on its retained memory context, leading to execution failures. For a complete and ideal deactivation, it is recommended to implement custom hooks to unbind both the tool group and its associated context from memory.
- 参数:
skillId- The ID of the skill to modifyactive- true to activate the skill, false to deactivate- 抛出:
IllegalArgumentException- if skillId is null or the skill does not exist
-
deactivateAllSkills
public void deactivateAllSkills()已过时。Deactivates all skills.This method sets all registered skills to inactive state, which means their associated tool groups will not be available to the agent until the skills are accessed again via skill access tools.
This is typically called at the start of each agent call to ensure a clean state.
-
registerSkillLoadTool
public void registerSkillLoadTool()已过时。Registers skill access tools to the provided toolkit.This method registers the following tool:
- load_skill_through_path - Load skill resources or SKILL.md content. When a resource is not found, it automatically returns a list of available resources with SKILL.md as the first item.
- 抛出:
IllegalArgumentException- if toolkit is null
-
setAutoUploadSkill
public void setAutoUploadSkill(boolean autoUploadSkill) 已过时。Sets whether skill files are automatically uploaded.- 参数:
autoUploadSkill- true to automatically upload skill files
-
isAutoUploadSkill
public boolean isAutoUploadSkill()已过时。Checks whether skill files are automatically uploaded.- 返回:
- true if skill files are automatically uploaded
-
getCodeExecutionWorkDir
已过时。Gets the working directory for code execution.- 返回:
- The working directory path, or null if using temporary directory
-
setWorkDir
已过时。Sets a stable working directory for resource uploads and code execution. Callers can use this to share one workDir across multiple SkillBox instances (e.g.DynamicSkillMiddlewarerebuilds the box every call, but the workDir lives for the agent's lifetime souploadSkillFilesno longer mints a freshagentscope-code-execution-*tempdir each round).- 参数:
workDir- the directory under whichskills/<skillId>/subtrees are written;null(the default) preserves the legacy per-instance tempdir behavior
-
getSkillPromptProvider
已过时。Exposes the skill prompt provider so callers (e.g.DynamicSkillMiddleware) can togglecodeExecutionEnable, swap the instruction template, or query the resolved uploadDir without re-walking the SkillBox internals. -
getUploadDir
已过时。Gets the upload directory for skill files.- 返回:
- The upload directory path, or null if not configured
-
uploadSkillFiles
public void uploadSkillFiles()已过时。Uploads skill files to the upload directory with the configured filter.Upload directory resolution:
- If uploadDir is configured, use it.
- Otherwise, use workDir/skills (workDir may be a temporary directory).
If a file already exists, it will be overwritten.
-