New Features
- Hook-specific output types: Added typed output classes and missing input fields for hooks, giving hook implementations precise type information instead of untyped dicts (#1331)
SystemInitDataTypedDict: The init system message payload is now fully typed viaSystemInitData, along with nested typesSystemInitMcpServer,SystemInitPlugin,SystemInitPluginError, andFastModeState/FastModeDisabledReasonliterals. Usecast(SystemInitData, msg.data)to access typed fields likecapabilities,model,mcp_servers, and more (#1332)
Bug Fixes
- Fixed
SandboxSettings.ignoreViolationstype: Changed from aTypedDictwithfile/networkkeys todict[str, list[str]]to match the CLI's actual schema — a map from command-pattern substring to violation-text substrings. The old type caused"file"and"network"to be interpreted as command patterns, and strict type checkers rejected the correct{"*": [...]}shape (#1380)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.299
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.166/
pip install claude-agent-sdk==0.2.166