[ICML 2024] Official repository for "Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models"
See the code
Official implementation for ICML 2024 paper Language Agent Tree Search Unifies Reasoning Acting and Planing in Language Models with code, prompts, model outputs.
More can be found at our project website or paper
Check out our demo, CodeLATS at our demo
For a more general implementation for your AI applications, please look at the LangChain implementation in LangGraph. LATS-LangChain
or the LlamaIndex implementation LATS-LlamaIndex
To get started:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd LanguageAgentTreeSearch/hotpot
pip install -r requirements.txt
OPENAI_API_KEY environment variable to your OpenAI API key:export OPENAI_API_KEY=<your key>
sh lats.sh
--n_generate_sample: number of times to prompt during expansion/sampling--n_evaluate_sample: number of times to prompt for state evaluation--iterations: maximum number of trajectories to sampleTo get started:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd LanguageAgentTreeSearch/programming
pip install -r requirements.txt
OPENAI_API_KEY environment variable to your OpenAI API key:export OPENAI_API_KEY=<your key>
sh run_lats.sh
Code adapted from https://github.com/noahshinn024/reflexion/tree/main
To get started:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd LanguageAgentTreeSearch/webshop
Install WebShop from source and run environment instance locally. Follow the instructions here (https://github.com/princeton-nlp/WebShop)
Install the module dependencies into your environment:
pip install -r requirements.txt
OPENAI_API_KEY environment variable to your OpenAI API key:export OPENAI_API_KEY=<your key>
Change localhost in lats.py to your local port running WebShop
Set the scripts and run paper experiments
sh lats.sh
--n_generate_sample: number of times to prompt during expansion/sampling--n_evaluate_sample: number of times to prompt for state evaluation--iterations: maximum number of trajectories to sampleprogramming/root/ contains all the trajectories from the paper's experiments on programming. Please use get_acc.py with the log path to get the actual accuracy. HotPotQA and WebShop logs were too large to upload, feel free to email if interested.
Please cite the paper and star this repo if you use LATS and find it interesting. Feel free to contact andyz3@illinois.edu or open an issue if you have any questions.
@misc{zhou2023language,
title={Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models},
author={Andy Zhou and Kai Yan and Michal Shlapentokh-Rothman and Haohan Wang and Yu-Xiong Wang},
year={2023},
eprint={2310.04406},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
58 followers · starred Oct 2023
8 followers · starred Dec 2023
31 followers · starred Jul 2025
Python
99.5%
[ICML 2024] Official repository for "Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models"
See the code
Official implementation for ICML 2024 paper Language Agent Tree Search Unifies Reasoning Acting and Planing in Language Models with code, prompts, model outputs.
More can be found at our project website or paper
Check out our demo, CodeLATS at our demo
For a more general implementation for your AI applications, please look at the LangChain implementation in LangGraph. LATS-LangChain
or the LlamaIndex implementation LATS-LlamaIndex
To get started:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd LanguageAgentTreeSearch/hotpot
pip install -r requirements.txt
OPENAI_API_KEY environment variable to your OpenAI API key:export OPENAI_API_KEY=<your key>
sh lats.sh
--n_generate_sample: number of times to prompt during expansion/sampling--n_evaluate_sample: number of times to prompt for state evaluation--iterations: maximum number of trajectories to sampleTo get started:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd LanguageAgentTreeSearch/programming
pip install -r requirements.txt
OPENAI_API_KEY environment variable to your OpenAI API key:export OPENAI_API_KEY=<your key>
sh run_lats.sh
Code adapted from https://github.com/noahshinn024/reflexion/tree/main
To get started:
git clone https://github.com/andyz245/LanguageAgentTreeSearch && cd LanguageAgentTreeSearch/webshop
Install WebShop from source and run environment instance locally. Follow the instructions here (https://github.com/princeton-nlp/WebShop)
Install the module dependencies into your environment:
pip install -r requirements.txt
OPENAI_API_KEY environment variable to your OpenAI API key:export OPENAI_API_KEY=<your key>
Change localhost in lats.py to your local port running WebShop
Set the scripts and run paper experiments
sh lats.sh
--n_generate_sample: number of times to prompt during expansion/sampling--n_evaluate_sample: number of times to prompt for state evaluation--iterations: maximum number of trajectories to sampleprogramming/root/ contains all the trajectories from the paper's experiments on programming. Please use get_acc.py with the log path to get the actual accuracy. HotPotQA and WebShop logs were too large to upload, feel free to email if interested.
Please cite the paper and star this repo if you use LATS and find it interesting. Feel free to contact andyz3@illinois.edu or open an issue if you have any questions.
@misc{zhou2023language,
title={Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models},
author={Andy Zhou and Kai Yan and Michal Shlapentokh-Rothman and Haohan Wang and Yu-Xiong Wang},
year={2023},
eprint={2310.04406},
archivePrefix={arXiv},
primaryClass={cs.AI}
}
58 followers · starred Oct 2023
8 followers · starred Dec 2023
31 followers · starred Jul 2025
Python
99.5%