Skip to content

Software

BehaviorTree.CPP

By BehaviorTree, from github.com/BehaviorTree/BehaviorTree.CPP (opens in a new tab)

  • Middleware
  • Library
  • MIT

A C++17 library for building behavior trees, mainly for robotics but also usable for game AI or replacing finite state machines. Trees are defined in an XML-based scripting language.

Facts

GitHub stars
4,320read on 27 Nov 2026
Last update
13 Nov 2026Newest commit on master
Maintenance
Activea commit in the last 90 days
Difficulty
Intermediate
Hardware it needs, as the project states it
A compiler that supports C++17. Builds are supported with colcon (ament) for ROS2, conan (Linux/Windows), or straight cmake.

Checked on GitHub on 27 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 365b2e4 (opens in a new tab), on 13 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Makes asynchronous, non-blocking Actions a first-class feature.
  • Supports reactive behaviors that run multiple Actions concurrently.
  • Trees are loaded at run-time from an XML-based scripting language rather than hard-coded in C++.
  • Custom TreeNodes can be statically linked or loaded at run-time as plugins.
  • Provides a type-safe mechanism for dataflow between Nodes of a tree.
  • Includes logging and profiling to visualize, record, replay, and analyze state transitions.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
MIT. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's website (opens in a new tab)
Maintenance
Active, last commit on 13 Nov 2026.

Use it

How to install it, in the creator's words: The project's website (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 365b2e4

Robotheca read the repository at two versions: the summary at 03ec870 and the facts and the README at 365b2e4 (read on 27 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by BehaviorTree, at commit 365b2e4, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

(opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab)

BehaviorTree.CPP 4.9

This C++ 17 library provides a framework to create BehaviorTrees. It was designed to be flexible, easy to use, reactive and fast.

Even if our main use-case is robotics, you can use this library to build AI for games, or to replace Finite State Machines.

There are a few features that make BehaviorTree.CPP unique, when compared to other implementations:

  • It makes asynchronous Actions, i.e. non-blocking, a first-class citizen.

  • You can build reactive behaviors that execute multiple Actions concurrently (orthogonality).

  • Trees are defined using a Domain Specific scripting language (based on XML), and can be loaded at run-time; in other words, even if written in C++, the morphology of the Trees is not hard-coded.

  • You can statically link your custom TreeNodes or convert them into plugins and load them at run-time.

  • It provides a type-safe and flexible mechanism to do Dataflow between Nodes of the Tree.

  • It includes a logging/profiling infrastructure that allows the user to visualize, record, replay, and analyze state transitions.

Documentation

GUI Editor

Editing a BehaviorTree is as simple as editing an XML file in your favorite text editor.

If you are looking for a fancier graphical user interface (and I know you do) check Groot2 (opens in a new tab) out.

Groot screenshot

How to compile

BT.CPP requires a compiler that supports C++17.

Three build systems are supported:

  • colcon (ament), if you use ROS2
  • conan otherwise (Linux/Windows).
  • straight cmake if you want to be personally responsible for dependencies :)

Compiling with conan (opens in a new tab):

[!NOTE] Conan builds require CMake 3.23 or newer.

Assuming that you are in the root directory of BehaviorTree.CPP:

conan install . -s build_type=Release --build=missing
cmake --preset conan-release
cmake --build --preset conan-release

If you have dependencies such as ZeroMQ and SQlite already installed and you don't want to use conan, simply type:

mkdir build_release
cmake -S . -B build_release
cmake --build build_release --parallel

BT.CPP includes its own copy of nlohmann/json (opens in a new tab). To use the one installed in your system instead (version 3.10 or newer), add -DUSE_VENDORED_JSON=OFF. Since nlohmann::json is part of the public API, everything that links BT.CPP must then be compiled with that same version.

If you want to build in a pixi (opens in a new tab) project (conda virtual environment).

pixi run build

If you want to use BT.CPP in your application, please refer to the example here: https://github.com/BehaviorTree/btcpp_sample (opens in a new tab) .

Installing BehaviorTree.CPP (vcpkg)

Alternatively, you can build and install behaviortree-cpp using vcpkg (opens in a new tab) dependency manager:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh
./vcpkg integrate install
./vcpkg install behaviortree-cpp

The behaviortree-cpp port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please create an issue or pull request (opens in a new tab) on the vcpkg repository.

Commercial support

Are you using BT.CPP in your commercial product, and do you need technical support / consulting? You can contact the primary author, dfaconti@aurynrobotics.com (opens in a new tab), to discuss your use case and needs.

Previous version

Version 3.8 of the software can be found in the branch v3.8 (opens in a new tab).

That branch might receive bug fixes, but the new features will be implemented only in the master branch.

Star History

(opens in a new tab)

Contributors

Image (opens in a new tab) (opens in a new tab)

License

The MIT License (MIT)

Copyright (c) 2019-2026 Davide Faconti

Copyright (c) 2018-2019 Davide Faconti, Eurecat

Copyright (c) 2014-2018 Michele Colledanchise

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.