langgoap.GoapState#
- class GoapState[source]#
The GOAP execution state as Python objects.
This is what
GoapGraph.invokeandrehydrate_state()return and what the planner / executor / observer nodes, stuck handlers and termination policies work with. LangGraph itself stores the JSON-native form described byGoapStateChannels; the two differ only in thegoal,planandexecution_historykeys.Keys#
world_stateCurrent world state as a flat dictionary.
goalThe goal to achieve: a
GoalSpecor aMultiGoalwrapping several sub-goals.planThe current
Plan, orNonewhen the planner found none (set by the planner node).current_stepIndex of the next action to execute.
execution_historyAppend-only log of
ActionResultrecords.replan_countHow many times the planner has been invoked for the current (sub-)goal. Reset to zero when a
MultiGoaladvances between sequential sub-goals so each sub-goal receives its ownmax_replansbudget.replan_reasonWhy the last replan was triggered. One of
"action_failed","state_deviation","every_action_replan","plan_exhausted","max_replans_exceeded", or"subgoal_achieved"(only emitted when aMultiGoaladvances between sequential sub-goals).statusCurrent execution status.
blacklisted_actionsAction names the planner must skip.
action_failure_countsPer-action cumulative failure counts.
current_subgoal_indexWhen
goalis aMultiGoalrunning insequentialmode, the 0-based index of the sub-goal being worked on. Defaults to 0.skipped_subgoalsIndices of sequential
MultiGoalsub-goals the planner skipped because they could not be planned (MultiGoal(on_infeasible="skip")). Absent or empty otherwise; when non-empty the run finishes withstatus="partial".prepared_waitThe name of the wait (
ActionSpec.wait) atcurrent_stepthat has run itsexecuteand paused at least once, so the executor does not prepare it again when a resume that changed nothing sends it back to the same step;Noneotherwise. Cleared when the wait ends and by every new plan.no_plan_explanationSerialised
NoPlanExplanation(via.to_dict()) produced when A* returnsNone.Nonewhen a plan was found. Usefrom_dict()to reconstruct the object.reflection_contextOrdered list of verbal reflection summaries produced by
ReflexionTracerafter action failures. Each entry is a human-readable string of the form"[action_name] reflection → suggestion". Set by the planner node on each planning round so downstream LLM-evaluated conditions can read them without coupling directly to the tracer.wall_clock_started_atEpoch timestamp (
time.time()) set by the planner on its first invocation; consulted by wall-clock termination policies. Epoch seconds stay meaningful after a checkpoint resume in another process.
- __init__(*args, **kwargs)#
Methods
__init__(*args, **kwargs)clear()copy()fromkeys(iterable[, value])Create a new dictionary with keys from iterable and values set to value.
get(key[, default])Return the value for key if key is in the dictionary, else default.
items()keys()pop(k[,d])If the key is not found, return the default if given; otherwise, raise a KeyError.
popitem()Remove and return a (key, value) pair as a 2-tuple.
setdefault(key[, default])Insert key with a value of default if key is not in the dictionary.
update([E, ]**F)If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
values()Attributes
world_stategoalplancurrent_stepexecution_historyreplan_countreplan_reasonstatusblacklisted_actionsaction_failure_countscurrent_subgoal_indexskipped_subgoalsno_plan_explanationreflection_contextwall_clock_started_atprepared_wait