Class GoalOrientedPlanner

java.lang.Object
com.google.adk.planner.goap.GoalOrientedPlanner
All Implemented Interfaces:
Planner

public final class GoalOrientedPlanner extends Object implements Planner
A planner that resolves agent execution order based on input/output dependencies and a target goal (output key).

Given agent metadata declaring what each agent reads (inputKeys) and writes (outputKey), this planner uses backward-chaining dependency resolution to compute the execution path from initial preconditions to the goal.

Example:

  Agent A: inputs=[], output="person"
  Agent B: inputs=[], output="sign"
  Agent C: inputs=["person", "sign"], output="horoscope"
  Agent D: inputs=["person", "horoscope"], output="writeup"
  Goal: "writeup"

  Resolved groups: [A, B] → [C] → [D]
  (A and B are independent and run in parallel)

Supports configurable failure handling via ReplanPolicy:

Supports pluggable search strategies via SearchStrategy: backward-chaining DFS (DfsSearchStrategy) or forward A* (AStarSearchStrategy).

  • Constructor Details

  • Method Details

    • init

      public void init(PlanningContext context)
      Description copied from interface: Planner
      Initialize the planner with context and available agents. Called once before the planning loop starts.

      Default implementation is a no-op. Override to perform setup like building dependency graphs.

      Specified by:
      init in interface Planner
    • firstAction

      public io.reactivex.rxjava3.core.Single<PlannerAction> firstAction(PlanningContext context)
      Description copied from interface: Planner
      Select the first action to execute.
      Specified by:
      firstAction in interface Planner
    • nextAction

      public io.reactivex.rxjava3.core.Single<PlannerAction> nextAction(PlanningContext context)
      Description copied from interface: Planner
      Select the next action based on updated state and events.
      Specified by:
      nextAction in interface Planner