langgoap.GoapExecutor

langgoap.GoapExecutor#

class GoapExecutor(*, tracer=None, guards=None, transition_model=None, rng=None, actions=None)[source]#

LangGraph node that executes the current action in the plan.

Runs plan.actions[current_step], updates world_state with the action’s effects, and appends to execution_history.

Both sync (__call__()) and async (acall()) paths share the same pre-condition checks, result building, and failure handling via the module-level helpers _prepare_execution(), _apply_result(), _build_success(), and _build_failure().

Parameters:
  • tracer (PlanningTracer | None) – Optional PlanningTracer invoked around each action execution.

  • guards (list[ActionGuard | AsyncActionGuard] | None) – Optional list of ActionGuard or AsyncActionGuard objects evaluated before each action executes. A WARN-severity failure is logged but execution continues. A BLOCK-severity failure aborts the action and immediately blacklists it (equivalent to max_retries + 1 failures), triggering replanning via the observer.

  • transition_model (TransitionModel | None) – Optional TransitionModel that drives runtime effects when an action’s execute callable returns None (or is absent). Dict returns from execute remain authoritative. Pair with a seeded rng for reproducible stochastic rollouts.

  • rng (random.Random | None) – Optional random.Random forwarded to transition_model.sample. When omitted, a single random.Random() is created at construction time and reused for every action — callers who want true reproducibility should pass a seeded instance.

  • actions (list[ActionSpec] | None)

__init__(*, tracer=None, guards=None, transition_model=None, rng=None, actions=None)[source]#
Parameters:
  • tracer (PlanningTracer | None)

  • guards (list[ActionGuard | AsyncActionGuard] | None)

  • transition_model (TransitionModel | None)

  • rng (Random | None)

  • actions (list[ActionSpec] | None)

Return type:

None

Methods

__init__(*[, tracer, guards, ...])

acall(state)

Async variant of the executor node.