haive.agents.reasoning_and_critique.tot.agent¶

Tree of Thoughts (ToT) agent implementation.

This module implements the Tree of Thoughts algorithm as a Haive agent.

Classes¶

ToTAgent

Tree of Thoughts agent implementation.

Functions¶

compose_evaluator_runnable(engine[, use_structured_output])

Create evaluator runnable.

compose_generator_runnable(engine[, use_structured_output])

Create generator runnable.

create_evaluator_engine(engine[, ...])

Create evaluator engine configuration.

create_generator_engine(engine[, ...])

Create generator engine configuration.

Module Contents¶

class haive.agents.reasoning_and_critique.tot.agent.ToTAgent(config)¶

Bases: haive.core.engine.agent.agent.Agent[haive.agents.reasoning_and_critique.tot.config.TOTAgentConfig], Generic[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.

Parameters:

config (haive.agents.reasoning_and_critique.tot.config.TOTAgentConfig) – Configuration for the ToT agent

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)

Return type:

None

haive.agents.reasoning_and_critique.tot.agent.compose_evaluator_runnable(engine, use_structured_output=False)¶

Create evaluator runnable.

haive.agents.reasoning_and_critique.tot.agent.compose_generator_runnable(engine, use_structured_output=False)¶

Create generator runnable.

haive.agents.reasoning_and_critique.tot.agent.create_evaluator_engine(engine, use_structured_output=False, output_model=None)¶

Create evaluator engine configuration.

haive.agents.reasoning_and_critique.tot.agent.create_generator_engine(engine, use_structured_output=False, output_model=None)¶

Create generator engine configuration.