agents.reasoning_and_critique.tot.tot_multi_agent

Tree of Thoughts Multi-Agent Implementation.

This module implements Tree of Thoughts as a multi-agent system using MultiAgent. Each stage of the TOT algorithm is handled by a specialized agent.

Classes

BeamSelection

Selection of best candidates for next iteration.

CandidateEvaluation

Evaluation of a single candidate.

CandidateGeneration

Multiple candidate solutions.

FinalSolution

Final synthesized solution.

ProblemAnalysis

Analysis of the problem to solve.

TreeOfThoughtsMultiAgent

Tree of Thoughts implemented as a multi-agent system.

Functions

main()

Main.

solve_with_tot_multi_agent(problem[, max_depth, ...])

Convenience function to solve a problem with TOT multi-agent.

Module Contents

class agents.reasoning_and_critique.tot.tot_multi_agent.BeamSelection(/, **data)

Bases: pydantic.BaseModel

Selection of best candidates for next 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.tot_multi_agent.CandidateEvaluation(/, **data)

Bases: pydantic.BaseModel

Evaluation of a single candidate.

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.tot_multi_agent.CandidateGeneration(/, **data)

Bases: pydantic.BaseModel

Multiple candidate solutions.

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.tot_multi_agent.FinalSolution(/, **data)

Bases: pydantic.BaseModel

Final synthesized solution.

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.tot_multi_agent.ProblemAnalysis(/, **data)

Bases: pydantic.BaseModel

Analysis of the problem to solve.

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.tot_multi_agent.TreeOfThoughtsMultiAgent(max_depth=3, beam_width=3, threshold=0.8, expansion_count=5, temperature_config=None)

Tree of Thoughts implemented as a multi-agent system.

Initialize the TOT multi-agent system.

Parameters:
  • max_depth (int) – Maximum search depth

  • beam_width (int) – Number of candidates to keep at each level

  • threshold (float) – Score threshold for accepting a solution

  • expansion_count (int) – Number of new candidates to generate

  • temperature_config (dict[str, float] | None) – Temperature settings for each agent

async solve(problem)

Solve a problem using Tree of Thoughts multi-agent approach.

Parameters:

problem (str) – The problem to solve

Returns:

Dictionary containing solution and search metadata

Return type:

dict[str, Any]

visualize_search_tree()

Create a simple text visualization of the search tree.

Return type:

str

async agents.reasoning_and_critique.tot.tot_multi_agent.main()

Main.

async agents.reasoning_and_critique.tot.tot_multi_agent.solve_with_tot_multi_agent(problem, max_depth=3, beam_width=3, threshold=0.8)

Convenience function to solve a problem with TOT multi-agent.

Parameters:
  • problem (str) – Problem to solve

  • max_depth (int) – Maximum search depth

  • beam_width (int) – Beam width for search

  • threshold (float) – Solution acceptance threshold

Returns:

Solution dictionary

Return type:

dict[str, Any]