LLM-OBTEA
June 27, 2026 ยท View on GitHub
Integrating Intent Understanding and Optimal Behavior Planning for Behavior Tree Generation from Human Instructions โ IJCAI 2024
A two-stage framework that (1) uses Large Language Models to understand the intent behind high-level human instructions and (2) builds efficient, goal-specific behavior trees through the Optimal Behavior Tree Expansion Algorithm (OBTEA / HOBTEA). Goals are expressed as well-formed formulas in first-order logic, bridging intent understanding and optimal behavior planning.
๐ฐ News
- [2026-06] ๐ MRBTP-demo is now online! A slim, tutorial-friendly version of MRBTP โ the multi-robot extension of our behavior-tree planning line of work โ has been released at https://github.com/DIDS-EI/MRBTP-demo. Highly recommended as a quick-start for multi-robot BT planning.
- [2025-02] ๐ MRBTP (AAAI 2025 Oral, Top 4.6%) has been released, extending OBTEA to multi-robot collaboration with sound & complete guarantees.
- Project page: https://dids-ei.github.io/Project/MRBTP/
- Code: https://github.com/DIDS-EI/MRBTP
- Demo / Tutorial: https://github.com/DIDS-EI/MRBTP-demo
- Paper: https://arxiv.org/abs/2502.18072
- [2025-01] โจ This slim demo version of LLM-OBTEA is publicly available. For the full version, see https://github.com/DIDS-EI/LLM-OBTEA.
โจ This is the slim version, hosted at https://github.com/DIDS-EI/OBTEA-demo. To generate a behavior tree for a custom task, start from
test_demo/run_demo_task.py.
๐ A styled HTML version of this README (light theme, with figures) is available at
readme.html.

