langgoap.PlanningState#
- class PlanningState(conditions)[source]#
Immutable, hashable representation of a GOAP world state.
Internally stores state as a frozenset of (key, value) tuples to ensure immutability and hashability. This enables use as dictionary keys and in sets — critical for A* closed-set tracking.
The public attribute
conditionsexposes the underlying frozenset so callers can inspect it directly without an allocation.In practice, a GOAP world state dict may contain both planning flags (hashable booleans/scalars used by the A* planner) and execution context (rich data like document lists or LLM responses). Use the
keysparameter offrom_dict()to extract only the planning-relevant subset.- Parameters:
conditions (frozenset[tuple[str, Any]])
- __init__(conditions)#
- Parameters:
conditions (frozenset[tuple[str, Any]])
- Return type:
None
Methods
__init__(conditions)apply(effects)Return a new PlanningState with effects applied.
from_dict(d, *[, keys])Create a PlanningState from a dictionary.
get(key[, default])Get a value by key, returning default if missing.
satisfies(requirements)Check if this state satisfies all given conditions.
to_dict()Convert to a mutable dictionary snapshot.
Attributes
conditions