Class BlackboardPlanner

java.lang.Object
dev.langchain4j.agentic.patterns.blackboard.BlackboardPlanner
All Implemented Interfaces:
dev.langchain4j.agentic.planner.Planner

public class BlackboardPlanner extends Object implements dev.langchain4j.agentic.planner.Planner
A blackboard planner that activates agents based on data availability in the shared scope.

Agents are knowledge sources that post partial results to the AgenticScope (the blackboard). After each agent completes, the planner inspects the blackboard and activates whichever single agent can contribute next. When multiple agents are ready, a ConflictResolutionStrategy determines which one fires; if no strategy is provided, declaration order is used.

The planner terminates when:

  • The goal predicate is satisfied (by default, when the planner's outputKey is present in scope)
  • No agent can fire (quiescence)
  • The maximum number of invocations is reached
  • Constructor Details

    • BlackboardPlanner

      public BlackboardPlanner()
    • BlackboardPlanner

      public BlackboardPlanner(Predicate<dev.langchain4j.agentic.scope.AgenticScope> goalPredicate)
    • BlackboardPlanner

      public BlackboardPlanner(ConflictResolutionStrategy conflictResolutionStrategy)
    • BlackboardPlanner

      public BlackboardPlanner(Predicate<dev.langchain4j.agentic.scope.AgenticScope> goalPredicate, int maxInvocations)
    • BlackboardPlanner

      public BlackboardPlanner(Predicate<dev.langchain4j.agentic.scope.AgenticScope> goalPredicate, ConflictResolutionStrategy conflictResolutionStrategy)
    • BlackboardPlanner

      public BlackboardPlanner(Predicate<dev.langchain4j.agentic.scope.AgenticScope> goalPredicate, int maxInvocations, ConflictResolutionStrategy conflictResolutionStrategy)
  • Method Details

    • init

      public void init(dev.langchain4j.agentic.planner.InitPlanningContext initPlanningContext)
      Specified by:
      init in interface dev.langchain4j.agentic.planner.Planner
    • firstAction

      public dev.langchain4j.agentic.planner.Action firstAction(dev.langchain4j.agentic.planner.PlanningContext planningContext)
      Specified by:
      firstAction in interface dev.langchain4j.agentic.planner.Planner
    • nextAction

      public dev.langchain4j.agentic.planner.Action nextAction(dev.langchain4j.agentic.planner.PlanningContext planningContext)
      Specified by:
      nextAction in interface dev.langchain4j.agentic.planner.Planner
    • executionState

      public Map<String,Object> executionState()
      Specified by:
      executionState in interface dev.langchain4j.agentic.planner.Planner
    • restoreExecutionState

      public void restoreExecutionState(Map<String,Object> state)
      Specified by:
      restoreExecutionState in interface dev.langchain4j.agentic.planner.Planner
    • topology

      public dev.langchain4j.agentic.planner.AgenticSystemTopology topology()
      Specified by:
      topology in interface dev.langchain4j.agentic.planner.Planner