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
PlanningTracerinvoked around each action execution.guards (list[ActionGuard | AsyncActionGuard] | None) – Optional list of
ActionGuardorAsyncActionGuardobjects evaluated before each action executes. AWARN-severity failure is logged but execution continues. ABLOCK-severity failure aborts the action and immediately blacklists it (equivalent tomax_retries + 1failures), triggering replanning via the observer.transition_model (TransitionModel | None) – Optional
TransitionModelthat drives runtime effects when an action’sexecutecallable returnsNone(or is absent). Dict returns fromexecuteremain authoritative. Pair with a seededrngfor reproducible stochastic rollouts.rng (random.Random | None) – Optional
random.Randomforwarded totransition_model.sample. When omitted, a singlerandom.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.