langgoap.create_goap_tool

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 BaseTool that runs a GOAP planning loop.

The returned tool accepts a request string (natural language), interprets it as a GoalSpec via GoalInterpreter, and runs the GoapGraph to 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_state key.

  • graph_kwargs (dict[str, Any] | None) – Extra keyword arguments forwarded to GoapGraph.

Returns:

A StructuredTool with both sync and async implementations.

Return type:

StructuredTool