AS AgentScopeAPI 手册 / API Reference

SkillPromptBuilder

@SuppressWarnings("deprecation") public final class SkillPromptBuilder
源码Source 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-null filesRoot (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_HEADER
staticfinal
String
默认请求头字段。
The DEFAULT HEADER field.
DEFAULT_CODE_EXECUTION_INSTRUCTION
staticfinal
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
staticfinal

默认请求头字段。声明为 public static final String DEFAULT_HEADER。

The DEFAULT HEADER field.

源码Source io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:47–74

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/harness/agent/skill/runtime/SkillPromptBuilder.java:76–92

构造器详情Constructor Detail

SkillPromptBuilder

public SkillPromptBuilder()

初始化 SkillPromptBuilder 实例。

Creates a new instance.

源码Source io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:98–100

SkillPromptBuilder

public SkillPromptBuilder(String header, String codeExecutionInstruction, boolean exposeAllMetadata)

初始化 SkillPromptBuilder 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
headerString请求头(类型 `String`)。The header.
codeExecutionInstructionStringcode 执行指令(类型 `String`)。The code execution instruction.
exposeAllMetadatabooleanexpose 所有元数据(类型 `boolean`)。The expose all metadata.
源码Source io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:102–110

方法详情Method Detail

render

public String render(SkillCatalog catalog, SkillFilter filter)

设置渲染。

Render the prompt block.

参数Parameters
名称Name类型Type说明Description
catalogSkillCatalog目录(类型 `SkillCatalog`)。the per-call snapshot (non-null)
filterSkillFilter过滤条件(类型 `SkillFilter`)。visibility filter applied per skillId (non-null; use `SkillFilter#all()`)
返回Returns String
返回字符串结果。prompt text, or empty string when nothing is visible
源码Source io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:120–158

render

public String render(SkillCatalog catalog)

设置渲染。

Convenience overload used by the middleware when no extra filter is active.

参数Parameters
名称Name类型Type说明Description
catalogSkillCatalog目录(类型 `SkillCatalog`)。The catalog.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/skill/runtime/SkillPromptBuilder.java:161–163
基于官方固定版本源码静态生成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.