Releases: anthropics/claude-agent-sdk-python
Releases · anthropics/claude-agent-sdk-python
Release list
v0.2.128
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.220
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.128/
pip install claude-agent-sdk==0.2.128v0.2.127
Bug Fixes
- Fixed premature stdin closure when background tasks are in flight:
query()no longer closes stdin on the firstresultframe when background tasks (e.g.run_in_background: truesubagents) are still running. Previously, closing stdin too early caused SDK-MCP tool calls from background tasks to fail with"Stream closed"and silently bypassed PreToolUse hooks. Stdin now stays open until all in-flight tasks complete and the final result frame arrives (#1103)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.219
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.127/
pip install claude-agent-sdk==0.2.127v0.2.126
New Features
terminal_reasonon ResultMessage:ResultMessage.terminal_reasonnow surfaces why the query loop ended ("completed","max_turns","aborted_streaming","aborted_tools", etc.). A value of"aborted_streaming"or"aborted_tools"means the turn was cancelled viaClaudeSDKClient.interrupt(). Mirrors the TypeScript SDK'sSDKResultMessage.terminal_reason(#1142)- Typed
model_usageon ResultMessage:ResultMessage.model_usageis now typed asdict[str, ModelUsage]instead ofdict[str, Any], with a newModelUsageTypedDict that mirrors the TypeScript SDK's shape. Includes optionalcanonicalModelandproviderfields for stable model identification across provider-specific aliases (#1143)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.218
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.126/
pip install claude-agent-sdk==0.2.126v0.2.125
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.217
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.125/
pip install claude-agent-sdk==0.2.125v0.2.124
Bug Fixes
- Refused batch script CLI spawning on Windows: Blocked spawning
.bat/.cmdCLI scripts (including npm'sclaude.cmdshim) on Windows to prevent command injection via cmd.exe metacharacter re-parsing (BatBadBut / CVE-2024-27980 class). Windows users relying on the npm shim should switch to the native installer, an explicitclaude.exepath, or a platform wheel that bundles the CLI (#1127) - Windows cmd.exe metacharacter rejection:
resumeandsession_idvalues containing cmd.exe metacharacters (& | < > ^ % ! ") or newlines now raiseValueErroron Windows, preventing injection even if a cmd.exe hop is reintroduced. POSIX behavior is unchanged (#1127) - Dash-prefixed
extra_argsvalue binding:extra_argsnow uses--flag=valueform when the value starts with-, preventing a dash-leading value from being misinterpreted as a separate CLI flag (#1127)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.216
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.124/
pip install claude-agent-sdk==0.2.124v0.2.123
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.215
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.123/
pip install claude-agent-sdk==0.2.123v0.2.122
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.214
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.122/
pip install claude-agent-sdk==0.2.122v0.2.121
Bug Fixes
- Fixed argv flag injection via
resumeandsession_idoptions:--resumeand--session-idare now passed as single=-joined argv tokens (e.g.--resume=<value>) so that a dash-prefixed value is never misinterpreted as an independent CLI flag (#1123)
Internal/Other Changes
- Hardened build scripts against command injection via
CLAUDE_CLI_VERSION: Added version validation (_cli_version_validation.py) and eliminated shell interpolation indownload_cli.pyandupdate_cli_version.pyso that a malformed version string cannot inject shell or Python code during builds (#1117) - CI now lints and typechecks
scripts/alongsidesrc/andtests/ - CI CLI install steps now fail properly when
curlerrors (addedshell: bashforpipefail) - Updated bundled Claude CLI to version 2.1.212
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.121/
pip install claude-agent-sdk==0.2.121v0.2.120
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.211
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.120/
pip install claude-agent-sdk==0.2.120v0.2.119
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.210
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.119/
pip install claude-agent-sdk==0.2.119