Class ExplicitMarkingStrategy

java.lang.Object
io.agentscope.core.training.strategy.ExplicitMarkingStrategy
All Implemented Interfaces:
TrainingSelectionStrategy

public class ExplicitMarkingStrategy extends Object implements TrainingSelectionStrategy
Explicit Marking Strategy - Selection strategy based on user explicit marking

Training only occurs when user explicitly marks via TrainingContext

Usage example:


 // Create strategy
 TrainingSelectionStrategy strategy = ExplicitMarkingStrategy.create();

 // Mark in user code
 TrainingContext.markForTraining("high-quality");
 agent.call(msg).block();  // This call will be trained
 
  • Method Details

    • create

      public static ExplicitMarkingStrategy create()
      Create explicit marking strategy
      Returns:
      Strategy instance
    • withTTL

      public static ExplicitMarkingStrategy withTTL(Duration ttl)
      Create explicit marking strategy with specified TTL
      Parameters:
      ttl - Validity period of marking
      Returns:
      Strategy instance
    • shouldSelect

      public SelectionDecision shouldSelect(io.agentscope.core.agent.Agent agent, List<io.agentscope.core.message.Msg> inputMessages, io.agentscope.core.message.Msg outputMessage, reactor.util.context.ContextView reactorContext)
      Description copied from interface: TrainingSelectionStrategy
      Decide whether the current Agent call should be used for training
      Specified by:
      shouldSelect in interface TrainingSelectionStrategy
      Parameters:
      agent - The Agent being called
      inputMessages - Input message list
      outputMessage - Output message
      reactorContext - Reactor context (for async scenarios)
      Returns:
      Selection decision result, including whether to train and related metadata
    • priority

      public int priority()
      Description copied from interface: TrainingSelectionStrategy
      Priority of the strategy (lower number means higher priority)

      When multiple strategies are combined, higher priority strategies execute first

      Specified by:
      priority in interface TrainingSelectionStrategy
      Returns:
      Priority value, defaults to 100
    • name

      public String name()
      Description copied from interface: TrainingSelectionStrategy
      Name of the strategy (for logging and debugging)
      Specified by:
      name in interface TrainingSelectionStrategy
      Returns:
      Strategy name