Add thinking mode support for anthropic client #7002
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
⏺ Summary of Changes
Problem Solved
AutoGen’s Anthropic client did not support thinking mode—Claude’s ability to show its reasoning process before providing a final answer.
Without this, users could not access the internal thought process that makes Claude’s responses more accurate and transparent.
Changes Made
Core Implementation (
_anthropic_client.py)_get_thinking_config()method to handlethinkingparameter validation.thinkingparameter in API calls._last_used_toolsinitialization.Configuration Support (
config/init.py)ThinkingConfigTypedDictandThinkingConfigModelfor type safety.Test Coverage (
test_anthropic_model_client.py)Key Design Decisions
budget_tokens, model support, temperature requirements).temperature=1.0themselves — no automatic overrides.extra_create_argspattern.⏺ Usage Example
⏺ Result
AutoGen users can now access Claude’s reasoning process, leading to more transparent and explainable AI interactions, while maintaining clean, maintainable code that follows AutoGen’s architectural principles.
⏺ Related Issue
Closes #6095
⏺ Checks