A Hierarchical Task Network (HTN) is an automated planning formalism that decomposes high-level, abstract tasks into networks of smaller subtasks using a library of decomposition methods, recursively applying these methods until a sequence of primitive, executable actions is generated. Unlike classical planners that search a flat state space, HTN planning operates on tasks, using task reduction to break down complex problems. This makes it exceptionally efficient for domains with inherent hierarchical structure, such as robotics, manufacturing, and logistics, where goals like 'assemble product' naturally decompose into ordered steps like 'fetch part' and 'insert component'.
Glossary
Hierarchical Task Network (HTN)

What is Hierarchical Task Network (HTN)?
A hierarchical planning formalism central to robotics and AI that decomposes complex goals into executable actions.
The core components are a task network (a set of tasks with constraints), a method library (recipes for decomposing compound tasks), and primitive tasks (directly executable actions). Planning proceeds by selecting a non-primitive task, choosing a relevant method to decompose it, and inserting the method's subtasks into the network, respecting preconditions and ordering constraints. This approach directly encodes expert domain knowledge into the method library, leading to more intuitive and computationally tractable plans compared to purely state-space search, and is foundational for task and motion planning (TAMP) in embodied AI systems.
Core Components of an HTN
A Hierarchical Task Network (HTN) is a planning formalism that decomposes complex tasks into subtasks using a library of methods until primitive, executable actions are reached. Its core components define the problem, the solution strategies, and the decomposition logic.
Compound Tasks
A compound task is a high-level, abstract goal that cannot be executed directly by an agent. It represents a problem to be solved, such as 'Navigate to Room' or 'Assemble Product'. In HTN planning, the planner's job is to decompose compound tasks into a network of simpler subtasks using available methods. The initial planning problem is typically defined as a single top-level compound task.
Primitive Tasks (Actions)
A primitive task (or action) is a low-level, directly executable operation. It represents the atomic building blocks of a plan, such as 'Turn 90 degrees', 'Grasp object A', or 'Move forward 1 meter'. Primitive tasks have preconditions that must be true in the world to execute them and effects that describe how they change the world state. The decomposition process stops when all tasks in the network are primitive.
Methods
A method is a recipe for decomposing a compound task into a partially ordered set of subtasks. It defines a way to accomplish the high-level goal. Each method has:
- Task Head: The compound task it can decompose.
- Preconditions: Logical conditions that must hold for this method to be applicable.
- Subtasks: A network (sequence or partial order) of smaller compound or primitive tasks.
A single compound task may have multiple methods, allowing the planner to choose different strategies based on the current world state.
Operators
An operator is the formal definition of a primitive task's executable logic. It is analogous to an action in STRIPS or PDDL and specifies:
- Name & Parameters: The action identifier and its variables.
- Precondition: A logical formula that must be satisfied in the current state for the operator to be legally applied.
- Effect: A description of how the operator changes the state, typically divided into an add list (facts that become true) and a delete list (facts that become false). Operators are the bridge between the symbolic plan and the robot's low-level control system.
Planning Domain
The planning domain is the complete knowledge base or library that defines the capabilities available to the planner. It is a static collection of:
- All operators (primitive actions).
- All methods for decomposing compound tasks.
- The ontology (predicates and types) used to describe states.
The domain encodes the how—the possible ways the agent can interact with and change the world, independent of any specific problem instance.
Planning Problem
A planning problem defines a specific instance to be solved. It consists of three key elements:
- Initial State: A complete snapshot of the world at the start, described as a set of grounded logical predicates (e.g.,
(robot-at lobby),(door-open room1)). - Task Network: The initial high-level task to be accomplished, usually a single compound task (e.g.,
(deliver package room5)). - Domain: A reference to the planning domain containing the methods and operators.
The planner's job is to use the domain to decompose the initial task network, given the initial state, into a sequence of executable primitive operators.
HTN vs. Classical Planning: Key Differences
A comparison of Hierarchical Task Network (HTN) planning and Classical (STRIPS/PDDL) planning, highlighting their core mechanisms, representational capabilities, and suitability for robotics and embodied AI tasks.
| Feature | Hierarchical Task Network (HTN) | Classical Planning (e.g., STRIPS/PDDL) |
|---|---|---|
Core Planning Mechanism | Task decomposition via methods | State-space search via actions |
Plan Representation | Hierarchical task tree | Linear sequence of actions |
Domain Knowledge Encoding | Explicit in method libraries | Implicit in action preconditions/effects |
Handles Abstract Actions | ||
Native Support for Recursion | ||
Typical Search Space Size | Smaller, guided by hierarchy | Exponentially larger, unguided |
Plan Optimality Guarantee | Not guaranteed (depends on methods) | Guaranteed with optimal search (e.g., A*) |
Expressiveness for Robotics | High (natural for skills/subtasks) | Low (requires flattening to primitives) |
Integration with Motion Planning | Direct (primitives are motion plans) | Indirect (actions must be grounded) |
Primary Use Case | High-level task planning for robots | Theoretical/logical problem solving |
HTN Use Cases in AI and Robotics
Hierarchical Task Networks (HTNs) are a core planning formalism used to decompose abstract goals into executable actions. Their structured, knowledge-driven approach makes them indispensable for complex, real-world domains where reliability and explainability are paramount.
Game AI & Non-Player Character Behavior
HTNs are a proven alternative to Behavior Trees and Finite State Machines for creating robust, believable AI in video games and simulations. Designers encode domain knowledge as methods, allowing NPCs to perform complex activities like "Defend Fortress" by reasoning about subtasks:
- Evaluate Threat →
Patrol WallsorMan Artillery. - Resource Management →
Fetch AmmunitionorRepair Gate. The explicit task hierarchy makes AI behavior more transparent, debuggable, and modular than black-box reinforcement learning approaches, crucial for maintaining narrative and gameplay balance.
Military Mission Planning Systems
HTNs have been historically significant in military planning applications (e.g., the O-Plan and SHOP2 planners) for missions like "Conduct Reconnaissance." They rigorously model:
- Temporal constraints and concurrent actions.
- Resource constraints (fuel, ammunition).
- Hierarchical decomposition of commands:
Mission→Phase→Unit Task→Action. This formalism allows planners to generate, evaluate, and validate complex courses of action from high-level directives, providing commanders with explainable, auditable plans.
Frequently Asked Questions
A Hierarchical Task Network (HTN) is a formal planning method used in artificial intelligence, particularly in robotics and autonomous systems, to decompose complex, high-level goals into sequences of executable primitive actions. This FAQ addresses its core mechanisms, differences from other planners, and its role in modern embodied AI.
A Hierarchical Task Network (HTN) is an AI planning formalism that solves complex problems by recursively decomposing high-level tasks into networks of subtasks using a predefined library of methods, until only primitive, directly executable actions remain.
It works through a backward-chaining search process:
- Task: The planner starts with a high-level, non-primitive task (e.g.,
DeliverPackage). - Method Selection: It consults its method library for a method that can accomplish that task. A method is a recipe:
(Task, Preconditions, Subtask Network). ForDeliverPackage, a method might specify subtasks:NavigateTo(Pickup), PickUp(Object), NavigateTo(Dropoff), Place(Object). - Decomposition: The planner replaces the high-level task with this network of subtasks.
- Recursion: It repeats this process for each new non-primitive subtask (e.g.,
NavigateTomight decompose intoPlanPathandExecuteTrajectory). - Primitive Actions: Decomposition stops when all tasks in the network are primitive actions—low-level commands the system can execute directly (e.g.,
SetWheelVelocity(0.5 m/s)). The resulting sequence of primitives is the plan.
The power of HTN lies in its domain knowledge encoding. The method library, crafted by a domain expert, directly encodes how tasks can be accomplished, making the search far more efficient and goal-directed than state-space planners that reason from first principles.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Hierarchical Task Networks (HTNs) are a core formalism in automated planning for robotics. These related concepts define the algorithmic landscape for decomposing high-level goals into executable actions.
Task Decomposition
The general process of breaking a complex, high-level goal into a structured hierarchy of simpler, actionable subtasks. HTN planning is a specific, formalized approach to this process, using a library of methods to recursively decompose tasks until primitive actions are reached. This is distinct from simply sequencing pre-defined actions, as it involves selecting appropriate decomposition methods based on the current world state.
STRIPS & PDDL
Foundational languages and representations for classical planning, which HTN extends.
- STRIPS (Stanford Research Institute Problem Solver): A seminal planning model where actions are defined by preconditions (what must be true to execute), add lists (facts made true), and delete lists (facts made false).
- PDDL (Planning Domain Definition Language): The standardized, formal language descended from STRIPS used to model planning problems. HTN planning often uses HTN extensions to PDDL (like PDDL2.2 or PDDL3) to define tasks and methods alongside actions.
Behavior Trees
A modular, hierarchical control architecture used extensively in game AI and robotics for decision-making. While both HTNs and Behavior Trees are hierarchical, they differ fundamentally:
- HTN: A planning formalism. It generates a plan (sequence of actions) offline or online by searching through possible decompositions.
- Behavior Tree: An execution and reactive control structure. It executes a pre-defined tree of nodes (tasks, conditions, sequences, selectors) and can react dynamically to changes in the environment by traversing different branches.
Motion Planning
The algorithmic process of computing a feasible, often optimal, path or trajectory for a robot from a start to a goal configuration while avoiding obstacles. HTN planning operates at a higher task level, producing a sequence of what to do (e.g., PickUp(block_A), PlaceOn(block_A, table)). Motion planning solves the lower-level how, computing the specific joint angles and velocities to execute a primitive action like PickUp. The integration of HTN task planning with motion planning is a key challenge in robotics.
Skill Library
A curated repository of reusable, parameterized motion primitives or behavioral modules. In an HTN framework, the primitive tasks at the leaves of the decomposition hierarchy often correspond to executable skills drawn from such a library. For example, an HTN method might decompose Assemble(Widget) into Fetch(part_A), Fetch(part_B), Align(part_A, part_B), where each of these is a parameterized skill (e.g., a trained policy or a optimized trajectory) stored in the library.
Plan-Space Planning
A major category of planning algorithms contrasted with state-space planning. HTN planning is a plan-space approach.
- State-Space Planning (e.g., STRIPS solvers): Searches through a graph of world states, applying actions to transform one state into another.
- Plan-Space Planning (HTN): Searches through a space of partially specified plans (task networks). It starts with an abstract high-level task and refines it by applying methods, working on the plan structure itself rather than simulating state transitions. This allows it to handle complex hierarchical constraints more naturally.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us