Support turning on thinking
is there any way of turning on "thinking" mode as Claude Code does?
Use this argument in ClaudeAgentOptions to turn on thinking env={"MAX_THINKING_TOKENS" : "1024"}
Use this argument in ClaudeAgentOptions to turn on thinking env={"MAX_THINKING_TOKENS" : "1024"}
Great, that's helpful
Thanks for the tip. This seems have solved it. Would be great if Antrhopic spend some time to update their official documentation site for agent sdk to include this too.
Use this argument in ClaudeAgentOptions to turn on thinking env={"MAX_THINKING_TOKENS" : "1024"}
Thanks a lot. That was really helpful. I have been racking my brains in order to view the thinking block in agent sdk
+1 on this feature request.
We're using the Python Agent SDK in a production web application (FastAPI backend) and need both:
- Extended thinking for complex reasoning tasks
- MCP servers for tool integrations (internal orchestration platform)
Currently these are mutually exclusive - we have to use the basic AsyncAnthropic SDK with MAX_THINKING_TOKENS for thinking support, but this bypasses the Agent SDK entirely and loses MCP server support.
Our workaround: Users choose between extended thinking OR MCP tools, can't have both.
Would love to see proper thinking support in the Agent SDK so we can use both features together.
This is now resolved. As of SDK v0.1.46+, thinking is supported as a first-class parameter on ClaudeAgentOptions:
from claude_agent_sdk.types import ThinkingConfigEnabled, ThinkingConfigAdaptive
# Adaptive thinking (recommended)
options = ClaudeAgentOptions(
thinking=ThinkingConfigAdaptive(type="adaptive"),
# ...
)
# Or with explicit budget
options = ClaudeAgentOptions(
thinking=ThinkingConfigEnabled(type="enabled", budget_tokens=8192),
# ...
)
# Or use the effort parameter for simpler control
options = ClaudeAgentOptions(
effort="high", # "low", "medium", "high", "max"
# ...
)
The earlier env={"MAX_THINKING_TOKENS": "1024"} workaround still works but is deprecated in favor of the thinking parameter.
Regarding the thinking + MCP compatibility concern raised in a comment — thinking and MCP tools work together in current SDK versions. The underlying API supports both simultaneously.
Closing as resolved. If there are remaining issues with thinking + MCP interaction, please open a new focused issue with reproduction steps.