Class SkillUsageMiddleware

java.lang.Object
io.agentscope.harness.agent.middleware.SkillUsageMiddleware
All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase, HarnessRuntimeMiddleware

public class SkillUsageMiddleware extends Object implements HarnessRuntimeMiddleware
Bumps SkillUsageStore counters whenever the agent invokes a SkillBox-registered skill loader (e.g. load_skill_through_path). Provenance gating happens inside the store — only skills tagged created_by="agent" or "agent-draft" are recorded.

Counter bumping is best-effort and runs eagerly when onActing is entered (before the actual tool call returns). The semantics are "the model decided to invoke this skill on this turn" — not "the call succeeded". This matches hermes-agent's telemetry shape and is cheap to compute.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>
    onActing(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ActingInput input, Function<io.agentscope.core.middleware.ActingInput,reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.agentscope.core.middleware.MiddlewareBase

    onAgent, onModelCall, onReasoning, onSystemPrompt, order
  • Constructor Details

    • SkillUsageMiddleware

      public SkillUsageMiddleware(SkillUsageStore usageStore)
  • Method Details

    • onActing

      public reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent> onActing(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ActingInput input, Function<io.agentscope.core.middleware.ActingInput,reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next)
      Specified by:
      onActing in interface io.agentscope.core.middleware.MiddlewareBase