Awesome
🌳 Dendron
<div align="center" style="margin-bottom: 0em;">Dendron is a library for building software agents using behavior trees and language models.
</div>News
April 2024: New on arXiv: Behavior Trees Enable Structured Programming of Language Model Agents
Behavior Trees for Structured Programming of LLMs
Behavior trees are a technique for building complex reactive agents by composing simpler behaviors in a principled way. The behavior tree abstraction arose from Robotics and Game AI, but the premise of Dendron is that this abstraction can enable more sophisticated language-based agents.
Here is an example behavior tree that implements a chat agent. This agent listens to a human via microphone, performs automatic speech recognition (ASR), uses a chat model to generate a response, and plays the audio of that response using a text-to-speech (TTS) system. All locally, using models downloaded from Hugging Face:
You can build this agent by following the tutorial here.
Installation
To install Dendron, run
pip install dendron
This will automatically install torch, transformers, bitsandbytes, accelerate, and sentencepiece, and protobuf. You should consider installing and using Flash Attention, which is just a pip install, but has prerequisites that you should manually check. It's worth it though - maybe doubling your inference speeds.
Examples
For examples of basic language model node usage, see the example notebooks in this repository. For larger and more interesting examples, see the examples repo.
Documentation
You can find the main documentation for Dendron here. This includes a full tutorial building a chat agent that has text-to-speech and automatic speech recognition capabilities, and an API reference.
The Paper
If you use Dendron in academic research, please cite the paper:
@misc{kelley2024behavior,
title={Behavior Trees Enable Structured Programming of Language Model Agents},
author={Richard Kelley},
year={2024},
eprint={2404.07439},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
Acknowledgements
This work was supported in part by the Federal Transit Administration and the Regional Transportation Commission of Washoe County.