- Anthropic Extended Thinking - Claude’s thinking blocks for complex reasoning
- OpenAI Reasoning via Responses API - GPT’s reasoning effort parameter
Anthropic Extended Thinking
This example is available on GitHub: examples/01_standalone_sdk/22_anthropic_thinking.py
examples/01_standalone_sdk/22_anthropic_thinking.py
Running the Example
How It Works
The key to accessing thinking blocks is to register a callback that checks forthinking_blocks in LLM messages:
Understanding Thinking Blocks
Claude uses thinking blocks to reason through complex problems step-by-step. There are two types:ThinkingBlock(related anthropic docs): Contains the full reasoning text from Claude’s internal thought processRedactedThinkingBlock((related anthropic docs)): Contains redacted or summarized thinking data
OpenAI Reasoning via Responses API
This example is available on GitHub: examples/01_standalone_sdk/23_responses_reasoning.py
reasoning_effort parameter, you can control how much reasoning the model performs and access those reasoning traces.
examples/01_standalone_sdk/23_responses_reasoning.py
Running the Example
How It Works
Configure the LLM with thereasoning_effort parameter to enable reasoning:
reasoning_effort parameter can be set to "none", "low", "medium", or "high" to control the amount of reasoning performed by the model.
Then capture reasoning traces in your callback:
Understanding Reasoning Traces
The OpenAI Responses API provides reasoning traces that show how the model approached the problem. These traces are available in the LLM messages and can be inspected to understand the model’s decision-making process. Unlike Anthropic’s thinking blocks, OpenAI’s reasoning is more tightly integrated with the response generation process.Use Cases
Debugging: Understand why the agent made specific decisions or took certain actions. Transparency: Show users how the AI arrived at its conclusions. Quality Assurance: Identify flawed reasoning patterns or logic errors. Learning: Study how models approach complex problems.Next Steps
- Interactive Terminal - Display reasoning in real-time
- LLM Metrics - Track token usage and performance
- Custom Tools - Add specialized capabilities

