Skip to main content

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_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

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smolagents_lats-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

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

Hashes for smolagents_lats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af928d0743a1714e8c5a59caaec149c6e66da30993c999c8e3ab84dac11e3126
MD5 6c3b48eff0aa160682e5e5ec8e48eb70
BLAKE2b-256 22f41bda982dea5f70b1e1c828f209d3cbdcbb350eb080f73860e4ed9bd90ff4

See more details on using hashes here.

File details

Details for the file smolagents_lats-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for smolagents_lats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ec23707e1710140409296ee55a89ff10120c3f571e7ace46fdc4dc26d78c311
MD5 0e29b4e04841d6f1b279f66d8759af51
BLAKE2b-256 05d76b1897ca70154dde96ffd15944e3e048b8b9cb162738ceeba9b41b001d61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page