Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/claude_agent_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
ContextUsageCategory,
ContextUsageResponse,
DeferredToolUse,
EffortLevel,
HookCallback,
HookContext,
HookEventMessage,
Expand Down Expand Up @@ -528,6 +529,7 @@ async def call_tool(name: str, arguments: dict[str, Any]) -> Any:
"ClaudeSDKClient",
# Types
"PermissionMode",
"EffortLevel",
"McpServerConfig",
"McpSdkServerConfig",
"McpServerStatus",
Expand Down
7 changes: 4 additions & 3 deletions src/claude_agent_sdk/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -30,6 +30,7 @@

# Agent definitions
SettingSource = Literal["user", "project", "local"]
EffortLevel: TypeAlias = Literal["low", "medium", "high", "xhigh", "max"]


class SystemPromptPreset(TypedDict):
Expand Down Expand Up @@ -96,7 +97,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


Expand Down Expand Up @@ -1864,7 +1865,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.
Expand Down
8 changes: 8 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
"""Tests for Claude SDK type definitions."""

from typing import get_args

from claude_agent_sdk import (
AssistantMessage,
ClaudeAgentOptions,
EffortLevel,
NotificationHookInput,
NotificationHookSpecificOutput,
PermissionRequestHookInput,
Expand All @@ -24,6 +27,11 @@
)


def test_effort_level_is_exported():
"""EffortLevel is part of the public package API for downstream wrappers."""
assert set(get_args(EffortLevel)) == {"low", "medium", "high", "xhigh", "max"}


class TestPermissionUpdate:
"""Test PermissionUpdate wire-format conversion."""

Expand Down
Loading