diff --git a/src/claude_agent_sdk/__init__.py b/src/claude_agent_sdk/__init__.py index d66541f5..ad2ff81a 100644 --- a/src/claude_agent_sdk/__init__.py +++ b/src/claude_agent_sdk/__init__.py @@ -65,6 +65,7 @@ ContextUsageCategory, ContextUsageResponse, DeferredToolUse, + EffortLevel, HookCallback, HookContext, HookEventMessage, @@ -601,6 +602,7 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> Any: # Agent support "AgentDefinition", "SettingSource", + "EffortLevel", # Plugin support "SdkPluginConfig", # Session listing diff --git a/src/claude_agent_sdk/types.py b/src/claude_agent_sdk/types.py index 12cdc214..a6eb5c2f 100644 --- a/src/claude_agent_sdk/types.py +++ b/src/claude_agent_sdk/types.py @@ -4,7 +4,7 @@ from collections.abc import Awaitable, Callable from dataclasses import dataclass, field from pathlib import Path -from typing import TYPE_CHECKING, Any, Literal, Protocol +from typing import TYPE_CHECKING, Any, Literal, Protocol, TypeAlias if sys.version_info >= (3, 11): from typing import NotRequired, Required, TypedDict @@ -31,6 +31,9 @@ # Agent definitions SettingSource = Literal["user", "project", "local"] +# Thinking effort levels +EffortLevel: TypeAlias = Literal["low", "medium", "high", "xhigh", "max"] + class SystemPromptPreset(TypedDict): """System prompt preset configuration.""" @@ -96,7 +99,7 @@ class AgentDefinition: initialPrompt: str | None = None # noqa: N815 maxTurns: int | None = None # noqa: N815 background: bool | None = None - effort: Literal["low", "medium", "high", "xhigh", "max"] | int | None = None + effort: EffortLevel | int | None = None permissionMode: PermissionMode | None = None # noqa: N815 @@ -1864,7 +1867,7 @@ class ClaudeAgentOptions: See https://docs.anthropic.com/en/docs/build-with-claude/adaptive-thinking. """ - effort: Literal["low", "medium", "high", "xhigh", "max"] | None = None + effort: EffortLevel | None = None """Controls how much effort Claude puts into its response. Works with adaptive thinking to guide thinking depth.