Class ConditionalHandoff

java.lang.Object
com.tnsai.coordination.handoff.ConditionalHandoff

public class ConditionalHandoff extends Object
Routes a handoff to the first agent whose predicate matches the context. Falls back to an optional default ("otherwise") agent.
  • Constructor Details

    • ConditionalHandoff

      public ConditionalHandoff()
  • Method Details

    • when

      public ConditionalHandoff when(Predicate<HandoffContext> predicate, com.tnsai.agents.Agent target)
      Adds a conditional route.
    • otherwise

      public ConditionalHandoff otherwise(com.tnsai.agents.Agent target)
      Sets the default target when no predicate matches.
    • execute

      public HandoffResult execute(Handoff handoff, com.tnsai.agents.Agent from, HandoffContext ctx)
      Evaluates routes in order and executes the handoff to the first matching target.
      Parameters:
      handoff - the handoff strategy
      from - the source agent
      ctx - the handoff context
      Returns:
      the handoff result, or a failure if no route matched