mrkeyoor.com_
Thu 01 Oct 19:40 UTC
AI Toolsevaluationupdated 26 Aug 2026

bonsai review

Bonsai is a Rust library for expressing game, robotics, and agent control logic as behavior trees that return running, success, or failure on each tick. It also publishes Python bindings and includes a browser visualizer for watching a tree execute.

+2stars / 7d
Verdict

Our Bonsai build failed after 118 seconds and its test command failed after 6 seconds because the linker could not find Python 3.11, so a whole-workspace source checkout is not ready on a plain Rust image. The core design is appealing for Rust teams that want deterministic, tick-based behavior and can keep long work outside the traversal. Use the published Rust crate first; adopt the Python binding or full workspace only after proving the native Python toolchain on every target.

We ran it

Lab card: what happened when we ran bonsaiScreenshot of bonsai (github.com/Sollimann/bonsai)
Install✓ · 33s401 packages
Build✗ · 184s
Tests✗ · 7sran, no count parsed
Repo102 files~10,454 lines of source · 6.1 MB · 4 CI workflows

Answers from our run

Does bonsai build from source?

Dependencies installed in 33 seconds (401 packages), and the build failed. We cloned commit fa3d2ce into a clean Debian container with 3 CPUs and no project-specific setup.

Do bonsai's tests pass?

The test command failed in our container, and its output did not report a pass or fail count.

Who should not use bonsai?

Teams needing a typed port and blackboard model between nodes: open issue 61 says Bonsai currently passes one monolithic context object through the tree.

What are the alternatives to bonsai?

BehaviorTree.CPP, gdx-ai. Our Bonsai build failed after 118 seconds and its test command failed after 6 seconds because the linker could not find Python 3.

Setup2/5Core packages install, but workspace linking needs Python 3.11
Docs4/5Concepts, Rust, Python, examples, and visualizer are explained
Community3/51,042 stars and nine combined open issues and PRs
Maturity3/5Useful primitives exist; typed ports and decorators remain open

Who it’s for

Rust developers building deterministic control logic for games, simulations, robots, or software agents.
Teams that want sequence, selection, waiting, inversion, looping, and parallel behavior in a small declarative tree.
Python users who want the same tree semantics through a native extension and can use a compatible published wheel.
Engineers who need to inspect live node state through the included WebSocket visualizer.

Who it’s NOT for

Teams needing a typed port and blackboard model between nodes: open issue 61 says Bonsai currently passes one monolithic context object through the tree.
Users who require configurable N-of-M parallel success rules today: issue 62 says the library has simpler WhenAny behavior and asks for threshold-based execution.
Projects expecting built-in timeout, retry, repeat, and force-result decorators: issue 78 lists those as additions rather than current primitives.
Rust-only builds that cannot provide Python development libraries while compiling the whole workspace: our build and test commands both failed because the linker could not find -lpython3.11.
Event loops where actions may block for seconds or minutes: the README says actions must return immediately and long jobs should be dispatched to background threads.

Setup reality

Our sandbox installed 402 packages in 48 seconds. The build failed with exit 101 after 118 seconds, and tests failed with exit 101 after 6 seconds. Both log tails show bonsai-py failing to link because rust-lld could not find -lpython3.11.

Rust users can add the bonsai-bt crate, while Python users can install the bonsai-bt package from PyPI or build it with maturin. No API key or hosted service is required. The optional live inspector opens a local WebSocket-backed page.

The README declares Rust 1.72 or newer. Building the complete workspace pulls in the Python binding and therefore needs a matching Python library available to the linker. Graphviz output, graphical examples, audio or device examples, and the browser visualizer bring their own host dependencies beyond the core tree library.

Running, success, and failure drive every tree tick

Bonsai models control logic as a tree whose nodes return Running, Success, or Failure. Sequence nodes advance when children succeed, selectors try another path after failure, and decorators change a child's result or repetition. The library also has parallel forms such as WhenAll, WhenAny, Race, and After. This vocabulary suits game characters, robot routines, simulations, and software agents where priorities and fallback paths become hard to follow in a large state machine.

The repository we measured had 99 files, about 10,142 source lines, and occupied 6 MB. Rust is the primary implementation, with a Python extension exposing the same engine through a different API. The core is available as bonsai-bt on crates.io, and Python users import a package of the same name as bonsai_bt. Its MIT license allows commercial and internal use under straightforward terms.

Determinism stops at side effects inside one tick

