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.
| Operation | What happens | Role of the language model |
|---|---|---|
| Selection | Descend the tree using an upper confidence bound | None, uses stored values |
| Expansion | Sample several candidate actions from the chosen node | Acts as the policy |
| Evaluation | Score each new child state | Acts as the value function |
| Simulation | Roll out a branch until a terminal state | Policy and value in sequence |
| Backpropagation | Update values along the path to the root | None, numeric update |
| Reflection | Explain why a failed trajectory went wrong | Acts as the self-critic |
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.
| Method | Uses environment actions | Explores alternatives | Learns from failures |
|---|---|---|---|
| Chain-of-thought | No | No | No |
| ReAct prompting | Yes | No | No |
| Reflexion | Yes | Sequential retries only | Yes, through reflections |
| Tree of thoughts | No, reasoning only | Yes, breadth or depth search | No |
| LATS | Yes | Yes, Monte Carlo tree search | Yes, reflections and value backup |
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.
| Parameter | Typical setting | Effect of increasing it |
|---|---|---|
| Children per expansion | 3 to 5 actions | Wider search, more calls per step |
| Number of iterations | 10 to 50 rollouts | Higher success rate, longer runtime |
| Exploration weight | Around 1.0 in UCT | More visits to uncertain branches |
| Maximum depth | Task-dependent step limit | Longer plans, larger trees |
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.