haive.agents.reasoning_and_critique.tot.agent ============================================= .. py:module:: haive.agents.reasoning_and_critique.tot.agent .. autoapi-nested-parse:: Tree of Thoughts (ToT) agent implementation. This module implements the Tree of Thoughts algorithm as a Haive agent. Classes ------- .. autoapisummary:: haive.agents.reasoning_and_critique.tot.agent.ToTAgent Functions --------- .. autoapisummary:: haive.agents.reasoning_and_critique.tot.agent.compose_evaluator_runnable haive.agents.reasoning_and_critique.tot.agent.compose_generator_runnable haive.agents.reasoning_and_critique.tot.agent.create_evaluator_engine haive.agents.reasoning_and_critique.tot.agent.create_generator_engine Module Contents --------------- .. py:class:: ToTAgent(config) Bases: :py:obj:`haive.core.engine.agent.agent.Agent`\ [\ :py:obj:`haive.agents.reasoning_and_critique.tot.config.TOTAgentConfig`\ ], :py:obj:`Generic`\ [\ :py:obj:`T`\ ] Tree of Thoughts agent implementation. This agent implements the Tree of Thoughts search algorithm, which: 1. Generates candidate solutions 2. Scores the candidates 3. Selects the best candidates for further exploration 4. Repeats until a satisfactory solution is found or max depth reached The implementation supports parallel processing of candidates through beam search. Initialize the ToT agent. :param config: Configuration for the ToT agent .. py:method:: setup_workflow() Set up the Tree of Thoughts workflow. Graph structure: - Sequential mode: START -> generate -> evaluate_all -> select -> (loop or END) - Parallel mode: START -> generate -> [evaluate_candidate * N] -> collect -> select -> (loop or END) .. py:function:: compose_evaluator_runnable(engine, use_structured_output=False) Create evaluator runnable. .. py:function:: compose_generator_runnable(engine, use_structured_output=False) Create generator runnable. .. py:function:: create_evaluator_engine(engine, use_structured_output=False, output_model=None) Create evaluator engine configuration. .. py:function:: create_generator_engine(engine, use_structured_output=False, output_model=None) Create generator engine configuration.