langgoap.GoapState

langgoap.GoapState#

class GoapState[source]#

LangGraph state schema for the GOAP execution loop.

Keys#

world_state

Current world state as a flat dictionary.

goal

The goal specification to achieve. May be a single GoalSpec or a MultiGoal wrapping several sub-goals.

plan

The current action plan (set by planner node).

current_step

Index of the next action to execute.

execution_history

Append-only log of action results.

replan_count

How many times the planner has been invoked for the current (sub-)goal. Reset to zero when a MultiGoal advances between sequential sub-goals so each sub-goal receives its own max_replans budget.

replan_reason

Why 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 a MultiGoal advances between sequential sub-goals).

status

Current execution status.

blacklisted_actions

Action names the planner must skip.

action_failure_counts

Per-action cumulative failure counts.

current_subgoal_index

When goal is a MultiGoal running in sequential mode, the 0-based index of the sub-goal being worked on. Defaults to 0.

no_plan_explanation

Serialised NoPlanExplanation (via .to_dict()) produced when A* returns None. None when a plan was found. Use from_dict() to reconstruct the object.

reflection_context

Ordered list of verbal reflection summaries produced by ReflexionTracer after 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.

__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_state

goal

plan

current_step

execution_history

replan_count

replan_reason

status

blacklisted_actions

action_failure_counts

current_subgoal_index

no_plan_explanation

reflection_context

wall_clock_started_at