Package com.tnsai.coordination.handoff
Class ConditionalHandoff
java.lang.Object
com.tnsai.coordination.handoff.ConditionalHandoff
Routes a handoff to the first agent whose predicate matches the context.
Falls back to an optional default ("otherwise") agent.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionexecute(Handoff handoff, com.tnsai.agents.Agent from, HandoffContext ctx) Evaluates routes in order and executes the handoff to the first matching target.otherwise(com.tnsai.agents.Agent target) Sets the default target when no predicate matches.when(Predicate<HandoffContext> predicate, com.tnsai.agents.Agent target) Adds a conditional route.
-
Constructor Details
-
ConditionalHandoff
public ConditionalHandoff()
-
-
Method Details
-
when
Adds a conditional route. -
otherwise
Sets the default target when no predicate matches. -
execute
Evaluates routes in order and executes the handoff to the first matching target.- Parameters:
handoff- the handoff strategyfrom- the source agentctx- the handoff context- Returns:
- the handoff result, or a failure if no route matched
-