Skip to main content

klein

klein lets you watch a running BehaviorTree.CPP v4 tree live in your browser. You see which nodes are running, succeeding or failing, plus the current blackboard values, as the robot ticks.

klein's Tree view: a CrossDoor tree paused on PickLock's failure, the Blackboard on the left, the inspector with PickLock's activity strip and facts on the right, and the bar's strips below

Install

Install it from PyPI with uv:

uv tool install klein-bt

uv fetches a newer Python by itself if yours is older than the 3.10 klein needs. pipx works too:

pipx install klein-bt

This gives you two commands: klein-bt (the dashboard) and klein-bt-mock (a fake robot for trying it out).

Run it

klein-bt                                          # robot on 127.0.0.1:1667
klein-bt --robot-host 10.0.0.5 --robot-port 1667  # robot somewhere else
klein-bt --port 8080 --no-browser                 # don't open a browser
klein-bt --host 0.0.0.0                           # let other machines open it
klein-bt --open-log run.btlog                         # a saved recording, no robot
Flag Default Meaning
--robot-host 127.0.0.1 IP address of the robot
--robot-port 1667 Groot2 publisher port on the robot
--host 127.0.0.1 interface the dashboard is served on; 0.0.0.0 opens it to the network
--port 8080 port the dashboard is served on
--no-browser off don't open the browser automatically
--record-buffer 10m how much recent history to record (90s, 30m, 1h); 0 turns recording off
--open-log FILE show a saved .btlog (and FILE.bb.jsonl beside it) instead of a robot

klein opens http://localhost:8080 for you. You can start it before the robot is up; it keeps retrying until the robot appears.

By default only this machine can open the dashboard. To watch from another computer (klein on the robot, the browser on your laptop), pass --host 0.0.0.0 and open http://<this machine's address>:8080 there. There is no password: anyone who can reach that port sees the live tree and blackboard values and can download the recording. Do this only on a network you trust, or use an SSH tunnel instead (ssh -L 8080:localhost:8080 robot, then http://localhost:8080).

Using the dashboard

  • Each card's outline and mark show its status: green Success, amber Running (the mark spins while live), red Failure, grey Idle.
  • Scroll to pan (Shift+scroll sideways), Ctrl+scroll or pinch to zoom, and drag to pan. Double-click a node, or click the − under it, to fold or unfold its children; a folded node shows +N for what it hides. A tree that fits opens unfolded, a bigger one with its subtrees folded. The edges to the running nodes light up.
  • Click a node to select it: the inspector on the right shows its path, its activity over the window (a click on it goes to that moment) and its ports, with the blackboard value each {key} holds at the moment shown. Click a blackboard key to select it instead: the inspector shows its value, its board and the nodes that write and read it. [ and ] step to the selection's previous and next change. Click the background, or press Esc, to clear the selection. Press / to search for a node or key by name.
  • Press R to see the whole tree again, or F to jump to whatever is running. V folds the tree down to the part that ran in the zoomed-in strip's window.
  • The rail on the left switches between the Tree and the Timeline (or press 1 and 2); the selection and the moment you look at stay. Its ? lists every key, and its settings choose the theme (Auto, Light, Dark) and a vertical or horizontal tree.
  • The Blackboard panel shows every subtree's values. A value that just changed gets a thin blue edge that fades; a key that changes all the time (a position, a counter) gets a steady dim edge instead. Hover a board to find its node in the tree. See docs/blackboards.md for how values are shown.
  • Hover a key to see which nodes use it: writers outlined solid, readers dashed. Hover a node to ring its keys.
  • Drag the side panel's right edge to make it wider or narrower, or fold it away by clicking the Tree icon in the rail again (or its header's button, or double-clicking the edge) for more room. klein remembers both.

If the robot loads a different tree, the dashboard switches to it by itself.

Record, rewind and replay

klein records everything the robot does (BehaviorTree.CPP 4.3.3 or newer), blackboard included, and keeps the last 10 minutes. Change that with --record-buffer (30m, 1h, or 0 to turn recording off). Don't log from Groot2 against the same robot at the same time: each would get only some of the transitions.

klein's Timeline view: the Log and the tree map on top, each node's and key's activity over the window below, and the bar

