Skip to main content

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_branches candidate 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

Metadata

Release files for smolagents-lats 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smolagents-lats 0.1.0
File Size Uploaded
smolagents_lats-0.1.0.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smolagents-lats 0.1.0
File Interpreter ABI Platform
smolagents_lats-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / smolagents_lats-0.1.0.tar.gz

Download URL smolagents_lats-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
af928d0743a1714e8c5a59caaec149c6e66da30993c999c8e3ab84dac11e3126
BLAKE2b-256 checksum
How to use checksums
22f41bda982dea5f70b1e1c828f209d3cbdcbb350eb080f73860e4ed9bd90ff4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release files / smolagents_lats-0.1.0-py3-none-any.whl

Download URL smolagents_lats-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ec23707e1710140409296ee55a89ff10120c3f571e7ace46fdc4dc26d78c311
BLAKE2b-256 checksum
How to use checksums
05d76b1897ca70154dde96ffd15944e3e048b8b9cb162738ceeba9b41b001d61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page