New Features
terminal_reasonon ResultMessage:ResultMessage.terminal_reasonnow surfaces why the query loop ended ("completed","max_turns","aborted_streaming","aborted_tools", etc.). A value of"aborted_streaming"or"aborted_tools"means the turn was cancelled viaClaudeSDKClient.interrupt(). Mirrors the TypeScript SDK'sSDKResultMessage.terminal_reason(#1142)- Typed
model_usageon ResultMessage:ResultMessage.model_usageis now typed asdict[str, ModelUsage]instead ofdict[str, Any], with a newModelUsageTypedDict that mirrors the TypeScript SDK's shape. Includes optionalcanonicalModelandproviderfields for stable model identification across provider-specific aliases (#1143)
Internal/Other Changes
- Updated bundled Claude CLI to version 2.1.218
PyPI: https://pypi.org/project/claude-agent-sdk/0.2.126/
pip install claude-agent-sdk==0.2.126