类 SkillFilter

java.lang.Object
io.agentscope.core.skill.SkillFilter

public class SkillFilter extends Object
Immutable filter that decides which skills are allowed in a prompt.

Two usage patterns:

When no SkillFilter is configured, the default behaviour is all() — every skill is enabled.

Usage example:


 // Builder level: only allow two skills
 SkillFilter base = SkillFilter.only("skill_a", "skill_b");

 // Runtime: disable one of them for this call
 SkillFilter runtime = SkillFilter.disable("skill_b");

 // Merge: skill_a enabled, skill_b disabled
 SkillFilter effective = base.overlay(runtime);
 
  • 方法详细资料

    • all

      public static SkillFilter all()
      All skills enabled (default when no filter is configured).
    • none

      public static SkillFilter none()
      All skills disabled.
    • only

      public static SkillFilter only(String... skillNames)
      Whitelist: only the named skills are allowed.
    • except

      public static SkillFilter except(String... skillNames)
      Blacklist: all skills except the named ones are allowed.
    • enable

      public static SkillFilter enable(String... skillNames)
      Overlay: explicitly enable these skills (others unchanged).
    • disable

      public static SkillFilter disable(String... skillNames)
      Overlay: explicitly disable these skills (others unchanged).
    • isAllowed

      public boolean isAllowed(String skillName)
      Whether the given skill is allowed by this filter.
      参数:
      skillName - the skill name to check
      返回:
      true if allowed
    • isOverlay

      public boolean isOverlay()
      Whether this filter is an overlay (partial override) rather than a standalone filter.
      返回:
      true if this is an overlay filter
    • overlay

      public SkillFilter overlay(SkillFilter runtimeOverlay)
      Merge this (base) filter with a runtime overlay.

      Skills explicitly mentioned in the overlay use the overlay's decision. Skills not mentioned in the overlay fall through to this base filter.

      If runtimeOverlay is null or is not an overlay filter, it replaces this filter entirely.

      参数:
      runtimeOverlay - the per-call override (may be null)
      返回:
      the effective filter