SkillRuntime
public final class SkillRuntime
io/agentscope/harness/agent/skill/runtime/SkillRuntime.java:36–154技能运行时,让智能体以受控方式调用外部能力。位于 io.agentscope.harness.agent.skill.runtime 包。核心成员包括 currentCatalog、loadTool、prepareToolkit、install、renderPrompt、SkillRuntime。
Aggregates the singleton SkillLoadTool and the SkillPromptBuilder. io.agentscope.harness.agent.middleware.HarnessSkillMiddleware owns one instance and installs
each filtered SkillCatalog into that call's RuntimeContext.
The load_skill_through_path tool is prepared during agent construction and verified
idempotently on later installs. Normal tool calls resolve the catalog from their RuntimeContext, so concurrent sessions cannot overwrite or observe one another's filtered skill
view. A separate compatibility catalog is retained only for deprecated, context-free callers.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public SkillRuntime() | 初始化 `SkillRuntime` 实例。 Creates a new instance. |
public SkillRuntime(SkillPromptBuilder promptBuilder) | 初始化 `SkillRuntime` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public SkillCatalog currentCatalog()deprecated | 返回当前目录。 Returns the catalog installed through the deprecated context-free API. |
public SkillCatalog currentCatalog(RuntimeContext context) | 设置当前目录。 Returns the catalog bound to `context`, or an empty catalog when none is bound. |
public AgentTool loadTool() | 加载工具。 Underlying stateless tool instance. |
public void prepareToolkit(Toolkit toolkit) | 设置该参数。 Ensures the skill loading tool is present as an ungrouped tool. |
public void install(SkillCatalog catalog, RuntimeContext context, Toolkit toolkit) | 执行 `install` 方法。 Bind a catalog to the current call and ensure the load tool is registered on the toolkit
(idempotent). |
public void install(SkillCatalog catalog, Toolkit toolkit)deprecated | 执行 `install` 方法。 Installs a catalog for legacy context-free callers. |
public String renderPrompt(SkillCatalog catalog, SkillFilter filter) | 渲染提示词。 Renders the `<available_skills>` block + (when applicable) the code-execution prompt. |
构造器详情Constructor Detail
SkillRuntime
public SkillRuntime()
初始化 SkillRuntime 实例。
Creates a new instance.
io/agentscope/harness/agent/skill/runtime/SkillRuntime.java:46–48SkillRuntime
public SkillRuntime(SkillPromptBuilder promptBuilder)
初始化 SkillRuntime 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
promptBuilder | SkillPromptBuilder | 提示词构建器(类型 `SkillPromptBuilder`)。The prompt builder. |
io/agentscope/harness/agent/skill/runtime/SkillRuntime.java:50–53方法详情Method Detail
currentCatalog
public SkillCatalog currentCatalog()
返回当前目录。
Returns the catalog installed through the deprecated context-free API.
SkillCatalogio/agentscope/harness/agent/skill/runtime/SkillRuntime.java:60–63currentCatalog
public SkillCatalog currentCatalog(RuntimeContext context)
设置当前目录。
Returns the catalog bound to context, or an empty catalog when none is bound.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
context | RuntimeContext | 上下文(类型 `RuntimeContext`)。The context. |
SkillCatalogio/agentscope/harness/agent/skill/runtime/SkillRuntime.java:66–68loadTool
public AgentTool loadTool()
加载工具。
Underlying stateless tool instance.
AgentToolio/agentscope/harness/agent/skill/runtime/SkillRuntime.java:82–84prepareToolkit
public void prepareToolkit(Toolkit toolkit)
设置该参数。
Ensures the skill loading tool is present as an ungrouped tool.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
io/agentscope/harness/agent/skill/runtime/SkillRuntime.java:94–110install
public void install(SkillCatalog catalog, RuntimeContext context, Toolkit toolkit)
执行 install 方法。
Bind a catalog to the current call and ensure the load tool is registered on the toolkit (idempotent).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
catalog | SkillCatalog | 目录(类型 `SkillCatalog`)。the call snapshot; pass `SkillCatalog#empty()` to clear visibility |
context | RuntimeContext | 上下文(类型 `RuntimeContext`)。the current call context; may be `null`, in which case no catalog is exposed |
toolkit | Toolkit | 工具包(类型 `Toolkit`)。the toolkit to install onto; may be `null` (then only catalog is updated) |
io/agentscope/harness/agent/skill/runtime/SkillRuntime.java:125–130install
public void install(SkillCatalog catalog, Toolkit toolkit)
执行 install 方法。
Installs a catalog for legacy context-free callers.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
catalog | SkillCatalog | 目录(类型 `SkillCatalog`)。The catalog. |
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
io/agentscope/harness/agent/skill/runtime/SkillRuntime.java:141–146renderPrompt
public String renderPrompt(SkillCatalog catalog, SkillFilter filter)
渲染提示词。
Renders the block + (when applicable) the code-execution prompt.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
catalog | SkillCatalog | 目录(类型 `SkillCatalog`)。The catalog. |
filter | SkillFilter | 过滤条件(类型 `SkillFilter`)。The filter. |
Stringio/agentscope/harness/agent/skill/runtime/SkillRuntime.java:149–153