langgoap.create_goap_tool#
- create_goap_tool(actions, *, llm, name='goap_planner', description='Run a GOAP (Goal-Oriented Action Planning) loop to achieve a goal described in natural language.', world_state=None, graph_kwargs=None)[source]#
Create a LangChain
BaseToolthat runs a GOAP planning loop.The returned tool accepts a
requeststring (natural language), interprets it as aGoalSpecviaGoalInterpreter, and runs theGoapGraphto completion.- Parameters:
actions (list[ActionSpec]) – The action library for the planner.
llm (BaseChatModel) – Chat model for natural-language goal interpretation.
name (str) – Tool name visible to the calling agent.
description (str) – Tool description for the agent’s tool catalog.
world_state (dict[str, Any] | None) – Default initial world state. May be overridden per-invocation if the caller passes a
world_statekey.graph_kwargs (dict[str, Any] | None) – Extra keyword arguments forwarded to
GoapGraph.
- Returns:
A
StructuredToolwith both sync and async implementations.- Return type:
StructuredTool