diff --git a/src/claude_agent_sdk/types.py b/src/claude_agent_sdk/types.py index 9c09345f..06cbf2b8 100644 --- a/src/claude_agent_sdk/types.py +++ b/src/claude_agent_sdk/types.py @@ -18,7 +18,10 @@ PermissionMode = Literal["default", "acceptEdits", "plan", "bypassPermissions"] # SDK Beta features - see https://docs.anthropic.com/en/api/beta-headers -SdkBeta = Literal["context-1m-2025-08-07"] +SdkBeta = Literal[ + "context-1m-2025-08-07", # Extended 1M context window + "clear-thinking-20250115", # Clear thinking blocks from previous turns to reduce token usage +] # Agent definitions SettingSource = Literal["user", "project", "local"] diff --git a/tests/test_transport.py b/tests/test_transport.py index fe9b6b22..3102e452 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -158,6 +158,21 @@ def test_build_command_with_max_thinking_tokens(self): assert "--max-thinking-tokens" in cmd assert "5000" in cmd + def test_build_command_with_betas(self): + """Test building CLI command with betas option.""" + + transport = SubprocessCLITransport( + prompt="test", + options=make_options( + betas=["context-1m-2025-08-07", "clear-thinking-20250115"] + ), + ) + + cmd = transport._build_command() + assert "--betas" in cmd + betas_index = cmd.index("--betas") + assert cmd[betas_index + 1] == "context-1m-2025-08-07,clear-thinking-20250115" + def test_build_command_with_add_dirs(self): """Test building CLI command with add_dirs option.""" from pathlib import Path