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 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 using the DynamicGraph builder.

This creates a graph with nodes for: 1. Generating candidate solutions 2. Scoring candidates 3. Selecting the best candidates for beam search 4. Expanding new generations from those candidates

Return type:

None

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

Create evaluator runnable.

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

Create generator runnable.

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

Create evaluator engine configuration.

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

Create generator engine configuration.