AS AgentScopeAPI 手册 / API Reference

AgentSkillPromptProvider

public class AgentSkillPromptProvider
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:38–390

智能体技能提示词提供者,让智能体以受控方式调用外部能力。位于 io.agentscope.core.skill 包。核心成员包括 getSkillSystemPrompt、setCodeExecutionEnable、setUploadDir、setCodeExecutionInstruction、setExposeAllMetadata、AgentSkillPromptProvider。

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();
`

字段摘要Field Summary

字段Field类型Type说明Description
DEFAULT_AGENT_SKILL_INSTRUCTION
staticfinal
String
默认智能体技能指令字段。
The DEFAULT AGENT SKILL INSTRUCTION field.
DEFAULT_CODE_EXECUTION_INSTRUCTION
staticfinal
String
默认 CODE 执行指令字段。
The DEFAULT CODE EXECUTION INSTRUCTION field.
DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION
staticfinal
String
默认每个技能 CODE 执行指令字段。
Code-execution instruction used when every visible skill carries its own ` <files-root>` (e.g.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentSkillPromptProvider(SkillRegistry registry)
创建技能提示词提供者。
Creates a skill prompt provider.
public AgentSkillPromptProvider(SkillRegistry registry, String instruction)
创建技能提示词提供者使用自定义指令。
Creates a skill prompt provider with custom instruction.

方法摘要Method Summary

方法Method说明Description
public String getSkillSystemPrompt()
获取技能系统提示词。
Gets the skill system prompt for the agent with all skills included.
public String getSkillSystemPrompt(SkillFilter filter)
获取技能系统提示词。
Gets the skill system prompt filtered by the given `SkillFilter`.
public void setCodeExecutionEnable(boolean codeExecutionEnabled)
设置 `setCodeExecutionEnable`。
Sets whether code execution instructions are included in the skill system prompt.
public void setUploadDir(Path uploadDir)
设置上传目录。
Sets the upload directory whose absolute path replaces every `%s` placeholder in the code execution instruction template.
public void setCodeExecutionInstruction(String codeExecutionInstruction)
设置 `setCodeExecutionInstruction`。
Sets a custom code execution instruction template.
public void setExposeAllMetadata(boolean exposeAllMetadata)
设置 `setExposeAllMetadata`。
Sets whether all metadata fields are exposed to the LLM.

字段详情Field Detail

DEFAULT_AGENT_SKILL_INSTRUCTION

public static final String DEFAULT_AGENT_SKILL_INSTRUCTION
staticfinal

默认智能体技能指令字段。声明为 public static final String DEFAULT_AGENT_SKILL_INSTRUCTION。

The DEFAULT AGENT SKILL INSTRUCTION field.

源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:49–75

DEFAULT_CODE_EXECUTION_INSTRUCTION

public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION
staticfinal

默认 CODE 执行指令字段。声明为 public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION。

The DEFAULT CODE EXECUTION INSTRUCTION field.

源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:78–110

DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION

public static final String DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION
staticfinal

默认每个技能 CODE 执行指令字段。声明为 public static final String DEFAULT_PER_SKILL_CODE_EXECUTION_INSTRUCTION。

Code-execution instruction used when every visible skill carries its own (e.g.

源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:118–134

构造器详情Constructor Detail

AgentSkillPromptProvider

public AgentSkillPromptProvider(SkillRegistry registry)

创建技能提示词提供者。

Creates a skill prompt provider.

参数Parameters
名称Name类型Type说明Description
registrySkillRegistry注册表(类型 `SkillRegistry`)。The skill registry containing registered skills
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:141–143

AgentSkillPromptProvider

public AgentSkillPromptProvider(SkillRegistry registry, String instruction)

创建技能提示词提供者使用自定义指令。

Creates a skill prompt provider with custom instruction.

参数Parameters
名称Name类型Type说明Description
registrySkillRegistry注册表(类型 `SkillRegistry`)。The skill registry containing registered skills
instructionString指令(类型 `String`)。Custom instruction header (null or blank uses default)
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:151–157

方法详情Method Detail

getSkillSystemPrompt

public String getSkillSystemPrompt()

获取技能系统提示词。

Gets the skill system prompt for the agent with all skills included.

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

getSkillSystemPrompt

public String getSkillSystemPrompt(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/AgentSkillPromptProvider.java:183–226

setCodeExecutionEnable

public void setCodeExecutionEnable(boolean codeExecutionEnabled)

设置 setCodeExecutionEnable。

Sets whether code execution instructions are included in the skill system prompt.

参数Parameters
名称Name类型Type说明Description
codeExecutionEnabledbooleancode 执行已启用(类型 `boolean`)。`true` to append code execution instructions
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:261–263

setUploadDir

public void setUploadDir(Path uploadDir)

设置上传目录。

Sets the upload directory whose absolute path replaces every %s placeholder in the code execution instruction template.

参数Parameters
名称Name类型Type说明Description
uploadDirPath上传目录(类型 `Path`)。the upload directory path, or `null` to disable path substitution
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:271–273

setCodeExecutionInstruction

public void setCodeExecutionInstruction(String codeExecutionInstruction)

设置 setCodeExecutionInstruction。

Sets a custom code execution instruction template.

参数Parameters
名称Name类型Type说明Description
codeExecutionInstructionStringcode 执行指令(类型 `String`)。the custom template, or `null`/blank for default
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:284–289

setExposeAllMetadata

public void setExposeAllMetadata(boolean exposeAllMetadata)

设置 setExposeAllMetadata。

Sets whether all metadata fields are exposed to the LLM.

参数Parameters
名称Name类型Type说明Description
exposeAllMetadatabooleanexpose 所有元数据(类型 `boolean`)。`true` to expose all metadata, `false` to expose only the core fields
源码Source io/agentscope/core/skill/AgentSkillPromptProvider.java:300–302
基于官方固定版本源码静态生成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.