Class GoalOrientedPlanner

java.lang.Object
dev.langchain4j.agentic.patterns.goap.GoalOrientedPlanner
All Implemented Interfaces:
Planner

public class GoalOrientedPlanner extends Object implements Planner
  • Constructor Details

    • GoalOrientedPlanner

      public GoalOrientedPlanner()
  • Method Details

    • init

      public void init(InitPlanningContext initPlanningContext)
      Specified by:
      init in interface Planner
    • firstAction

      public Action firstAction(PlanningContext planningContext)
      Specified by:
      firstAction in interface Planner
    • nextAction

      public Action nextAction(PlanningContext planningContext)
      Specified by:
      nextAction in interface Planner
    • restoreExecutionState

      public void restoreExecutionState(Map<String,Object> state)
      GoalOrientedPlanner does not persist execution state because firstAction(PlanningContext) recomputes the path from the current scope state via graph search. On recovery, completed agents' outputs are already in scope, so the search produces a shorter path containing only the remaining agents. The cursor resets to 0 naturally, making state persistence unnecessary and potentially harmful (a stale cursor could point beyond the bounds of the recomputed path).
      Specified by:
      restoreExecutionState in interface Planner
      Parameters:
      state - the previously saved execution state
    • topology

      public AgenticSystemTopology topology()
      Specified by:
      topology in interface Planner