Table of Contents
Fetching ...

A Behavior Tree-inspired programming language for autonomous agents

Oliver Biggar, Iman Shames

TL;DR

This work addresses the gap between Behavior Trees and a full programming language for autonomous agents by proposing a Haskell-embedded BT-inspired language. It identifies key challenges—reactive selection, safety monitoring, and modular data flow—and introduces a minimal, composable set of primitives (non-reactive sequence, reactive rSelect, and monitor) to resolve them, along with a full specification. The approach emphasizes modularity, safety, and real-time reactiveness, demonstrated through a concrete translation of a complex BT into executable code. The resulting framework enables precise semantics, data-aware composition, and a practical path to evolving BTs into a dedicated programming language for autonomous systems with real-world applicability.

Abstract

We propose a design for a functional programming language for autonomous agents, built off the ideas and motivations of Behavior Trees (BTs). BTs are a popular model for designing agents behavior in robotics and AI. However, as their growth has increased dramatically, the simple model of BTs has come to be limiting. There is a growing push to increase the functionality of BTs, with the end goal of BTs evolving into a programming language in their own right, centred around the defining BT properties of modularity and reactiveness. In this paper, we examine how the BT model must be extended in order to grow into such a language. We identify some fundamental problems which must be solved: implementing `reactive' selection, 'monitoring' safety-critical conditions, and passing data between actions. We provide a variety of small examples which demonstrate that these problems are complex, and that current BT approaches do not handle them in a manner consistent with modularity. We instead provide a simple set of modular programming primitives for handling these use cases, and show how they can be combined to build complex programs. We present a full specification for our BT-inspired language, and give an implementation in the functional programming language Haskell. Finally, we demonstrate our language by translating a large and complex BT into a simple, unambiguous program.

A Behavior Tree-inspired programming language for autonomous agents

TL;DR

This work addresses the gap between Behavior Trees and a full programming language for autonomous agents by proposing a Haskell-embedded BT-inspired language. It identifies key challenges—reactive selection, safety monitoring, and modular data flow—and introduces a minimal, composable set of primitives (non-reactive sequence, reactive rSelect, and monitor) to resolve them, along with a full specification. The approach emphasizes modularity, safety, and real-time reactiveness, demonstrated through a concrete translation of a complex BT into executable code. The resulting framework enables precise semantics, data-aware composition, and a practical path to evolving BTs into a dedicated programming language for autonomous systems with real-world applicability.

Abstract

We propose a design for a functional programming language for autonomous agents, built off the ideas and motivations of Behavior Trees (BTs). BTs are a popular model for designing agents behavior in robotics and AI. However, as their growth has increased dramatically, the simple model of BTs has come to be limiting. There is a growing push to increase the functionality of BTs, with the end goal of BTs evolving into a programming language in their own right, centred around the defining BT properties of modularity and reactiveness. In this paper, we examine how the BT model must be extended in order to grow into such a language. We identify some fundamental problems which must be solved: implementing `reactive' selection, 'monitoring' safety-critical conditions, and passing data between actions. We provide a variety of small examples which demonstrate that these problems are complex, and that current BT approaches do not handle them in a manner consistent with modularity. We instead provide a simple set of modular programming primitives for handling these use cases, and show how they can be combined to build complex programs. We present a full specification for our BT-inspired language, and give an implementation in the functional programming language Haskell. Finally, we demonstrate our language by translating a large and complex BT into a simple, unambiguous program.

Paper Structure

This paper contains 11 sections, 2 equations, 2 figures.

Figures (2)

  • Figure 1: An example of a BT programmed in our language. This desired specification is: the robot must enter a room to perform as task (performTask). Entering the room requires entering through some door (haskellopenPassClose). There are multiple doors into the room, and the robot must try to open each three times before moving on to the next door (haskellenterRoom). Finally, while performing this behavior, the robot must monitor its battery level. Whenever the level drops below 10, the robot must recharge fully before continuing (haskellmonitorBattery). Note how this complex behavior can be implemented in a precise, modular and safe way.
  • Figure 2: A Behavior Tree for a complex robotic task, from btbook.

Theorems & Definitions (2)

  • Definition 3.1: Reactive Selection
  • Definition 3.2: Monitor