LATS (Language Agent Tree Search) agent for smolagents
Project description
smolagents-lats
LATS (Language Agent Tree Search) agent for smolagents.
Instead of a linear ReAct loop, LATSAgent expands a search tree, scores branches with UCT, and reflects on failed paths.
Based on the paper: arxiv.org/abs/2310.04406
Install
pip install smolagents-lats
Usage
from smolagents import HfApiModel
from smolagents_lats import LATSAgent
model = HfApiModel()
agent = LATSAgent(
tools=[],
model=model,
n_branches=3,
max_depth=4,
)
result = agent.run("What is the 10th Fibonacci number?")
print(result)
How it works
- Expand — generates
n_branchescandidate actions at each step - Score — asks the LLM to score each branch (0.0 → 1.0)
- UCT select — picks the most promising unexplored branch
- Reflect — on failed paths, generates a verbal self-critique fed back as context
Parameters
| Parameter | Default | Description |
|---|---|---|
n_branches |
3 | Candidate actions generated per step |
max_depth |
4 | Max tree depth before forcing answer |
exploration_weight |
1.4 | UCT exploration constant |
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smolagents_lats-0.1.0.tar.gz
(6.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smolagents_lats-0.1.0.tar.gz.
File metadata
- Download URL: smolagents_lats-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af928d0743a1714e8c5a59caaec149c6e66da30993c999c8e3ab84dac11e3126
|
|
| MD5 |
6c3b48eff0aa160682e5e5ec8e48eb70
|
|
| BLAKE2b-256 |
22f41bda982dea5f70b1e1c828f209d3cbdcbb350eb080f73860e4ed9bd90ff4
|
File details
Details for the file smolagents_lats-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smolagents_lats-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ec23707e1710140409296ee55a89ff10120c3f571e7ace46fdc4dc26d78c311
|
|
| MD5 |
0e29b4e04841d6f1b279f66d8759af51
|
|
| BLAKE2b-256 |
05d76b1897ca70154dde96ffd15944e3e048b8b9cb162738ceeba9b41b001d61
|