Interface ConflictResolutionStrategy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Strategy for resolving conflicts when multiple agents can fire simultaneously on the blackboard.
The strategy receives the current scope state and all candidate agents that are ready to fire,
and returns which one should be activated.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ConflictResolutionStrategySelects the first candidate, preserving the declaration order used in thesubAgentsmethod. -
Method Summary
Modifier and TypeMethodDescriptionstatic ConflictResolutionStrategyagentOfType(Class<?> agentType) Returns a strategy that unconditionally selects the candidate matchingagentType, ornullif no candidate of that type is present.static ConflictResolutionStrategyagentOfType(Class<?> agentType, Predicate<AgenticScope> condition) Returns a strategy that selects the candidate matchingagentTypeonly whenconditionis satisfied, ornullotherwise.static ConflictResolutionStrategyagentWithName(String agentName) Returns a strategy that unconditionally selects the candidate matchingagentName, ornullif no candidate with that name is present.static ConflictResolutionStrategyagentWithName(String agentName, Predicate<AgenticScope> condition) Returns a strategy that selects the candidate matchingagentNameonly whenconditionis satisfied, ornullotherwise.static ConflictResolutionStrategyReturns a strategy that selects the first candidate in declaration order.default ConflictResolutionStrategyor(ConflictResolutionStrategy other) Chains this strategy with a fallback: if this strategy returnsnull, theotherstrategy is applied instead.resolve(AgenticScope scope, List<AgentInstance> candidates) static ConflictResolutionStrategyselectAgent(Predicate<AgentInstance> agentFilter) Returns a strategy that unconditionally selects the first candidate matchingagentFilter, ornullif no candidate matches.static ConflictResolutionStrategyselectAgent(Predicate<AgentInstance> agentFilter, Predicate<AgenticScope> condition) Returns a strategy that selects the first candidate matchingagentFilteronly whenconditionis satisfied, ornullotherwise.
-
Field Details
-
DECLARATION_ORDER
Selects the first candidate, preserving the declaration order used in thesubAgentsmethod.
-
-
Method Details
-
resolve
-
declarationOrder
Returns a strategy that selects the first candidate in declaration order. This is the default strategy used byBlackboardPlannerif no strategy is provided. -
agentOfType
static ConflictResolutionStrategy agentOfType(Class<?> agentType, Predicate<AgenticScope> condition) Returns a strategy that selects the candidate matchingagentTypeonly whenconditionis satisfied, ornullotherwise. Intended to be chained withor(ConflictResolutionStrategy). -
agentOfType
Returns a strategy that unconditionally selects the candidate matchingagentType, ornullif no candidate of that type is present. -
agentWithName
static ConflictResolutionStrategy agentWithName(String agentName, Predicate<AgenticScope> condition) Returns a strategy that selects the candidate matchingagentNameonly whenconditionis satisfied, ornullotherwise. Intended to be chained withor(ConflictResolutionStrategy). -
agentWithName
Returns a strategy that unconditionally selects the candidate matchingagentName, ornullif no candidate with that name is present. -
selectAgent
static ConflictResolutionStrategy selectAgent(Predicate<AgentInstance> agentFilter, Predicate<AgenticScope> condition) Returns a strategy that selects the first candidate matchingagentFilteronly whenconditionis satisfied, ornullotherwise. Intended to be chained withor(ConflictResolutionStrategy). -
selectAgent
Returns a strategy that unconditionally selects the first candidate matchingagentFilter, ornullif no candidate matches. -
or
Chains this strategy with a fallback: if this strategy returnsnull, theotherstrategy is applied instead.
-