A Conditional Task is a task whose decomposition into subtasks or whose execution is contingent upon the runtime evaluation of specific preconditions against the current world state. Unlike a Primitive Task (a direct action) or a fixed Compound Task, its resolution is not predetermined; the planner or agent must evaluate logical expressions to select the appropriate method for decomposition or to decide if the task can be executed. This enables agents to build flexible, context-aware plans that adapt to dynamic environments.
Glossary
Conditional Task

What is a Conditional Task?
A Conditional Task is a fundamental construct in Hierarchical Task Network (HTN) planning and agentic cognitive architectures where the decomposition or execution of a task is dynamically determined by evaluating runtime conditions.
In practice, conditional tasks are implemented through conditional methods or precondition checks within an HTN's domain description. For example, a high-level task NavigateTo(Destination) might decompose into DriveCar if a car is available, or Walk otherwise. This conditional branching is central to plan refinement and is a key differentiator from simpler sequential planners. It allows agentic systems to exhibit robust, goal-directed behavior by making decisions based on sensed state, closely simulating executive function in cognitive architectures.
Core Characteristics of Conditional Tasks
A Conditional Task is a fundamental construct in Hierarchical Task Network (HTN) planning where the structure or execution of a task is dynamically determined by runtime conditions. These tasks enable agents to build flexible, context-aware plans.
Runtime State Dependence
The decomposition or execution path of a Conditional Task is not predetermined but is selected based on the evaluation of preconditions against the current world state. This is the core distinction from static task networks.
- Example: A
Navigatetask may decompose intoCallElevatorif the agent is inside a building, orWalkToDestinationif it is already outside. The planner evaluates theagent-locationstate variable to choose the correct method.
Integration with HTN Methods
Conditionality is formally implemented through HTN Methods. Each method provides one possible decomposition for a compound task, guarded by a logical precondition.
- A task like
AcquireItem(?item)could have multiple methods:- Method 1: Precondition
ItemOnShelf(?item)→ Subtasks:NavigateToShelf,PickUpItem. - Method 2: Precondition
ItemInStorage(?item)→ Subtasks:RequestFromStockroom,WaitForDelivery. The planner selects the first method whose precondition holds true.
- Method 1: Precondition
Enables Contextual Plan Branching
Conditional Tasks are the primary mechanism for introducing branching logic and contingency handling into hierarchical plans. They allow a single high-level goal to be achieved via different action sequences depending on situational context.
- This is critical for robustness in dynamic environments. For instance, an
HandleServerAlerttask will branch differently if the conditionalert-severity == CRITICALis true versus if it is false, leading to distinct escalation and repair procedures.
Foundation for Reactive Execution
While HTN planning is often considered deliberative, Conditional Tasks bridge planning with reactive execution. During plan execution, if a condition for a pending task changes, the system can trigger replanning from that task node.
- This creates a sense of continuous, context-sensitive decision-making. An
AssessRisktask that conditionally callsEvacuateorContinueMissioncan be re-evaluated if new sensor data updates the world state, making the agent responsive to real-time changes.
Distinction from Primitive & Compound Tasks
It's essential to differentiate a Conditional Task from its sibling concepts in the HTN hierarchy:
- Primitive Task: An executable action (e.g.,
TurnValve). Has no decomposition. - Compound Task: A high-level task (e.g.,
RepairPump) that must be decomposed, but may have only one static method. - Conditional Task: A type of Compound Task that has two or more alternative methods, where the choice is contingent on state. All conditional tasks are compound, but not all compound tasks are conditional.
Implementation in Planners (e.g., SHOP)
Algorithms like SHOP (Simple Hierarchical Ordered Planner) natively support Conditional Tasks. SHOP performs a forward search, interleaving task decomposition with state progression. When it encounters a compound task, it evaluates the preconditions of all its methods in the current state and non-deterministically chooses an applicable one to pursue.
- This makes the planning process itself conditional and state-dependent. The efficiency of HTN planning comes from this directed search through the space of possible decompositions, guided by the preconditions on methods.
Frequently Asked Questions
Questions and answers about Conditional Tasks, a core concept in Hierarchical Task Network (HTN) planning that enables dynamic, context-aware behavior in autonomous agents.
A Conditional Task is a task within a Hierarchical Task Network (HTN) whose decomposition into subtasks or whose execution is contingent on the runtime evaluation of specific world state conditions. Unlike a static task, its resolution path is not predetermined but is dynamically selected based on the current state of the environment.
In practice, this is implemented by attaching preconditions to the methods that decompose a compound task. When the planner encounters a conditional task, it evaluates the preconditions of all available decomposition methods. Only methods whose conditions are satisfied in the current world state are considered valid for decomposing that task. This allows an agent to choose different action sequences based on real-time sensor data, user input, or the outcomes of previous actions, enabling flexible and robust behavior.
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
Understanding Conditional Tasks requires familiarity with the core concepts of Hierarchical Task Network (HTN) planning. These related terms define the formal components and processes that govern how tasks are structured, decomposed, and executed.
Hierarchical Task Network (HTN)
A planning formalism that decomposes high-level tasks into networks of subtasks using methods until primitive, directly executable actions are reached. It provides the overarching framework within which a Conditional Task operates.
- Core Principle: Problem-solving via recursive task reduction.
- Contrast with Classical Planning: HTNs specify how to achieve tasks, not just the end state.
- Key Components: Compound tasks, primitive tasks, methods, and preconditions.
Compound Task
A high-level, abstract task in an HTN that must be decomposed into subtasks before it can be executed. A Conditional Task is a specialized type of compound task where the decomposition path is not fixed.
- Abstraction Level: Represents a goal or objective, not a direct action.
- Decomposition Requirement: Cannot be executed; must be broken down via a method.
- Example:
AssembleProduct()is a compound task decomposed intoFetchComponents(),AttachParts(), andQualityCheck().
Primitive Task
A task in an HTN that corresponds directly to an executable action or operator in the planning domain. It is the terminal leaf node in a decomposition tree.
- Executability: Has associated preconditions and effects that directly change the world state.
- Contrast with Conditional/Compound Tasks: Requires no further decomposition.
- Role in Plans: The final sequence of primitive tasks forms the solution plan.
Method (HTN)
A schema in an HTN that defines a possible way to decompose a compound task into a network of subtasks, given certain preconditions are met. It is the mechanism that enables conditional decomposition.
- Structure:
Method(Task, Preconditions, SubtaskNetwork). - Conditional Logic: Multiple methods can exist for the same compound task, each with different preconditions, creating branching decomposition paths.
- Execution: The planner selects the first method whose preconditions hold in the current state.
Precondition
A logical condition that must be true in the current world state for a planning operator or HTN method to be applicable. It is the gatekeeper for task decomposition and execution.
- Types: Can be simple (
inventory.has(item)) or complex, involving logical conjunctions/disjunctions. - Role in Conditional Tasks: Determines which decomposition method is valid at runtime.
- Evaluation: Checked during both planning (task decomposition) and plan execution.
Task Decomposition
The core process in HTN planning where a compound task is recursively replaced by a network of subtasks using applicable methods. This process resolves Conditional Tasks by evaluating preconditions to choose a decomposition path.
- Algorithm: Typically a depth-first, goal-directed search through the space of possible decompositions.
- Output: A decomposition tree or a sequence of primitive tasks (a plan).
- Dynamic Nature: For conditional tasks, the decomposition path can vary each time based on the runtime state.

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