The bar along the bottom shows the recording, in both views:

  • The buttons on the left go to the oldest moment kept, step to the previous or next failure (red) or transition, and play at 1×. While live, the play button reads pause: press it to freeze the tree and the blackboard right where they are.
  • Beside them, ● Live says you are live. In the past Go live takes its place and takes you back; the view gets a thin blue frame and a flag on the cursor gives its time, counting up from when klein started recording (2:21.5; hover it for the time of day). The robot gone reads Offline; an opened file shows Go to end, or ● End at its end.
  • − 30 s + sets the window: how much the zoomed-in strip, the Timeline, the Log and the inspector show (type a length, or step it).
  • The strip to the right shows the whole recording (scrolling once it is longer than eight windows): its waveform shows how busy the robot was, red pins are failures, hatched stretches are outages, and its box is the window. Click or drag it to go to that moment; hover it for the time.
  • The keys work wherever the focus is (except in a text field): ←/→ step, Shift+←/→ step through failures, Space plays or pauses, Home goes to the oldest moment kept, End goes live, Esc steps back one thing at a time, and R fits the tree or, in the Timeline view, the Timeline. ? lists them all.

The recorder sits in the rail, above ?: a dot and how much is kept (2:27, 1.0 h; hover it for the rest), and Save, which downloads one .zip with a .btlog per tree run (Groot2 opens these) and its blackboard in a .bb.jsonl beside it.

The Timeline view (2) shows the recording in full:

  • Timeline, along the bottom: each node's running time as bars, so every retry shows, and each blackboard key's value under its board's node. Drag the playhead to go back in time. The inspector's button opens it on the selected node.
  • Log, top left: every transition in the window. Click a row to select its node and see the tree and blackboard at that moment.
  • The tree map, top right: every node's status at that moment; click a dot to select it. The search field above it filters the rows and the Log to the nodes and subtrees you name.
  • Drag the splitters to share the room; klein remembers them.

klein-bt --open-log FILE.btlog shows a saved recording without a robot, in the same Log and Timeline. It opens paused at its start, ready to play, and End takes you to its end. Unzip a saved .zip first; the .bb.jsonl beside the file brings its blackboard along.

Set up your robot

klein talks to the Groot2 publisher that comes with BehaviorTree.CPP v4. If Groot2 can connect to your robot, klein can too. If not, add a publisher after you create the tree:

#include "behaviortree_cpp/loggers/groot2_publisher.h"

auto tree = factory.createTreeFromFile("my_tree.xml");
BT::Groot2Publisher publisher(tree, 1667);

The publisher also uses the next port up (1668), so leave that one free.

Try it without a robot

klein-bt-mock --port 1777        # in one terminal
klein-bt --robot-port 1777       # in another

The mock runs a robot barista: 76 nodes, seven subtrees, orders that fail now and then. --tree crossdoor publishes BehaviorTree.CPP's t11 CrossDoor tree instead, --tree nested a tree with a subtree inside a subtree, and --switch-every 200 swaps between two trees every 20 seconds or so.

Docs

License

klein is released under the MIT License — see LICENSE.

The dashboard bundles D3.js v7 (ISC License, © Mike Bostock), served locally so it works on air-gapped networks.

Disclaimer

klein is an independent tool. It is not affiliated with, endorsed by, or sponsored by the BehaviorTree.CPP project or the authors of Groot / Groot2. "BehaviorTree.CPP", "Groot", and "Groot2" are the property of their respective owners. klein interoperates over the Groot2 publisher wire protocol that is part of the open-source, MIT-licensed BehaviorTree.CPP library; it contains no code copied from those projects.

Metadata

Release files for klein-bt 0.9.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 klein-bt 0.9.0
File Size Uploaded Provenance Actions
klein_bt-0.9.0.tar.gz 333.4 kB With provenance Details for klein_bt-0.9.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for klein-bt 0.9.0
File Interpreter ABI Platform Actions
klein_bt-0.9.0-py3-none-any.whl Python 3 none any Details for klein_bt-0.9.0-py3-none-any.whl

Total release size: 689.8 kB

Release files / klein_bt-0.9.0.tar.gz

Download URL klein_bt-0.9.0.tar.gz
Size 333.4 kB
Tags Source
SHA-256 checksum
How to use checksums
335534b0eda9b5ebaee70a3340731a5f826b97ec663c1a2ced959a15c85df3d1
BLAKE2b-256 checksum
How to use checksums
00e2a878a2443f98b526364c7ef04e6ff7cbd0a9db0080a2b81119cc4a5c9ae6
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 Dec 1, 2026.

Transparency log

Release files / klein_bt-0.9.0-py3-none-any.whl

Download URL klein_bt-0.9.0-py3-none-any.whl
Size 356.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99f9e3343fa1d0daca04e360b5be607f70a9b13257ce2a9c90e02c0070cf4b4b
BLAKE2b-256 checksum
How to use checksums
23eccad975f022a2beaa1c316e0904758883468763bce39390c2502fb7159d69
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 Dec 1, 2026.

Transparency log

Security for klein-bt 0.9.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for klein_bt-0.9.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 Dec 1, 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.

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