AI Agent News/stories/claude-agent-sdk-for-python-v0-2-166-adds-typed-hooks-and-init-data.md

Frameworks

Claude Agent SDK for Python v0.2.166 adds typed hooks and init data

Anthropic has released version 0.2.166 of the Claude Agent SDK for Python, adding typed hook outputs and a fully typed init message payload. The release also corrects the type of SandboxSettings.ignoreViolations and updates the bundled Claude CLI to 2.1.299.

Source: github.com/anthropics/claude-agent-sdk-python/releases/tag/v0.2.166

The release adds typed output classes and missing input fields for hooks, so hook implementations get precise type information instead of untyped dicts (#1331).

The init system message payload is now fully typed through SystemInitData, with nested types SystemInitMcpServer, SystemInitPlugin and SystemInitPluginError, plus FastModeState and FastModeDisabledReason literals. Developers can use cast(SystemInitData, msg.data) to access fields such as capabilities, model and mcp_servers (#1380 is listed separately below).

The SandboxSettings.ignoreViolations type changes from a TypedDict with file and network keys to dict[str, list[str]], matching the CLI's schema as a map from command-pattern substrings to violation-text substrings. The old type made file and network read as command patterns, and strict type checkers rejected the correct {"*": [...]} shape (#1380).

Why it matters if you build agents

Hook handlers can now be checked against concrete types, which cuts down on guesswork when reading hook data. Code that reads the init message can switch to the typed SystemInitData form instead of indexing raw dicts.

If your sandbox settings use ignoreViolations, the map shape is now the correct form, and the old file and network keys no longer match the type.

Get stories like this every weekday

One short email with the day's agent tooling news.

Subscribe