agents.reasoning_and_critique.tot.tree_of_thoughts_agent¶
Tree of Thoughts Multi-Agent Implementation.
This implements the complete Tree of Thoughts algorithm using MultiAgent with proper LangGraph routing, conditional edges, and send-based branching.
Classes¶
Commands for Tree of Thoughts routing. |
|
State for a single TOT iteration. |
|
Tree of Thoughts agent using multi-agent coordination with conditional routing. |
Functions¶
|
Create a Tree of Thoughts agent with default settings. |
Module Contents¶
- class agents.reasoning_and_critique.tot.tree_of_thoughts_agent.TOTCommand(/, **data)¶
Bases:
pydantic.BaseModel
Commands for Tree of Thoughts routing.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.reasoning_and_critique.tot.tree_of_thoughts_agent.TOTIteration(/, **data)¶
Bases:
pydantic.BaseModel
State for a single TOT iteration.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.reasoning_and_critique.tot.tree_of_thoughts_agent.TreeOfThoughtsAgent(name='tree_of_thoughts', beam_size=3, max_iterations=3, generation_temperature=0.7, scoring_temperature=0.3, engine=None)¶
Tree of Thoughts agent using multi-agent coordination with conditional routing.
Initialize Tree of Thoughts agent.
- Parameters:
name (str) – Agent name
beam_size (int) – Number of top solutions to keep in beam search
max_iterations (int) – Maximum TOT iterations
generation_temperature (float) – Temperature for candidate generation
scoring_temperature (float) – Temperature for solution scoring
engine (haive.core.engine.aug_llm.AugLLMConfig | None) – Optional engine configuration
- build_graph_config()¶
Build the graph configuration with conditional edges and routing.
- async expand_candidates_node(state)¶
Expand candidates from a seed solution.
- async finalize_result_node(state)¶
Finalize the TOT result with the best solution.
- async generate_candidates_node(state)¶
Generate initial candidate solutions.
- route_tot_action(state)¶
Route TOT actions using Send for parallel processing.
- Parameters:
state (haive.core.schema.prebuilt.multi_agent_state.MultiAgentState)
- Return type:
list[langgraph.constants.Send]
- async score_solutions_node(state)¶
Score all candidate solutions.
- should_continue(state)¶
Determine if TOT should continue or finish.
- Returns:
“continue” to keep iterating, “finish” to end
- Parameters:
state (haive.core.schema.prebuilt.multi_agent_state.MultiAgentState)
- Return type:
- async solve_problem(problem)¶
Solve a problem using Tree of Thoughts algorithm.
- async start_node(state)¶
Initialize TOT state.
- agents.reasoning_and_critique.tot.tree_of_thoughts_agent.create_tree_of_thoughts_agent(beam_size=3, max_iterations=3, generation_temperature=0.7, scoring_temperature=0.3)¶
Create a Tree of Thoughts agent with default settings.
- Parameters:
- Returns:
Configured TreeOfThoughtsAgent
- Return type: