langgoap.GoapSubgraph

langgoap.GoapSubgraph#

class GoapSubgraph(actions, goal)[source]#

A GOAP planner packaged as a reusable sub-graph.

Parameters:
  • actions (list[ActionSpec]) – Actions the planner may use.

  • goal (GoalSpec) – Goal specification. Pre-resolved at construction time; NL interpretation must happen before this class is built.

Example:

sub = GoapSubgraph(
    actions=[a1, a2, a3],
    goal=GoalSpec(conditions={"done": True}),
)
compiled = sub.compile()
result = compiled.invoke({"world_state": {}, "goal": goal})
__init__(actions, goal)[source]#
Parameters:
Return type:

None

Methods

__init__(actions, goal)

compile(**kwargs)

Compile the sub-graph.