types: export EffortLevel as a named TypeAlias#940
Open
vibeyclaw wants to merge 1 commit intoanthropics:mainfrom
Open
types: export EffortLevel as a named TypeAlias#940vibeyclaw wants to merge 1 commit intoanthropics:mainfrom
vibeyclaw wants to merge 1 commit intoanthropics:mainfrom
Conversation
The effort field's Literal["low", "medium", "high", "xhigh", "max"] was inlined at two use sites (ClaudeAgentOptions and ThinkingConfig). This follows the same pattern already used by PermissionMode, SdkBeta, SettingSource, and other named type aliases in the same file. Benefits: - Single source of truth for downstream consumers who wrap the SDK - Exported from __init__.py so callers can write `from claude_agent_sdk import EffortLevel` - Any future expansion of the literal (like xhigh in anthropics#834) propagates automatically to all users Closes anthropics#938
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #938.
The
effortfield'sLiteral["low", "medium", "high", "xhigh", "max"]was inlined at two use sites intypes.py—ClaudeAgentOptions(line 99) andThinkingConfig(line 1867). This PR extracts it into a namedTypeAliascalledEffortLeveland exports it from__init__.py, following the existing pattern used byPermissionMode,SdkBeta,SettingSource, and other aliases in the same file.Changes
src/claude_agent_sdk/types.py: addEffortLevelTypeAlias near the other named literals at the top of the file; replace the two inlineLiteral[...]usages with it.src/claude_agent_sdk/__init__.py: import and exportEffortLevelalongsidePermissionMode.Why this matters
from claude_agent_sdk import EffortLevelinstead of copying the literal."xhigh"did between 0.1.71 and 0.1.77 per ClaudeAgentOptions.effort typings are outdated, and CLI validation failures are surfaced as opaque ProcessError #834), consumers who importEffortLevelpick up the change for free.effortwas the only one left inline.Testing
No behavior change — this is a pure typing refactor. Existing tests should pass unchanged.