haive.agents.reasoning_and_critique.lats.agent¶

Language Agent Tree Search (LATS) agent.

Composes ReactAgent (candidate generation with tools) and SimpleAgent (reflection/scoring with structured output) in a Monte Carlo Tree Search loop.

Graph: START -> generate -> [expand <-> should_continue] -> finish -> END

The generator and reflector are real haive agents (ReactAgent, SimpleAgent) that use our tested infrastructure for LLM calls, tool use, and structured output.

Classes¶

LATSAgent

Look-Ahead Tree Search using ReactAgent + SimpleAgent composition.

Functions¶

create_lats_agent([tools, model])

Factory for LATS agent.

Module Contents¶

class haive.agents.reasoning_and_critique.lats.agent.LATSAgent¶

Bases: haive.agents.base.agent.Agent

Look-Ahead Tree Search using ReactAgent + SimpleAgent composition.

  • Generator: ReactAgent with tools for candidate creation

  • Reflector: SimpleAgent with structured output (Reflection model)

  • Tree logic: UCB1 selection, backpropagation, depth limiting

build_graph()¶

Build LATS graph using haive.core BaseGraph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

compile(**kwargs)¶

Compile: build agents lazily, use BaseGraph.to_langgraph(), no checkpointer.

Return type:

Any

get_best_answer(result)¶

Extract best answer string from result.

Parameters:

result (dict)

Return type:

str

run(input_data, **kwargs)¶

Run LATS. Accepts string or dict with ‘input’ key.

Parameters:

input_data (str | dict)

Return type:

Any

haive.agents.reasoning_and_critique.lats.agent.create_lats_agent(tools=None, model='gpt-4o-mini', **kwargs)¶

Factory for LATS agent.