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