Inferensys

Glossary

Task Library

A Task Library is a curated collection of task schemas, methods, and operators that define the capabilities and knowledge for a Hierarchical Task Network (HTN) planner in a specific domain.
Knowledge manager reviewing enterprise knowledge management system on laptop, document library visible, casual office.
HIERARCHICAL TASK NETWORKS

What is a Task Library?

A Task Library is the foundational knowledge base for a Hierarchical Task Network (HTN) planner, containing the formal schemas that define an agent's capabilities and procedural knowledge within a specific operational domain.

A Task Library is a curated, domain-specific collection of task schemas, decomposition methods, and planning operators that formally defines the capabilities and procedural knowledge available to a Hierarchical Task Network (HTN) planner. It serves as the planner's core knowledge base, encoding how abstract, high-level goals (compound tasks) can be recursively broken down into networks of simpler subtasks until directly executable primitive actions are reached. This library essentially provides the "recipes" or blueprints the AI agent uses to understand and accomplish complex work.

In practice, a well-engineered Task Library enables deterministic and interpretable plan generation. Each entry—a task schema—specifies parameters, preconditions for applicability, and the effects of execution. For an autonomous software agent, the library might contain schemas for FetchData(API), ParseJSON(response), and GenerateReport(insights). The planner selects and sequences these schemas to fulfill a top-level objective like AnalyzeQuarterlySales(), ensuring every generated action is grounded in a known, verifiable capability.

HIERARCHICAL TASK NETWORKS

Core Components of a Task Library

A Task Library is the foundational knowledge base for a Hierarchical Task Network (HTN) planner, containing the formal schemas that define how complex goals can be broken down into executable actions.

01

Task Schemas

A Task Schema is a template that defines a class of tasks within the library. It specifies the task's name, parameters (variables), and its type—either Primitive Task (directly executable) or Compound Task (requires decomposition). For example, a DeliverPackage(package, location) schema defines the structure for all delivery tasks. Schemas provide the standardized building blocks from which specific planning problems are constructed.

02

Methods (Decomposition Rules)

A Method is a rule that defines a possible way to decompose a compound task into a network of subtasks. Each method is associated with a specific compound task schema and contains:

  • Preconditions: Logical conditions that must be true in the current world state for this decomposition to be valid.
  • Subtasks: The ordered network of (compound or primitive) tasks that implement the parent task. A library contains multiple methods for key compound tasks, enabling the planner to choose context-appropriate strategies. For instance, the AssembleProduct task might have different methods for 'rush order' versus 'standard assembly'.
03

Operators (Primitive Actions)

An Operator is the formal, executable representation of a Primitive Task. It defines the lowest-level action the system can perform. Each operator is grounded by:

  • Preconditions: State conditions required for the action to be legally applied.
  • Effects: The precise changes the action makes to the world state (e.g., robot_location = warehouse). Operators are the leaves of the Decomposition Tree. A robust library includes operators for all fundamental capabilities, such as Navigate(robot, from, to), Grasp(robot, object), or CallAPI(endpoint, payload).
04

Precondition & Effect Logic

This component defines the formal language used to express the Preconditions for methods and operators and the Effects of operators. It typically uses a predicate logic (e.g., first-order logic) to represent facts about the world state. For example, a precondition might be At(Robot1, LoadingDock) AND Has(PackageA). An effect might be NOT(At(Robot1, LoadingDock)) AND At(Robot1, StorageRoom). The library's logic framework determines the planner's reasoning power and the complexity of real-world constraints it can model.

05

Domain-Specific Constraints

Beyond basic preconditions, a task library encodes domain-specific constraints that govern valid task decomposition and ordering. These include:

  • Ordering Constraints: Temporal relations (e.g., Task A before Task B).
  • Resource Constraints: Limitations on consumables (e.g., battery_level > 20%) or reusable assets (e.g., uses(forklift)).
  • Causal Links: Dependencies between tasks where one task produces a state that another requires. These constraints ensure the planner generates feasible, efficient plans that respect real-world operational limits.
06

Library Curation & Versioning

A task library is a living codebase requiring systematic curation. This involves:

  • Schema Validation: Ensuring new task schemas and methods are consistent and non-contradictory.
  • Performance Profiling: Annotating tasks with estimated cost, duration, or reliability metrics to guide the planner.
  • Version Control: Managing different library versions for various operational contexts (e.g., warehouse_v1.2, emergency_protocols).
  • Modular Design: Organizing the library into reusable, domain-specific modules (e.g., navigation.tlib, manipulation.tlib) that can be composed for complex agents.
HIERARCHICAL TASK NETWORKS

How a Task Library Works in HTN Planning

A Task Library is the foundational knowledge base for a Hierarchical Task Network (HTN) planner, containing the formal schemas that define how abstract goals can be decomposed into executable actions.

A Task Library is a curated, domain-specific collection of task schemas, decomposition methods, and planning operators that formally encodes an agent's capabilities and procedural knowledge. It serves as the planner's rulebook, defining all legal ways to break down high-level compound tasks into networks of subtasks until primitive tasks (executable actions) are reached. Without this library, an HTN planner lacks the necessary instructions to reason about achieving complex objectives.

During planning, the solver queries this library. For a given compound task, it retrieves all applicable methods whose preconditions match the current world state. Each method provides a valid decomposition into a new subtask network. This process recurses until the plan consists solely of primitive operators. The library's design—its granularity, constraints, and coverage—directly determines the planner's efficiency, flexibility, and the semantic correctness of the plans it generates.

TASK LIBRARY

Frequently Asked Questions

A Task Library is the foundational knowledge base for a Hierarchical Task Network (HTN) planner, defining the capabilities and operational logic of an autonomous agent within a specific domain.

A Task Library is a curated, domain-specific collection of task schemas, methods, and operators that formally defines the capabilities and decomposition logic for a Hierarchical Task Network (HTN) planner. It works by providing the planner with a structured vocabulary of actions and the rules for breaking down complex goals. When the planner receives a high-level objective (e.g., 'Diagnose Server Failure'), it consults the library's methods to recursively decompose it into a network of subtasks (e.g., 'Check Logs', 'Run Diagnostics') until it reaches primitive, executable actions (e.g., 'Execute API Call: fetch_logs'). The library acts as the agent's procedural knowledge, dictating what it can do and how it can reason about doing it.

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.