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.51