Class GoalOrientedPlanner

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

public class GoalOrientedPlanner extends Object implements dev.langchain4j.agentic.planner.Planner
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    dev.langchain4j.agentic.planner.Action
    firstAction(dev.langchain4j.agentic.planner.PlanningContext planningContext)
     
    void
    init(dev.langchain4j.agentic.planner.InitPlanningContext initPlanningContext)
     
    dev.langchain4j.agentic.planner.Action
    nextAction(dev.langchain4j.agentic.planner.PlanningContext planningContext)
     
    void
    GoalOrientedPlanner does not persist execution state because firstAction(PlanningContext) recomputes the path from the current scope state via graph search.
    dev.langchain4j.agentic.planner.AgenticSystemTopology
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface dev.langchain4j.agentic.planner.Planner

    as, call, call, done, done, executionState, noOp, terminated
  • Constructor Details

    • GoalOrientedPlanner

      public GoalOrientedPlanner()
  • 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
    • 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 dev.langchain4j.agentic.planner.Planner
    • topology

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