ThinkThread 🧵
Make your AI think before it speaks.
from thinkthread import reason
answer = reason("How can we solve climate change?")
# AI explores 20+ solutions, evaluates each one, and gives you the best path forward
Why ThinkThread?
Current LLMs give you their first thought. ThinkThread makes them actually think through multiple rounds of self-reflection and exploration:
# ❌ Regular LLM (single pass)
"To solve climate change, we need renewable energy."
# ✅ With ThinkThread (multi-round reasoning)
"I've explored 23 different approaches including renewable energy, nuclear power,
carbon capture, and policy changes. Based on feasibility and impact analysis,
here's a comprehensive strategy that could reduce emissions by 78% by 2040..."
The difference? ThinkThread forces AI to:
- Generate multiple competing solutions
- Evaluate trade-offs between them
- Challenge its own assumptions
- Synthesize the best insights
- Iterate until it finds the optimal answer
Installation
pip install thinkthread
Set your LLM API key:
export OPENAI_API_KEY='sk-...' # or ANTHROPIC_API_KEY
Quick Start
Python API
from thinkthread import reason, explore, solve, debate, refine
# One-liner reasoning
answer = reason("How do we make our app 10x faster?")
# Explore creative solutions
ideas = explore("New features for a todo app")
# Get actionable solutions
plan = solve("Reduce AWS costs by 50%")
# See multiple perspectives
analysis = debate("Should we use microservices?")
# Polish your content
better = refine("We need to fix the bug", "Make it professional")
Command Line
# General reasoning
thinkthread default "What are the pros and cons of remote work?"
# Explore ideas
thinkthread explore "10 ways to improve developer productivity"
# Solve problems
thinkthread solve "Our API response time is 2.3 seconds"
# Analyze decisions
thinkthread debate "Kubernetes vs Docker Swarm"
# Test mode (no API calls)
thinkthread default --test "How do we scale to 1M users?"
Key Features
- 🔄 Chain-of-Recursive-Thoughts: Iteratively refines answers through multiple rounds
- 🌳 Tree-of-Thoughts: Explores multiple reasoning paths in parallel
- 🧪 Test Mode: Develop without API calls using
test_mode=True - ⚡ Simple API: Just 5 functions that do everything
- 🛠️ Production Ready: Used in production by multiple companies
- 📦 Zero Config: Works out of the box with just an API key
Real Examples
🔧 Problem Solving
problem = "Our deployment takes 45 minutes"
solution = solve(problem)
# Output: Comprehensive plan with:
# - Root cause analysis (Docker layers, test suite, artifacts)
# - 5 solutions ranked by impact
# - Step-by-step implementation
# - Expected deployment time: 8 minutes
💡 Creative Exploration
ideas = explore("SaaS product ideas for developers")
# Output: Tree of 15+ ideas like:
# - AI code review tool ($50K MRR potential)
# - Smart debugging assistant (integrates with IDEs)
# - Automated documentation generator
# Each with market analysis and MVP requirements
🤔 Decision Analysis
decision = debate("Should we rewrite in Rust?")
# Output: Balanced analysis:
# - Performance gains: 3.2x faster, 70% less memory
# - Migration cost: 6 dev-months, $180K
# - Risk assessment: High initial, low long-term
# - Recommendation: Yes, if you have 6+ month runway
Documentation
📚 Simple API
For most users, our simple API is all you need. See examples above.
🛠️ Advanced SDK Usage
For advanced users who need fine-grained control:
- SDK Guide - Comprehensive guide to using the ThinkThread SDK
- API Reference - Detailed documentation of all parameters and methods
- Examples - Practical examples and production patterns
Quick SDK example:
from thinkthread import ThinkThreadSession
from thinkthread.llm import OpenAIClient
client = OpenAIClient(api_key="...", model_name="gpt-4-turbo")
session = ThinkThreadSession(
llm_client=client,
alternatives=5, # Generate 5 alternatives
rounds=3, # Refine for 3 rounds
)
answer = session.run("Complex question requiring deep thought")
The Power Behind the Simplicity
While the API is simple, ThinkThread employs sophisticated reasoning algorithms that transform how AI thinks:
🔄 Chain-of-Recursive-Thoughts (CoRT)
Unlike single-pass LLMs, ThinkThread makes AI reconsider and refine:
Question → Initial Answer → Generate 3-5 Alternatives → Evaluate All → Select Best → Repeat
Each round, the AI:
- Challenges its assumptions - "What if I'm wrong about X?"
- Explores contradictions - "The opposite view might be..."
- Synthesizes insights - "Combining approaches A and C..."
- Self-critiques - "My weakness here is..."
Result: 30-70% better answers than single-pass responses.
🌳 Tree-of-Thoughts (ToT)
For complex problems, ThinkThread explores solution spaces like a chess grandmaster:
Problem
/ | \
Approach A B C
/ \ | / \
A1 A2 B1 C1 C2
| | |
Best Prune Expand
The AI maintains multiple reasoning paths, expanding promising ones and pruning dead ends. This enables breakthrough insights impossible with linear thinking.
📊 Real Performance Gains
In production use across companies:
- Customer Support: 47% fewer escalations
- Content Creation: 2.3x higher engagement
- Code Generation: 65% fewer bugs
- Strategic Planning: 89% executive approval rate
🧠 Why It Works
ThinkThread is based on cognitive science research showing that human experts:
- Generate multiple hypotheses before deciding
- Actively seek disconfirming evidence
- Combine different mental models
- Refine through iteration
We've encoded these patterns into AI reasoning.
When to Use Each Function
| Function | Best For | Example |
|---|---|---|
reason() |
General questions | "Explain quantum computing" |
explore() |
Creative tasks | "Marketing campaign ideas" |
solve() |
Specific problems | "Fix memory leak in prod" |
debate() |
Decisions | "PostgreSQL vs MongoDB?" |
refine() |
Improvement | "Make this email better" |
Contributing
We welcome contributions! Please see our Contributing Guide for details.
License
MIT - Use it freely in your projects.
Ready to make your AI think? Install with pip install thinkthread and start building smarter applications today.
Metadata
Release files for thinkthread 0.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| thinkthread-0.8.1.tar.gz | 35.7 kB | Without provenance | Details for thinkthread-0.8.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| thinkthread-0.8.1-py3-none-any.whl | Python 3 | none | any | Details for thinkthread-0.8.1-py3-none-any.whl |
Total release size: 80.6 kB
Release files / thinkthread-0.8.1.tar.gz
| Download URL | thinkthread-0.8.1.tar.gz |
|---|---|
| Size | 35.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc0a98758b3fceb7264f5b33577f0752a07d24be5149d53fe812b9cd899c88c3
|
|
BLAKE2b-256 checksum How to use checksums |
9c23eacc032b137bae4ed96f30e94f552de85e35ed9a40657d9d26a77327befc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.7 Darwin/24.5.0
|
Release files / thinkthread-0.8.1-py3-none-any.whl
| Download URL | thinkthread-0.8.1-py3-none-any.whl |
|---|---|
| Size | 45.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
398e23e474c8f30190dbd31885bc0ff5e299a4921cbe6140b0bd1fe5c9344c5c
|
|
BLAKE2b-256 checksum How to use checksums |
bd9d4b2d03a764d4debe354853e3d8497c515290b16ba0038590a9e49ffbf568
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.2 CPython/3.12.7 Darwin/24.5.0
|
Security for thinkthread 0.8.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.