Class SkillRuntime

java.lang.Object
io.agentscope.harness.agent.skill.runtime.SkillRuntime

public final class SkillRuntime extends Object
Aggregates the singleton SkillLoadTool and the SkillPromptBuilder. 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 Details

    • SkillRuntime

      public SkillRuntime()
    • SkillRuntime

      public SkillRuntime(SkillPromptBuilder promptBuilder)
  • Method Details

    • currentCatalog

      @Deprecated(since="2.2.0") public SkillCatalog currentCatalog()
      Deprecated.
      Use currentCatalog(RuntimeContext) so catalog lookup is request-scoped.
      Returns the catalog installed through the deprecated context-free API.
    • currentCatalog

      public SkillCatalog currentCatalog(io.agentscope.core.agent.RuntimeContext context)
      Returns the catalog bound to context, or an empty catalog when none is bound.
    • loadTool

      public io.agentscope.core.tool.AgentTool loadTool()
      Underlying stateless tool instance. Use install(SkillCatalog, RuntimeContext, Toolkit) for normal flow.
    • prepareToolkit

      public void prepareToolkit(io.agentscope.core.tool.Toolkit toolkit)
      Ensures the skill loading tool is present as an ungrouped tool.

      Harness calls this while the agent toolkit is still being assembled. The toolkit copy made by ReActAgent.Builder therefore contains the tool before its first model call. Keeping the loader ungrouped is intentional: ungrouped tools remain visible regardless of a session's persisted active-group list, including sessions created before the loader existed.

    • install

      public void install(SkillCatalog catalog, io.agentscope.core.agent.RuntimeContext context, io.agentscope.core.tool.Toolkit toolkit)
      Bind a catalog to the current call and ensure the load tool is registered on the toolkit (idempotent).

      The catalog is deliberately stored on context, not on this shared runtime. This is the authorization boundary used by SkillLoadTool; a skill omitted from the call's filtered catalog cannot be loaded even while another session exposes it.

      Parameters:
      catalog - the call snapshot; pass SkillCatalog.empty() to clear visibility
      context - the current call context; may be null, in which case no catalog is exposed
      toolkit - the toolkit to install onto; may be null (then only catalog is updated)
    • install

      @Deprecated(since="2.2.0") public void install(SkillCatalog catalog, io.agentscope.core.tool.Toolkit toolkit)
      Installs a catalog for legacy context-free callers.

      This overload is retained for source and binary compatibility. Its catalog is used only when SkillLoadTool is invoked without a RuntimeContext; context-bearing calls never fall back to it and therefore remain isolated.

    • renderPrompt

      public String renderPrompt(SkillCatalog catalog, io.agentscope.core.skill.SkillFilter filter)
      Renders the <available_skills> block + (when applicable) the code-execution prompt.