haive.agents.reasoning_and_critique.lats.agent ============================================== .. py:module:: haive.agents.reasoning_and_critique.lats.agent .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: haive.agents.reasoning_and_critique.lats.agent.LATSAgent Functions --------- .. autoapisummary:: haive.agents.reasoning_and_critique.lats.agent.create_lats_agent Module Contents --------------- .. py:class:: LATSAgent Bases: :py:obj:`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 .. py:method:: build_graph() Build LATS graph using haive.core BaseGraph. .. py:method:: compile(**kwargs) Compile: build agents lazily, use BaseGraph.to_langgraph(), no checkpointer. .. py:method:: get_best_answer(result) Extract best answer string from result. .. py:method:: run(input_data, **kwargs) Run LATS. Accepts string or dict with 'input' key. .. py:function:: create_lats_agent(tools=None, model='gpt-4o-mini', **kwargs) Factory for LATS agent.