Skip to main content

Tyr: Generalized Planning in C++20 and Python

Tyr is designed to address several challenges in modern planning systems:

  1. Unified grounded and lifted planning within a type-safe API.

  2. Rapid prototyping through Python bindings with type hints, backed by a high-performance C++ core.

  3. Support for expressive numeric planning formalisms across both grounded and lifted reasoning paradigms (see Supported PDDL Features).

  4. Integration of learning and reasoning by supporting collections of planning tasks over a shared planning domain.

Technical Overview

  • PDDL frontend: Tyr uses Loki to parse, normalize, and translate PDDL input. The parser is implemented with Boost and provides informative error messages for syntactically invalid input. The normalization pipeline largely follows the approach described in Section 4 of Concise finite-domain representations for PDDL planning tasks.

  • Datalog engine: Tyr implements a parallel semi-naive Datalog engine for lifted successor generation, axiom evaluation, relaxed planning graph heuristics, and task grounding. Its execution model is synchronous and supports both rule-level and grounding-level parallelism.

  • Ground planning: For grounded tasks, Tyr uses data structures inspired by The Fast Downward Planning System to efficiently identify applicable actions in a given state. Grounding often yields substantial performance improvements, although it is not always feasible for large tasks.

  • State representation: Tyr statically analyzes domain and problem files and partitions predicates, functions, and related structures into strongly typed categories such as static, fluent, and derived atoms. This design prevents accidental mixing of conceptually different entities. To represent sequences compactly, Tyr uses tree databases of perfectly balanced binary trees, allowing common subsequences to be shared through shared subtrees. As a special case, Tyr synthesizes finite-domain variables for fluent atoms in grounded planning, largely following the method described in Section 5 of Concise finite-domain representations for PDDL planning tasks, enabling more compact storage when grounding is feasible.

  • Memory model: Tyr keeps every entity it builds (objects, atoms, actions, rules, states) as a record in a store of flat byte buffers that only grow, laid out with Cista. As in Cap'n Proto, a record is written through a builder and read in place through a view, with no decoding step. Unlike Cap'n Proto and Protocol Buffers, which build self-contained messages, a store keeps each distinct record once and names it by a dense index: a record refers to its children by their indices, so all records form one shared graph, and two records are equal exactly when their indices are. Stores are layered: a layer reads through to its frozen parent without copying it, so multiple tasks share a domain, multiple workers share a task, and a Datalog program refers to its planning task's atoms. Once its buffers have grown, building a record allocates nothing. The record schema describes the design and the comparison in full.

Getting Started

The library consists of a formalism and a planning component. The formalism component is responsible for representing PDDL entities. The planning component provides functionality for implementing search algorithms, as well as off-the-shelf implementations of eager A*, lazy GBFS, and heuristics such as blind, max, add, and FF. Below is a minimal overview of the Python and C++ APIs for implementing custom search algorithms.

Python Interface

Pytyr is available at PyPI and can be installed with pip install pytyr.

Detailed examples are available in the python/examples directory:

  • structures.py – Parse and traverse all planning formalism structures.
  • builder.py – Create new planning formalism structures.
  • invariants.py – Synthesize invariants, access candidate variable bindings, and match atoms through unification.
  • astar_eager.py – Use and customize off-the-shelf search algorithms.
  • gbfs_lazy.py – Implement a custom search algorithm from scratch.

The Python interface for implementing search algorithms is:

# Recommended namespace aliases
from pypddl.formalism import ParserOptions
from pyyggdrasil.execution import ExecutionContext
import pytyr.formalism as tf
import pytyr.planning.lifted as tpl  # pytyr.planning.ground also exists

# Parse and translate a task over a domain.
parser_options = ParserOptions()
parser = tf.Parser("domain.pddl", parser_options)
# Instantiate a lifted task.
task = tpl.Task(parser.parse_task("problem.pddl", parser_options))

# Instantiate a single-threaded execution environment.
execution_context = ExecutionContext(1)

# Instantiate the planning objects. Each state repository has its own number, so
# state views from different state repositories hash and compare correctly.
axiom_evaluator = tpl.AxiomEvaluator(task, execution_context)
state_repository = tpl.StateRepository(task)
successor_generator = tpl.SuccessorGenerator(task, execution_context)

