Language agent tree search

Also known as: LATS

On this page 7

Language agent tree search (LATS) is an agent framework that combines Monte Carlo tree search with a large language model acting as the policy, the value function and the critic, so that the agent can explore several alternative action sequences instead of committing to a single chain. Among AI agents, it unifies reasoning, acting and planning in one search procedure and extends earlier methods such as ReAct prompting and Reflexion.

Rather than executing the first plausible action, a LATS agent builds a tree of states, scores promising branches, learns from failed attempts through verbal self-reflection, and backs up those lessons so that later choices improve. The price of this deliberation is a much higher number of model calls per task.

How language agent tree search works

LATS treats a task as a search over states, where each node holds the instruction, the history of thoughts and actions, and the observations returned by the environment. The algorithm repeats a loop of six operations until it finds a successful trajectory or exhausts its search budget.

The table below describes each operation and the role the language model plays in it.

OperationWhat happensRole of the language model
SelectionDescend the tree using an upper confidence boundNone, uses stored values
ExpansionSample several candidate actions from the chosen nodeActs as the policy
EvaluationScore each new child stateActs as the value function
SimulationRoll out a branch until a terminal statePolicy and value in sequence
BackpropagationUpdate values along the path to the rootNone, numeric update
ReflectionExplain why a failed trajectory went wrongActs as the self-critic
The six operations of a LATS iteration

Selection uses a variant of the UCT formula, which balances exploitation of high-value nodes against exploration of rarely visited ones. Reflections from failed rollouts are stored and added to the context of later expansions, which turns failure into in-context guidance without updating model weights.

Value estimation and self-reflection

The quality of LATS depends on how well it judges unfinished states. The original design computes a combined value score from two signals: a self-generated rating in which the model reasons about whether the current trajectory is on track, and a self-consistency score that rewards actions sampled repeatedly across independent generations.

External feedback strengthens these estimates whenever the environment offers it. In programming tasks, passing or failing unit tests gives a reliable signal; in web shopping, the final reward reflects how well the purchase matches the request. LATS is therefore strongest when the environment returns grounded observations rather than only text.

Reflection differs from evaluation. Evaluation assigns a number to a state, while reflection produces a short natural-language diagnosis of a completed failure, such as noting that a search query was too broad, which the agent reuses in subsequent iterations.

LATS compared with other agent reasoning methods

LATS is best understood as the most deliberate member of a family of prompting-based agent methods. Each method adds a capability to the one before it, and LATS combines all of them under a tree search.

MethodUses environment actionsExplores alternativesLearns from failures
Chain-of-thoughtNoNoNo
ReAct promptingYesNoNo
ReflexionYesSequential retries onlyYes, through reflections
Tree of thoughtsNo, reasoning onlyYes, breadth or depth searchNo
LATSYesYes, Monte Carlo tree searchYes, reflections and value backup
Comparison of agent reasoning approaches

In its original evaluation, LATS reported strong results on HumanEval, with a pass@1 rate above 90 percent using GPT-4, and clear gains over ReAct and Reflexion on HotpotQA and the WebShop benchmark. These figures reflect specific models and budgets, so they should not be read as general guarantees.

Cost, budget and practical configuration

The main practical constraint of LATS is compute and latency. Every expansion samples several actions, every new node requires one or more evaluation calls, and reflections add further calls, so a single task can consume dozens to hundreds of model invocations.

ParameterTypical settingEffect of increasing it
Children per expansion3 to 5 actionsWider search, more calls per step
Number of iterations10 to 50 rolloutsHigher success rate, longer runtime
Exploration weightAround 1.0 in UCTMore visits to uncertain branches
Maximum depthTask-dependent step limitLonger plans, larger trees
Main LATS parameters

Teams usually reserve LATS for high-value tasks where a wrong answer is expensive and a verifier exists, such as code generation with tests. For routine requests, a single ReAct loop with a retry policy is often the better cost-quality trade-off.

Limitations and common misconceptions

LATS assumes that the agent can return to an earlier state and try a different branch. This holds for question answering, code execution in a sandbox and simulated web stores, but it fails in environments with irreversible side effects, such as sending email or executing payments.

  • It is not model training: LATS changes behavior through search and context, not through weight updates.
  • Self-evaluation can be overconfident, so a value function without external feedback may favor fluent but wrong branches.
  • Search does not fix a weak policy: if the model never proposes the correct action, more iterations will not find it.
  • Context growth from stored reflections can exceed the context window on long tasks without compaction.

For these reasons, production systems often combine LATS-style search with sandboxed execution, explicit verifiers and checkpointing of agent state, so that branches can be reset safely.

In simple terms

Most AI agents try one plan and hope it works. LATS lets the agent try several paths. It is like a chess player who imagines a few possible moves before choosing one.

The agent scores each path. It writes a short note when a path fails. It then uses that note on the next try. The result is more careful decisions, but it takes more time and more computing power.

A practical example

A development team uses a coding agent with LATS to fix failing functions in a large Python library. Each task includes a function signature, a description and a set of unit tests that run in an isolated sandbox, so any branch can be reset without harm.

For each bug, the agent expands four candidate patches, scores them with test results and a self-rating, and runs up to 20 iterations. When a patch fails, the agent records a reflection such as the observation that it ignored empty input lists, and later candidates handle that case. Compared with a single ReAct attempt, the team sees a clearly higher share of fixes that pass all tests, at roughly ten times the model cost per task, which it accepts only for bugs that block a release.