SkillPromptBuilder
@SuppressWarnings("deprecation") public final class SkillPromptBuilder
io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:41–244技能提示词构建器,用于构建并配置目标实例。位于 io.agentscope.harness.agent.skill.runtime 包。核心成员包括 render、SkillPromptBuilder、DEFAULT_HEADER、DEFAULT_CODE_EXECUTION_INSTRUCTION。
Renders the harness <available_skills> system-prompt block from a SkillCatalog.
Differences from the legacy AgentSkillPromptProvider:
-
Each
<skill>optionally carries a<files-root>child giving the absolute path to that skill's files. The middleware decides whether to populate this based on shell availability and skill source. -
The
<code_execution>section is emitted only when at least one entry in the catalog has a non-nullfilesRoot(i.e. shell is available and at least one skill's files are reachable). The new instruction tells the LLM to use each skill's<files-root>rather than a single hardcoded root. -
Resource fallback for non-SKILL.md paths is implemented by
SkillLoadTool; the prompt does not need to mention it.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
DEFAULT_HEADERstaticfinal | String | 默认请求头字段。 The DEFAULT HEADER field. |
DEFAULT_CODE_EXECUTION_INSTRUCTIONstaticfinal | String | 默认 CODE 执行指令字段。 The DEFAULT CODE EXECUTION INSTRUCTION field. |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SkillPromptBuilder() | 初始化 `SkillPromptBuilder` 实例。 Creates a new instance. |
public SkillPromptBuilder(String header, String codeExecutionInstruction, boolean exposeAllMetadata) | 初始化 `SkillPromptBuilder` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String render(SkillCatalog catalog, SkillFilter filter) | 设置渲染。 Render the prompt block. |
public String render(SkillCatalog catalog) | 设置渲染。 Convenience overload used by the middleware when no extra filter is active. |
字段详情Field Detail
DEFAULT_HEADER
public static final String DEFAULT_HEADER
默认请求头字段。声明为 public static final String DEFAULT_HEADER。
The DEFAULT HEADER field.
io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:47–74DEFAULT_CODE_EXECUTION_INSTRUCTION
public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION
默认 CODE 执行指令字段。声明为 public static final String DEFAULT_CODE_EXECUTION_INSTRUCTION。
The DEFAULT CODE EXECUTION INSTRUCTION field.
io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:76–92构造器详情Constructor Detail
SkillPromptBuilder
public SkillPromptBuilder()
初始化 SkillPromptBuilder 实例。
Creates a new instance.
io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:98–100SkillPromptBuilder
public SkillPromptBuilder(String header, String codeExecutionInstruction, boolean exposeAllMetadata)
初始化 SkillPromptBuilder 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
header | String | 请求头(类型 `String`)。The header. |
codeExecutionInstruction | String | code 执行指令(类型 `String`)。The code execution instruction. |
exposeAllMetadata | boolean | expose 所有元数据(类型 `boolean`)。The expose all metadata. |
io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:102–110方法详情Method Detail
render
public String render(SkillCatalog catalog, SkillFilter filter)
设置渲染。
Render the prompt block.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
catalog | SkillCatalog | 目录(类型 `SkillCatalog`)。the per-call snapshot (non-null) |
filter | SkillFilter | 过滤条件(类型 `SkillFilter`)。visibility filter applied per skillId (non-null; use `SkillFilter#all()`) |
Stringio/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:120–158render
public String render(SkillCatalog catalog)
设置渲染。
Convenience overload used by the middleware when no extra filter is active.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
catalog | SkillCatalog | 目录(类型 `SkillCatalog`)。The catalog. |
Stringio/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:161–163