Class GoalOrientedPlanner
java.lang.Object
com.google.adk.planner.goap.GoalOrientedPlanner
- All Implemented Interfaces:
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:
ReplanPolicy.Ignore— proceed regardless of missing outputs (default)ReplanPolicy.FailStop— halt on first missing outputReplanPolicy.Replan— recompute the remaining plan from current world state
Supports pluggable search strategies via SearchStrategy: backward-chaining DFS (DfsSearchStrategy) or forward A* (AStarSearchStrategy).
-
Constructor Summary
ConstructorsConstructorDescriptionGoalOrientedPlanner(String goal, List<AgentMetadata> metadata) GoalOrientedPlanner(String goal, List<AgentMetadata> metadata, boolean validateOutputs) GoalOrientedPlanner(String goal, List<AgentMetadata> metadata, SearchStrategy searchStrategy, ReplanPolicy replanPolicy) -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Single<PlannerAction> firstAction(PlanningContext context) Select the first action to execute.voidinit(PlanningContext context) Initialize the planner with context and available agents.io.reactivex.rxjava3.core.Single<PlannerAction> nextAction(PlanningContext context) Select the next action based on updated state and events.
-
Constructor Details
-
GoalOrientedPlanner
-
GoalOrientedPlanner
-
GoalOrientedPlanner
public GoalOrientedPlanner(String goal, List<AgentMetadata> metadata, SearchStrategy searchStrategy, ReplanPolicy replanPolicy)
-
-
Method Details
-
init
Description copied from interface:PlannerInitialize 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.
-
firstAction
Description copied from interface:PlannerSelect the first action to execute.- Specified by:
firstActionin interfacePlanner
-
nextAction
Description copied from interface:PlannerSelect the next action based on updated state and events.- Specified by:
nextActionin interfacePlanner
-