๐ Table of Contents
- Installation
- Directory Structure
- Usage
- Getting Started
- Generate a BT for a Custom Task
- Simulation
- Citation
- License
๐ ๏ธ Installation
1. Create a conda environment
conda create --name BTPG python=3.10
conda activate BTPG
2. Install BTPG
cd OBTEA-demo
pip install -e .
3. Download simulators (optional, only Windows is tested)
The planning and visualization steps run without a simulator; only the real simulation demo needs one.
VirtualHome
| Operating System | Download Link |
|---|---|
| Linux | Download |
| MacOS | Download |
| Windows | Download |
Unzip and move the files into simulators/virtualhome/.
RoboWaiter
๐ Download RoboWaiter
Unzip and run CafeSimulator.exe. The simulator shows an empty scene and waits for the code to populate it and drive the robot.
๐ Directory Structure
OBTEA-demo/
โโโ btpg/ # Core library
โ โโโ agent/ # Agent configuration
โ โโโ algos/ # Algorithms
โ โ โโโ bt_planning/ # BT planning: ReactivePlanning / BTExpansion / OBTEA / HOBTEA
โ โ โโโ llm_client/ # LLM intent-understanding client
โ โโโ behavior_tree/ # Behavior tree engine and node definitions
โ โโโ envs/ # Scene environments (VirtualHome / RoboWaiter / RobotHow ...)
โ โโโ utils/ # Helpers and utilities (incl. unified output path)
โโโ docs/ # Documentation (project notes + HTML README)
โโโ images/ # README assets
โโโ output/ # Unified directory for ALL generated artifacts (git-ignored)
โโโ test_demo/ # Minimal example for a custom task
โ โโโ run_demo_task.py
โโโ test_exp/ # Experiment scripts
โ โโโ main.py # Interactive demo entry (easy / medium / hard)
โ โโโ main_VH_easy.py
โ โโโ main_VH_medium.py
โ โโโ main_VH_hard.py
โ โโโ data/ # Test datasets
โโโ requirements.txt
โโโ setup.py
โโโ README.md
๐๏ธ Output convention: every generated file (
*.btml,*.dot,*.png,*.svg) is written to the project-rootoutput/folder, resolved at runtime viabtpg.utils.path.get_output_path(). The folder is git-ignored, so the source tree stays clean.
๐ Usage
Run the interactive demo and pick a task (easy / medium / hard) when prompted:
python test_exp/main.py
The generated behavior tree and its visualizations will appear under output/.
๐ Getting Started
LLM-OBTEA uses OpenAI's GPT-3.5 as the language model. You need an OpenAI API key, which you can obtain here.
After installation, a minimal end-to-end run looks like this:
import time
from btpg import BehaviorTree
from btpg.utils.tools import setup_environment
from btpg.utils.path import get_output_path
from btpg.algos.bt_planning.main_interface import BTExpInterface
from btpg.algos.llm_client.tools import goal_transfer_str
# 1. Initialize environment and current state
env, cur_cond_set = setup_environment("VH") # RW / RH / RHS
goal_str = 'IsIn_milk_fridge & IsClose_fridge'
goal_set = goal_transfer_str(goal_str) # [{'IsIn(milk, fridge)', 'IsClose(fridge)'}]
# 2. Plan the behavior tree
algo = BTExpInterface(env.behavior_lib, cur_cond_set=cur_cond_set,
priority_act_ls=[], key_predicates=[], key_objects=[],
selected_algorithm="hobtea", mode="big",
act_tree_verbose=False, time_limit=15,
heuristic_choice=0, output_just_best=True)
algo.process(goal_set)
time_limit_exceeded = algo.algo.time_limit_exceeded
ptml_string, cost, expanded_num = algo.post_process()
# 3. Save and visualize (all artifacts go to output/)
output_dir = get_output_path()
btml_path = f"{output_dir}/tree.btml"
with open(btml_path, "w") as file:
file.write(ptml_string)
bt = BehaviorTree(btml_path, env.behavior_lib)
bt.print()
bt.draw(target_directory=output_dir) # writes .dot / .png / .svg
# 4. Execute the behavior tree
error, state, act_num, current_cost, record_act_ls, ticks = \
algo.execute_bt(goal_set[0], cur_cond_set, verbose=False)
print(f"\x1b[32m Goal: {goal_str} \n Executed {act_num} action steps\x1b[0m",
"\x1b[31mERROR\x1b[0m" if error else "",
"\x1b[31mTIMEOUT\x1b[0m" if time_limit_exceeded else "")
print("Current cost:", current_cost, "Expanded nodes:", expanded_num)
# 5. (Optional) Run inside the simulator
goal = goal_set[0]
env.agents[0].bind_bt(bt)
env.reset()
is_finished = False
while not is_finished:
is_finished = env.step()
if goal <= env.agents[0].condition_set:
is_finished = True
env.close()
๐งฉ Generate a BT for a Custom Task
To build a behavior tree for your own task (see test_demo/run_demo_task.py):
- Create your environment under
btpg/envs, e.g.DemoEasy. The key is defining the action and condition classes inexec_lib, paying attention to each action's preconditions (pre), additions (add), deletions (del) and optional parameters. - Provide the path to
exec_libto import thebehavior_lib. - Specify the
goaland the current statecur_cond_setbefore running the planner. - Drawing the BT requires the
.btmlfile and the importedbehavior_lib.
๐ฎ Simulation
Examples from two simulation scenarios, showing behavior trees generated by LLM-HOBTEA and their environments.
RoboWaiter
A service robot performing tasks in a cafรฉ.
Goal: On(Coffee,Table3) & Active(AC)
VirtualHome
A household robot performing domestic tasks.
Goal: IsIn(bananas,fridge) & IsClose(fridge)
๐ Citation
This repository accompanies our IJCAI 2024 paper. If you use this code or build on our work, please cite:
Xinglin Chen, Yishuai Cai, Yunxin Mao, Minglong Li, Wenjing Yang, Weixia Xu, and Ji Wang. Integrating Intent Understanding and Optimal Behavior Planning for Behavior Tree Generation from Human Instructions. In Proceedings of the 33rd International Joint Conference on Artificial Intelligence (IJCAI), pages 6832โ6840, 2024.
@inproceedings{chen2024obtea,
title = {Integrating Intent Understanding and Optimal Behavior Planning for Behavior Tree Generation from Human Instructions},
author = {Chen, Xinglin and Cai, Yishuai and Mao, Yunxin and Li, Minglong and Yang, Wenjing and Xu, Weixia and Wang, Ji},
booktitle = {Proceedings of the Thirty-Third International Joint Conference on Artificial Intelligence (IJCAI)},
pages = {6832--6840},
year = {2024},
doi = {10.24963/ijcai.2024/755},
url = {https://www.ijcai.org/proceedings/2024/0755.pdf}
}
Resources: Paper (IJCAI) ยท arXiv:2405.07474 ยท DOI
๐ License
This project is licensed under the MIT License. See the LICENSE file for details.
Copyright ยฉ 2024 DIDS-EI. All rights reserved.
We will continue to update and maintain this project โ stay tuned!