Planning & Control Flow

Hybrid HTN + Generative Agent

Hierarchical Task Network decomposition provides the procedural backbone; the generative LLM is invoked only at leaf nodes for the parts of the task that are genuinely open-ended.

Problem

Pure-LLM planning is expensive and inconsistent for tasks with known structure. Pure HTN cannot handle the leaves that require natural-language reasoning. Neither alone fits tasks with both well-known structure and open-ended leaves.

Solution

HTN decomposition specifies the task structure: root task → sub-tasks → ... → leaves. Internal nodes are deterministic decomposition (no LLM). Leaf nodes invoke the LLM for the open-ended work (drafting text, classifying ambiguous input, summarizing). LLM outputs at leaves feed back into the HTN structure (parent nodes assemble leaf outputs). Pair with goal-decomposition, hierarchical-agents, deterministic-control-flow-not-prompt, plan-and-execute.

When to use

  • Task structure is well-known and decomposable as HTN.
  • Leaves require open-ended natural-language work.
  • Cost or consistency matters enough to justify HTN engineering.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related