Overview
Chain-of-Thought (CoT) reasoning forces the model to explicitly articulate its thinking process before generating a final answer. This leads to more accurate and well-reasoned responses, especially for complex problems. This approach is particularly effective for:- Mathematical reasoning and calculations
- Logical deduction and problem-solving
- Multi-step analysis tasks
- Scenarios requiring explicit reasoning traces
How It Works
- Thinking Phase: Agent generates explicit reasoning steps using thinking tags
- Answer Phase: Agent produces the final answer based on its reasoning
- Optional Tool Use: Can make tool calls during reasoning if configured
Complete Example
This example shows a Chain-of-Thought agent solving a multi-part math problem:Configuration Options
useThinkingTags: Enable explicit thinking tags in the model output (default: false)maxToolSteps: Maximum number of tool calls allowed during reasoning (default: 0)
Monitoring Reasoning
Observe the agentβs thinking process:Example Output
For the train speed question, you might see:When to Use Chain-of-Thought
Use Chain-of-Thought when:- You need explicit reasoning for transparency or debugging
- The task involves complex logical steps
- Accuracy is more important than speed
- You want to understand how the agent reached its conclusion
- The problem requires breaking down into smaller sub-problems