langgoap.GoapPlanner

langgoap.GoapPlanner#

class GoapPlanner(actions, *, strategy=None, tracer=None, sensors=None, resolvers=None, record_expansions=False, stuck_handlers=None, max_stuck_iterations=3)[source]#

LangGraph node that invokes the planner.

Reads world_state and goal from GoapState, runs the configured PlanningStrategy (default: pure A* when the goal has no constraints/objectives, or the two-phase A*→CSP pipeline otherwise), and writes the resulting plan back.

Parameters:
  • actions (list[ActionSpec]) – Available actions for planning.

  • strategy (PlanningStrategy | None) – Optional custom PlanningStrategy. When None (default) the planner auto-selects between pure A* and the two-phase pipeline based on the goal — identical to the pre-strategy behavior. Pass a concrete strategy (or a user-defined one implementing the Protocol) to override this routing.

  • tracer (PlanningTracer | None)

  • sensors (list[Sensor | AsyncSensor] | None)

  • resolvers (list[ConditionResolver | AsyncConditionResolver] | None)

  • record_expansions (bool)

  • stuck_handlers (list[StuckHandler] | None)

  • max_stuck_iterations (int)

__init__(actions, *, strategy=None, tracer=None, sensors=None, resolvers=None, record_expansions=False, stuck_handlers=None, max_stuck_iterations=3)[source]#
Parameters:
  • actions (list[ActionSpec])

  • strategy (PlanningStrategy | None)

  • tracer (PlanningTracer | None)

  • sensors (list[Sensor | AsyncSensor] | None)

  • resolvers (list[ConditionResolver | AsyncConditionResolver] | None)

  • record_expansions (bool)

  • stuck_handlers (list[StuckHandler] | None)

  • max_stuck_iterations (int)

Return type:

None

Methods

__init__(actions, *[, strategy, tracer, ...])

acall(state)

Async entry point — fires async tracer hooks.