langgoap.create_goap_subagent

langgoap.create_goap_subagent#

create_goap_subagent(actions, *, llm, name='goap_planner', description='A GOAP (Goal-Oriented Action Planning) subagent that achieves goals described in natural language.', world_state=None, graph_kwargs=None)[source]#

Create a CompiledSubAgent-compatible dict for DeepAgents.

The returned dict has name, description, and runnable keys. The runnable is a compiled StateGraph whose state includes a messages list — the DeepAgents subagent protocol.

The bridge graph has a single node that:

  1. Extracts the task from the last HumanMessage.

  2. Runs GoapGraph.invoke_nl / ainvoke_nl.

  3. Returns an AIMessage with the formatted result.

Parameters:
  • actions (list[ActionSpec]) – The action library for the planner.

  • llm (BaseChatModel) – Chat model for natural-language goal interpretation.

  • name (str) – Subagent name.

  • description (str) – Subagent description for routing.

  • world_state (dict[str, Any] | None) – Default initial world state.

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

Returns:

{"name": str, "description": str, "runnable": Runnable}.

Return type:

A dict matching the CompiledSubAgent protocol