diff --git a/src/claude_agent_sdk/_internal/transport/subprocess_cli.py b/src/claude_agent_sdk/_internal/transport/subprocess_cli.py index 7c142f69..95611fc2 100644 --- a/src/claude_agent_sdk/_internal/transport/subprocess_cli.py +++ b/src/claude_agent_sdk/_internal/transport/subprocess_cli.py @@ -308,7 +308,7 @@ def _build_command(self) -> list[str]: elif t["type"] == "enabled": resolved_max_thinking_tokens = t["budget_tokens"] elif t["type"] == "disabled": - resolved_max_thinking_tokens = 0 + cmd.append("--thinking-disabled") if resolved_max_thinking_tokens is not None: cmd.extend(["--max-thinking-tokens", str(resolved_max_thinking_tokens)]) diff --git a/tests/test_transport.py b/tests/test_transport.py index 7d09ecee..84ea4c36 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -160,6 +160,17 @@ def test_build_command_with_max_thinking_tokens(self): assert "--max-thinking-tokens" in cmd assert "5000" in cmd + def test_build_command_with_thinking_disabled(self): + """Test that thinking=disabled sends --thinking-disabled flag, not --max-thinking-tokens 0.""" + transport = SubprocessCLITransport( + prompt="test", + options=make_options(thinking={"type": "disabled"}), + ) + + cmd = transport._build_command() + assert "--thinking-disabled" in cmd + assert "--max-thinking-tokens" not in cmd + def test_build_command_with_add_dirs(self): """Test building CLI command with add_dirs option.""" from pathlib import Path