类 AgentSkillPromptProvider

java.lang.Object
io.agentscope.core.skill.AgentSkillPromptProvider

public class AgentSkillPromptProvider extends Object
Generates skill system prompts for agents to understand available skills.

This provider creates system prompts containing information about available skills that the LLM can dynamically load and use.

Usage example:


 AgentSkillPromptProvider provider = new AgentSkillPromptProvider(registry);
 String prompt = provider.getSkillSystemPrompt();
 
  • 字段详细资料

    • DEFAULT_AGENT_SKILL_INSTRUCTION

      public static final String DEFAULT_AGENT_SKILL_INSTRUCTION
      另请参阅:
    • DEFAULT_CODE_EXECUTION_INSTRUCTION

      public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION
      另请参阅:
  • 构造器详细资料

    • AgentSkillPromptProvider

      public AgentSkillPromptProvider(io.agentscope.core.skill.SkillRegistry registry)
      Creates a skill prompt provider.
      参数:
      registry - The skill registry containing registered skills
    • AgentSkillPromptProvider

      public AgentSkillPromptProvider(io.agentscope.core.skill.SkillRegistry registry, String instruction)
      Creates a skill prompt provider with custom instruction.
      参数:
      registry - The skill registry containing registered skills
      instruction - Custom instruction header (null or blank uses default)
  • 方法详细资料

    • getSkillSystemPrompt

      public String getSkillSystemPrompt()
      Gets the skill system prompt for the agent.

      Generates a system prompt containing all registered skills.

      返回:
      The skill system prompt, or empty string if no skills exist
    • setCodeExecutionEnable

      public void setCodeExecutionEnable(boolean codeExecutionEnabled)
      Sets whether code execution instructions are included in the skill system prompt.
      参数:
      codeExecutionEnabled - true to append code execution instructions
    • setUploadDir

      public void setUploadDir(Path uploadDir)
      Sets the upload directory whose absolute path replaces every %s placeholder in the code execution instruction template.
      参数:
      uploadDir - the upload directory path, or null to disable path substitution
    • setCodeExecutionInstruction

      public void setCodeExecutionInstruction(String codeExecutionInstruction)
      Sets a custom code execution instruction template.

      Every %s placeholder in the template will be replaced with the uploadDir absolute path. Pass null or blank to fall back to DEFAULT_CODE_EXECUTION_INSTRUCTION.

      参数:
      codeExecutionInstruction - the custom template, or null/blank for default
    • setExposeAllMetadata

      public void setExposeAllMetadata(boolean exposeAllMetadata)
      Sets whether all metadata fields are exposed to the LLM.

      When disabled, only name, description, and skill-id are rendered into the skill prompt.

      参数:
      exposeAllMetadata - true to expose all metadata, false to expose only the core fields