New Features
- Session history functions: Added
list_sessions()andget_session_messages()top-level functions for retrieving past session data (#622) - MCP control methods: Added
add_mcp_server(),remove_mcp_server(), and typedMcpServerStatusfor runtime MCP server management (#620) - Typed task messages: Added
TaskStarted,TaskProgress, andTaskNotificationmessage subclasses for better type safety when handling task-related events (#621) - ResultMessage stop_reason: Added
stop_reasonfield toResultMessagefor inspecting why a conversation turn ended (#619) - Hook input enhancements: Added
agent_idandagent_typefields to tool-lifecycle hook inputs (PreToolUseHookInput,PostToolUseHookInput,PostToolUseFailureHookInput) (#628)
Bug Fixes
- String prompt MCP initialization: Fixed an issue where passing a string prompt would close stdin before MCP server initialization completed, causing MCP servers to fail to register (#630)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.69
PyPI: https://pypi.org/project/claude-agent-sdk/0.1.46/
pip install claude-agent-sdk==0.1.46