Releases: anthropics/claude-agent-sdk-python
Releases · anthropics/claude-agent-sdk-python
v0.1.58
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.97
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.58/
pip install claude-agent-sdk==0.1.58v0.1.57
New Features
- Cross-user prompt caching: Added
exclude_dynamic_sectionsoption toSystemPromptPreset, enabling cross-user prompt cache hits by moving per-user dynamic sections (working directory, memory, git status) out of the system prompt (#797) - Auto permission mode: Added
"auto"to thePermissionModetype, bringing parity with the TypeScript SDK and CLI v2.1.90+ (#785)
Bug Fixes
- Thinking configuration: Fixed
thinking={"type": "adaptive"}incorrectly mapping to--max-thinking-tokens 32000instead of--thinking adaptive. Thedisabledtype similarly now uses--thinking disabledinstead of--max-thinking-tokens 0, matching the TypeScript SDK behavior (#796)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.96
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.57/
pip install claude-agent-sdk==0.1.57v0.1.56
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.92
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.56/
pip install claude-agent-sdk==0.1.56v0.1.55
Bug Fixes
- MCP large tool results: Forward
maxResultSizeCharsfromToolAnnotationsvia_metato bypass Zod annotation stripping in the CLI, fixing silent truncation of large MCP tool results (>50K chars) (#756)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.91
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.55/
pip install claude-agent-sdk==0.1.55v0.1.54
v0.1.53
Bug Fixes
- Setting sources flag: Fixed
--setting-sourcesbeing passed as an empty string when not provided, which caused the CLI to misparse subsequent flags (#778) - String prompt deadlock: Fixed deadlock when using
query()with a string prompt and hooks/MCP servers that trigger many tool calls, by spawningwait_for_result_and_end_input()as a background task (#780)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.88
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.53/
pip install claude-agent-sdk==0.1.53v0.1.52
New Features
- Context usage: Added
get_context_usage()method toClaudeSDKClientfor querying context window usage by category (#764) - Annotated parameter descriptions: The
@tooldecorator andcreate_sdk_mcp_servernow supporttyping.Annotatedfor per-parameter descriptions in JSON Schema (#762) - ToolPermissionContext fields: Exposed
tool_use_idandagent_idinToolPermissionContextfor distinguishing parallel permission requests (#754) - Session ID option: Added
session_idoption toClaudeAgentOptionsfor specifying custom session IDs (#750)
Bug Fixes
- String prompt in connect(): Fixed
connect(prompt="...")silently dropping the string prompt, causingreceive_messages()to hang indefinitely (#769) - Cancel request handling: Implemented
control_cancel_requesthandling so in-flight hook callbacks are properly cancelled when the CLI abandons them (#751)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.87
- Increased CI timeout for example tests and reduced sleep duration in error handling example (#760)
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.52/
pip install claude-agent-sdk==0.1.52v0.1.51
New Features
- Session management: Added
fork_session(),delete_session(), and offset-based pagination for session listing (#744) - Task budget: Added
task_budgetoption for token budget management (#747) - SystemPromptFile: Added support for
--system-prompt-fileCLI flag viaSystemPromptFile(#591) - AgentDefinition fields: Added
disallowedTools,maxTurns, andinitialPrompttoAgentDefinition(#759) - Preserved fields: Preserve dropped fields on
AssistantMessageandResultMessagefor forward compatibility (#718)
Bug Fixes
- Python 3.10 compatibility: Use
typing_extensions.TypedDicton Python 3.10 forNotRequiredsupport (#761) - ResultMessage errors field: Added missing
errorsfield toResultMessage(#749) - Async generator cleanup: Resolved cross-task cancel scope
RuntimeErroron async generator cleanup (#746) - MCP tool input_schema: Convert
TypedDictinput_schema to proper JSON Schema in SDK MCP tools (#736) - initialize_timeout: Pass
initialize_timeoutfrom env var inquery()(#743) - Async event loop blocking: Defer CLI discovery to
connect()to avoid blocking async event loops (#722) - Permission mode: Added missing
dontAskpermission mode to types (#719) - Environment filtering: Filter
CLAUDECODEenv var from subprocess environment (#732) - Process cleanup: Added
SIGKILLfallback whenSIGTERMhandler blocks inclose()(#729) - Duplicate warning: Removed duplicate version warning and included CLI path (#720)
- MCP resource types: Handle
resource_linkand embedded resource content types in SDK MCP tools (#725) - Stdin timeout: Removed stdin timeout for hooks and SDK MCP servers (#731)
- Stdout parsing: Skip non-JSON lines on CLI stdout to prevent buffer corruption (#723)
- MCP error propagation: Propagate
is_errorflag from SDK MCP tool results (#717) - Install script: Retry
install.shfetch on 429 with pipefail + jitter (#708)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.85
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.51/
pip install claude-agent-sdk==0.1.51v0.1.50
New Features
- Session info: Added
tagandcreated_atfields toSDKSessionInfoand newget_session_info()function for retrieving session metadata (#667)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.81
- Hardened PyPI publish workflow against partial-upload failures (#700)
- Added daily PyPI storage quota monitoring (#705)
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.50/
pip install claude-agent-sdk==0.1.50v0.1.49
New Features
- AgentDefinition: Added
skills,memory, andmcpServersfields (#684) - AssistantMessage usage: Preserve per-turn
usageonAssistantMessage(#685) - Session tagging: Added
tag_session()with Unicode sanitization (#670) - Session renaming: Added
rename_session()(#668) - RateLimitEvent: Added typed
RateLimitEventmessage (#648)
Bug Fixes
- CLAUDE_CODE_ENTRYPOINT: Use default-if-absent semantics to match TS SDK (#686)
- Fine-grained tool streaming: Reverted the env-var workaround from 0.1.48; partial-message delivery is now handled upstream (#671)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.77
- Added macOS x86_64 wheel to the published matrix (#661)
- Upload wheel-check artifacts in CI (#662)
- Docs: clarified
allowed_toolsas a permission allowlist (#649)
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.49/
pip install claude-agent-sdk==0.1.49