Repository navigation
Tree of Thought
weego edited this page May 28, 2026
·
1 revision
Tree of Thought is an optional planning mode. It asks a reasoning model to analyze the task before the final model request and can narrow the active tool set.
Use Tree of Thought for:
- multi-step tasks
- tool selection among many tools
- planning before external actions
- tasks where an initial reasoning pass improves reliability
Avoid it for simple chat, low-latency calls, or tasks where cost must be minimized.
agent = LightAgent(
model="gpt-4.1",
api_key="your_api_key",
base_url="https://api.openai.com/v1",
tree_of_thought=True,
tot_model="gpt-4.1",
tot_api_key="your_api_key",
tot_base_url="https://api.openai.com/v1",
)If tot_model, tot_api_key, or tot_base_url are omitted, LightAgent can fall back to the main model configuration.
By default, filter_tools=True. The planning step can decide which tools should be active for the final run.
Disable filtering when you want all registered tools to remain available:
agent = LightAgent(
model="gpt-4.1",
api_key="your_api_key",
base_url="https://api.openai.com/v1",
tree_of_thought=True,
filter_tools=False,
)Use structured results and traces:
result = agent.run("Plan and execute this task.", result_format="object", trace=True)
print(result.content)
print(result.trace)If the planning step chooses the wrong tools, make tool descriptions narrower and more explicit.
LightAgent Wiki - see the repository, releases, and issues.
- Installation and Your First Agent
- Tools and Integrations
- Memory, Sessions, and RAG
- Workflows and Multiple Agents
- Agent Backends and Codex
- Durable Execution, Jobs, and Subagents
- Safety, Observability, and Evaluation
- Usage, Cost Estimates, and Budgets
- Deployment, Migration, and Verification
- 安装与第一个 Agent
- 工具和集成
- 记忆、会话与 RAG
- 工作流与多 Agent
- 执行后端与 Codex
- 持久执行、Jobs 与 Subagents
- 安全、观测与评测
- 用量统计、费用估算与预算
- 部署、升级与验收
- Quick Start
- Core Concepts
- API Reference
- Examples Cookbook
- Migration Guide
- Tools
- Tool Generator
- Memory
- MCP
- Skills
- LightFlow
- Tree of Thought
- Self-Learning
- Multi-Agent
- Tracing and Debugging
- Langfuse Observability
- Model Providers
- browser-use Integration
- Testing and CI
- Deployment Guide
- Architecture
- Security
- Known Limitations
- FAQ
- FAQ 中文
- Roadmap
- Release Process
- Contributing