Tree of Thoughts prompt
tree-of-thoughts
A Python implementation of Tree of Thoughts: the model reasons by searching a tree of thoughts. Part of Swarms, installed through pip
- 4,593 ★ on the repository
- Last commit
- Apache-2.0
Extended access
Why this level
- The method makes many model calls and spends the API key
- Requests go to the chosen model provider
Install
In your terminal, with SkillFoxx CLI
npx skillfoxx add prompts/tree-of-thoughtsDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- The method makes many model calls and spends the API key
- Requests go to the chosen model provider
This is third-party code. Review the repository files before installing.
What it does
The library implements the Tree of Thoughts method from the research paper (arXiv 2305.10601): instead of one chain of reasoning the model generates variants of thoughts, scores them and searches breadth-first or depth-first until it finds an answer. Per the README the implementation is now part of the Swarms framework as `TreeOfThoughts`, installed with `pip3 install -U swarms`, with the API key set in the `.env` file (`OPENAI_API_KEY`, `WORKSPACE_DIR`). Links to the original implementation by the paper's authors (princeton-nlp/tree-of-thought-llm) are in the README.
Who it is for. For developers and researchers who want to try tree-of-reasoning search on hard tasks with logic and planning.
Good fit when
- You need to test the Tree of Thoughts method on your task without your own implementation
- You need a code example of how to build a thought search on any model
- You need an entry point into the Swarms framework with a ready TreeOfThoughts class
Not a fit when
- You need the original implementation by the paper's authors: it is at Princeton (princeton-nlp/tree-of-thought-llm)
- You need a ready prompt without code: this is a library
Example request
Solve a schedule task of five meetings with the tree of thoughts method and show which variants were discardedLimitations
This is a wrapper of the method from the research paper and not the original implementation of its authors, which lives in the princeton-nlp/tree-of-thought-llm repository. Per the README, connect the method through Swarms for practice. The separate PyPI package `tree-of-thoughts` version 0.6.5 came out in October 2024 and lags behind the README. The library sends requests to the chosen model and spends your API key: the method makes many calls per task. The repository was last updated on 29.09.2026.
How to disable. Remove the library with pip uninstall swarms (or tree-of-thoughts if you installed the separate package) and revoke the API key you put in .env.
FAQ
What is Tree of Thoughts?
A method from a research paper: the model generates variants of thoughts, scores them and searches a tree until it finds an answer.
How do I install it?
The implementation is part of Swarms: pip3 install -U swarms, with the API key in the .env file.
Is this the original implementation?
No. The original by the paper's authors is at princeton-nlp/tree-of-thought-llm.
Is it expensive in model calls?
The method makes many calls per task, so it spends the key faster than an ordinary request.
Discussion
No questions or reviews yet.
Related
PromptsA parallel divergent ideation skill for agents: fans out under cognitive frames, prunes traps and deepens the best branches
A team of AI agents from one request: it plans the task, writes code in parallel branches, tests, reviews and opens a pull request
An MCP server that runs every reasoning step of your agent past six Agno specialists and merges their views into one answer
Feynman — a terminal AI agent for scientific research: literature reviews, source checks, paper critique and comparing a paper with its code
An inference-time reasoning control skill: deep analysis, long tasks, verification and recovery grounded in durable evidence
A Claude Code plugin that asks several AI models the same question and shows their answers side by side with a synthesis of agreement and divergence
README in short
The README describes an implementation of the Tree of Thoughts method, the project's move into the Swarms framework, installation through pip and links to the paper and the authors' original implementation. Apache-2.0 license.