# Get the initial node (state + metric value)
initial_node = successor_generator.get_initial_node(state_repository, axiom_evaluator)

# Get the labeled successor nodes (sequence of action binding + node)
labeled_successor_nodes = successor_generator.get_labeled_successor_nodes(initial_node, state_repository, axiom_evaluator)

C++ Interface

The C++ interface for implementing search algorithms is:

#include <tyr/tyr.hpp>

// Recommended namespace aliases.
namespace tf = tyr::formalism;
namespace tp = tyr::planning;

// Parse and translate a task over a domain.
auto parser = tf::Parser("domain.pddl");
// Instantiate a lifted task.
auto task = tp::Task<tyr::LiftedTag>::create(parser.parse_task("problem.pddl"));

// Instantiate a single-threaded execution environment
auto execution_context = ygg::ExecutionContext::create(1);

// Instantiate the planning objects. Each state repository has its own number, so
// state views from different state repositories hash and compare correctly.
auto axiom_evaluator = tp::AxiomEvaluator<tyr::LiftedTag>(task, execution_context);
auto state_repository = tp::StateRepository<tyr::LiftedTag>(task);
auto successor_generator = tp::SuccessorGenerator<tyr::LiftedTag>(task, execution_context);

// Get the initial node (state + metric value).
auto initial_node = successor_generator.get_initial_node(state_repository, axiom_evaluator);

// Get the labeled successor nodes (sequence of action binding + node).
auto labeled_successor_nodes = successor_generator.get_labeled_successor_nodes(initial_node, state_repository, axiom_evaluator);

Dependencies

Tyr consumes native dependencies from Python packages:

  • pyyggdrasil >= 0.12.0, < 0.13 for shared third-party native dependencies.
  • pypddl >= 1.13.0, < 1.14 for Loki's PDDL parser library, headers, and CMake package.
  • pypddl-datasets >= 0.0.17, < 0.1 for the PDDL benchmark data used by the C++ tests and benchmarks (resolved from its cache at CMake configure time).

The shared workspace layout, layered install order, and the common build-from-source and CMake-integration patterns are documented in the Planning and Learning build instructions; the sections below cover tyr/pytyr-specific details.

Build C++

Install Tyr's native dependency providers into the active Python environment, then configure CMake with their native prefixes:

python -m pip install 'pyyggdrasil>=0.12.0,<0.13' 'pybrokkr>=0.3.0,<0.4' 'pypddl>=1.13.0,<1.14' 'pypddl-datasets>=0.0.17,<0.1'

cmake -S . -B build \
  -DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"

cmake --build build -j4

CMake discovers the installed provider packages automatically: it finds the build helpers of brokkr (pybrokkr, installed with the package), whose brokkr_find_python_native_prefix adds pyyggdrasil's native prefix to CMAKE_PREFIX_PATH; find_package(yggdrasil) then resolves the rest of the chain and links against the yggdrasil::yggdrasil and loki::parsers targets. To point at different prefixes explicitly:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -m pyyggdrasil --prefix);$(python -m pypddl --prefix)"

CMake options:

Option Default Description
TYR_BUILD_TESTS OFF Build Tyr tests.
TYR_BUILD_EXECUTABLES OFF Build Tyr executables.
TYR_BUILD_BENCHMARKS OFF Build Tyr benchmark targets.
TYR_BUILD_PYTYR OFF Build pytyr Python bindings.
TYR_HEADER_INSTANTIATION OFF Instantiate templates in in-tree translation units at higher compile-time cost.
TYR_ENABLE_INNER_PARALLELISM OFF Enable inner parallelism for expensive lifted rule evaluation.
TYR_ENABLE_SEMI_NAIVE ON Enable semi-naive lifted Datalog evaluation.
TYR_USE_LLD ON Use LLVM lld with Clang when available.
TYR_ENABLE_LTO ON Enable link-time optimization for Release builds.
TYR_STATE_STORAGE_POLICY TreeBitset State storage backend; accepted values are TreeVector, TreeBitset, and Hashset. TreeBitset stores fluent facts and derived atoms as position-stable bitset trees and inserts successors as deltas to their parent. TreeVector and Hashset store them as vectors, as trees with shared structure or whole in hash tables.