The concepts guide is unusually candid about parallel semantics. Bonsai remains deterministic at the tree level, but it cannot perfectly simulate simultaneous events within a single-threaded time slice. If two racers finish inside the same update interval, list order may determine which completion the tree observes first. Applications should keep the authoritative physics, clocks, or external facts outside the tree and use Bonsai to decide what action follows from them.

Actions also need to return immediately. The README says work lasting seconds or minutes should run in background threads, with status sent back through a channel. That requirement keeps traversal responsive, but Bonsai does not become an async job runner by itself. The checkout's 10,142 source lines include an async-drone example showing the pattern. Teams still own cancellation, thread failures, resource cleanup, and the boundary between a tick and an external task.

What happened when we ran it

Our sandbox installed 402 packages in 48 seconds. The build then failed with exit code 101 after 118 seconds. The linker error came from bonsai-py and said rust-lld: error: unable to find library -lpython3.11. The same tail shows the Rust core, Python package, and examples compiling in one workspace. This result describes commit acd9c81 in a fresh unprivileged container with 3 CPUs and 12 GB of RAM.

Tests failed with exit code 101 after 6 seconds for the same stated reason. The linker could not produce the bonsai-py test library without Python 3.11. No test cases ran to a pass or fail result in the supplied summary, so this is a build prerequisite finding rather than evidence of wrong behavior-tree semantics. The repository had 4 CI workflow files, no Dockerfile, and no tests directory visible to the harness.

The failure also clarifies the lowest-risk adoption path. A Rust application can start with the published core crate instead of building every workspace member. Python users can try the published wheel before compiling with maturin. Anyone changing the shared repository should install a matching Python development library and verify what the linker sees. Our 118-second build reached native linking before stopping, so simply rerunning Cargo without fixing the environment would not address the logged error.

The blackboard is one context object, not typed ports

Bonsai separates a declarative behavior from the runtime state that tracks its progress. An application supplies its own action type and context, then handles each action in a callback. That is flexible in Rust and keeps domain data outside the library. Open issue 61 points to the tradeoff: state moves through one monolithic context object instead of a decoupled blackboard with typed inputs and outputs between nodes. Large trees may need application conventions to prevent that context from becoming a grab bag.

The available node set covers many common flows, but it does not match every behavior-tree system. Issue 62 asks for an N-of-M threshold across parallel children because WhenAny is less flexible. Issue 78 requests force-result, timeout, retry, repeat, and keep-running decorators. All 3 issues remained open, so buyers should compare their required tree vocabulary with the current API instead of assuming familiar names from another library exist here.

v0.12.0 added a live view on port 8910

Release v0.12.0, published May 14, 2026, added live behavior-tree visualization. The example enables telemetry on port 8910, runs a 30-node tree, and opens a browser view that colors node status and marks the active path. Graphviz export is also documented for static diagrams. These tools are useful when a tree's declarative shape looks correct but its running state does not match what an operator sees.

GitHub recorded the last push on August 17, 2026, and issue 78 was updated on August 21. The repository had 1,042 stars and 9 combined open issues and pull requests. That is recent activity with a modest queue, though the combined count is not a defect count. The open design requests concern meaningful API gaps, while the current examples include game AI, flocking, background drone work, timeouts through racing behavior, and the live inspector.

Bonsai is worth trying when the Rust crate already has the primitives your control logic needs. Its small source tree and explicit tick model are easier to reason about than a homegrown nest of state transitions. The full workspace asks more of the machine than the core API suggests because Python linking is part of the default path we exercised. Keep the first evaluation narrow: build the Rust crate, model one real tree, and test cancellation plus side effects before expanding to Python or visualization.

Alternatives

ProjectWhat it isPick it when
BehaviorTree.CPPA C++ behavior-tree library with a larger batteries-included tooling ecosystem.pick this instead when C++ robotics integration, typed ports, and established behavior-tree tooling matter more than Rust bindings.
gdx-aiA Java AI toolkit covering behavior trees, steering, pathfinding, and state machines.pick this instead when a Java or libGDX game needs several AI systems in one library.

What people are saying

  1. [github-trending] Sollimann/bonsai
  2. [hackernews] Bonsai: Janestreet's UI Library

Sources

  1. Bonsai README
  2. Bonsai repository facts
  3. Bonsai v0.12.0 release
  4. Bonsai concepts guide
  5. Typed blackboard issue 61
  6. Decorator issue 78

More ai tools reviews

UniMate · unigit-ecosystem · handraw-style · souchastnik · dlssg_for_sm86 · glm-flash-offline-client · the whole board →