Inferensys

Glossary

Hierarchical Task Network (HTN)

A Hierarchical Task Network (HTN) is an automated planning formalism that recursively decomposes high-level, abstract tasks into networks of subtasks until primitive, directly executable actions are reached.
Product manager reviewing autonomous task execution dashboard on laptop, completed tasks visible, casual work session.
PLANNING FORMALISM

What is Hierarchical Task Network (HTN)?

A core formalism in automated planning and agentic cognitive architectures for structuring complex, goal-oriented behavior.

A Hierarchical Task Network (HTN) is an automated planning formalism that represents a complex problem as a hierarchy of tasks, which are recursively decomposed into subtasks using decomposition methods until a sequence of directly executable primitive actions is found. Unlike classical planners that search for actions to achieve world-state goals, HTN planners are given a high-level compound task and use domain-specific knowledge encoded in methods to break it down, making them highly efficient for structured, procedural domains like manufacturing, logistics, and autonomous agent workflows.

The core process is task decomposition, guided by a domain description containing task schemas, methods, and operators. A method specifies a valid way to decompose a compound task into a network of subtasks, provided its preconditions hold. This creates a decomposition tree, resulting in a hierarchical plan. Algorithms like SHOP perform this decomposition in a forward-chaining manner, interleaving planning with state progression to ensure executability and enabling replanning when execution fails.

ARCHITECTURAL ELEMENTS

Core Components of an HTN

A Hierarchical Task Network is formally defined by a set of interlocking components that specify tasks, decomposition rules, and executable actions. These elements work together to transform abstract goals into concrete, executable plans.

01

Compound Task

A Compound Task is a high-level, abstract objective that cannot be executed directly. It serves as a placeholder that must be decomposed into a network of simpler subtasks using applicable methods. Examples include DeliverPackage(city) or DiagnoseSystemFault(). It represents the 'what' without specifying the 'how'.

02

Primitive Task

A Primitive Task (or Operator) is a directly executable action at the leaves of the decomposition tree. It is defined by:

  • Preconditions: Logical conditions that must be true in the world state for the action to be applicable.
  • Effects: The changes the action makes to the world state upon execution. For example, NavigateTo(location) or OpenValve(id) are primitive tasks with specific preconditions and effects.
03

Method

A Method (or Decomposition Method) is a schema that defines a possible way to decompose a specific compound task into a network of subtasks. Each method has:

  • Applicability Conditions: Preconditions that must hold for this decomposition to be valid.
  • Subtasks: The network of (compound or primitive) child tasks.
  • Ordering Constraints: Temporal relations between the subtasks (e.g., sequential, parallel). A planner selects among competing methods based on the current world state.
04

Task Network

A Task Network is a directed graph representing the current set of tasks to be accomplished, along with the ordering constraints between them. It evolves during planning:

  • Initial Task Network: Contains the top-level goal compound tasks.
  • Intermediate Task Networks: Contain a mix of compound and primitive tasks as decomposition proceeds.
  • Final Task Network: Contains only primitive tasks in a valid order, constituting the solution plan.
05

Domain Description

The Domain Description is the complete formal specification of an HTN planner's knowledge. It is a Task Library containing:

  • Task Schemas: Templates for all compound and primitive tasks.
  • Method Library: All available decomposition methods.
  • Operator Definitions: All primitive actions with their preconditions and effects. This description is domain-specific (e.g., logistics, manufacturing, IT orchestration) and is separate from any specific problem instance.
06

Planning Problem

A Planning Problem instance is defined by three inputs to the HTN planner:

  1. Domain Description: The library of tasks and methods.
  2. Initial State: A complete snapshot of the world before plan execution (e.g., RobotAt(Home), ValveStatus(Closed)).
  3. Initial Task Network: The high-level goal tasks to be achieved (e.g., [MaintainSystemPressure]). The planner's job is to process this problem and output a solution plan—a sequence of executable primitive actions.
MECHANISM

How HTN Planning Works

Hierarchical Task Network (HTN) planning is a problem-solving formalism that generates executable action sequences by recursively decomposing high-level objectives.

HTN planning begins with an initial task network containing abstract compound tasks. The planner selects a compound task and applies a decomposition method—a rule that replaces it with a network of subtasks, given its preconditions are satisfied in the current world state. This task decomposition process repeats recursively. Subtasks can be other compound tasks or primitive tasks, which correspond directly to executable operators with defined effects. The process continues until the entire network is reduced to a sequence of primitive actions, forming a solution plan.

The power of HTN planning lies in its domain knowledge encoding. Instead of searching a vast space of atomic actions, the planner uses methods as procedural knowledge to guide the search directly toward viable solutions. Algorithms like SHOP (Simple Hierarchical Ordered Planner) perform decomposition in a forward-chaining, depth-first manner, interleaving planning with state progression. This makes HTN planning highly efficient for complex, structured domains like logistics, manufacturing, and autonomous agent behavior, where expert knowledge about valid task sequences is available and can be encoded to constrain the search.

HIERARCHICAL TASK NETWORK (HTN)

Frequently Asked Questions

A Hierarchical Task Network (HTN) is a formal planning paradigm used in artificial intelligence to decompose high-level objectives into executable action sequences. This FAQ addresses core concepts, mechanisms, and applications for engineers building complex, multi-step agent workflows.

A Hierarchical Task Network (HTN) is an AI planning formalism that solves complex problems by recursively breaking down abstract, high-level tasks into networks of smaller subtasks until primitive, directly executable actions are reached. It works through a process called task decomposition. The planner starts with an initial task network containing one or more high-level compound tasks. It then searches through a library of methods—each defining a possible way to decompose a specific compound task into a subtask network given certain preconditions—until all tasks are reduced to primitive tasks (executable operators). The result is a hierarchical plan that is both a sequence of actions and a tree showing the decomposition structure, known as a decomposition tree.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.