Repository(parent_repository=None) makes a repository layer over parent_repository (none: a root).

Single-config CMake builds default to Release. On GCC and Clang, Debug builds use -Og with debug symbols, RelWithDebInfo keeps frame pointers and disables LTO, and Release LTO uses GCC LTO or Clang ThinLTO. Editable installs and wheels disable TYR_USE_LLD and TYR_ENABLE_LTO by default for build reliability.

Install Tyr from a configured build directory with:

cmake --install build --prefix=<path/to/installation-directory>

More detailed Tyr-specific build instructions are available in build instructions.

Build Python

python -m pip install .[test]
pytest python/tests

CMake Integration

This section covers pytyr-specific paths and targets; the general pattern for consuming the native prefixes from CMake is in the common CMake integration instructions.

The Python package pytyr installs Tyr's native headers, shared library, and CMake package config under pytyr.native_prefix(). Use pytyr.cmake_prefix() and pytyr.cmake_dir() (or python -m pytyr --prefix / --cmake-dir from the shell) to locate them. Downstream CMake projects should include the native prefixes of pytyr and its native package dependencies in CMAKE_PREFIX_PATH:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -m pyyggdrasil --prefix);$(python -m pypddl --prefix);$(python -m pytyr --prefix)"

Tyr exports the tyr::core aggregate target.

Metadata

Release files for pytyr 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytyr 0.11.0
File Size Uploaded Provenance Actions
pytyr-0.11.0.tar.gz 676.8 kB With provenance Details for pytyr-0.11.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pytyr 0.11.0
File Actions
pytyr-0.11.0-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for pytyr-0.11.0-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
pytyr-0.11.0-cp311-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details for pytyr-0.11.0-cp311-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
pytyr-0.11.0-cp311-abi3-macosx_11_0_x86_64.whl CPython 3.11 abi3 macOS 11.0+ x86-64 Details for pytyr-0.11.0-cp311-abi3-macosx_11_0_x86_64.whl
pytyr-0.11.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for pytyr-0.11.0-cp311-abi3-macosx_11_0_arm64.whl

Total release size: 20.1 MB

Release files / pytyr-0.11.0.tar.gz

Download URL pytyr-0.11.0.tar.gz
Size 676.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf4ca676715a56d6533e6b7ce5e2d859ae0338c1d3bd974d96d9f97bbe6e29a8
BLAKE2b-256 checksum
How to use checksums
a2c3f5a9b6e7de8730b39ec7b2822d627017a1368cf024bc05046c2ad78ae690
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pytyr-0.11.0-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL pytyr-0.11.0-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 5.3 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
6435355c884baa9e0be61fe6623f66a4d8490dd6972ab4a22005439126950324
BLAKE2b-256 checksum
How to use checksums
b343966668455ff7fcb5a6436ec1d15ce5638d4f622b0eb6d377c528e7c88347
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pytyr-0.11.0-cp311-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL pytyr-0.11.0-cp311-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 4.9 MB
Tags CPython 3.11 Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7b2dd4e13a11dbaba98c359ee9e38878360df12167a025f7e59b50f58fb4e1fd
BLAKE2b-256 checksum
How to use checksums
6f89b71cb711c939954f76fdcba5f865b23e4df5e9237fa1efbec632083abbd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pytyr-0.11.0-cp311-abi3-macosx_11_0_x86_64.whl

Download URL pytyr-0.11.0-cp311-abi3-macosx_11_0_x86_64.whl
Size 5.0 MB
Tags CPython 3.11 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
0c6396eaf08edb3f84b28f4c3f65f0a05fef2d48b058126004178a871bfeb503
BLAKE2b-256 checksum
How to use checksums
7d690c076e70ee5882701ea87a89f143b5401c6daaa885e8708fa804b25af76d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / pytyr-0.11.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL pytyr-0.11.0-cp311-abi3-macosx_11_0_arm64.whl
Size 4.2 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
bfb2669d60d4486a22c4d5b17e653da75c7e62e6db13f26783bcaac2e5778031
BLAKE2b-256 checksum
How to use checksums
4cbf34bc9cf7e5d3ea2a0316246e2aaf96de400f1cfa4f8773a64e790a4d2683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for pytyr 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for pytyr-0.11.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.0 This release

5 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page