Source: github.com/anthropics/claude-agent-sdk-python/releases/tag/v0.2.177
The new on_failure option controls what happens when a hook callback fails. Setting it to "block" stops the action when a callback raises an exception, returns None, or returns a value the CLI rejects. The default, "continue", treats a failure as making no decision.
The option requires a CLI version that supports it. Connecting to an older CLI with on_failure="block" raises CLIConnectionError. The release also updates the bundled Claude CLI to version 2.1.317.
On the testing side, end-to-end tests now accept either the Bash or PowerShell tool in shell-dependent cases. The release notes say this fixes intermittent failures on Windows.
Why it matters if you build agents
Hook callbacks that fail can now halt an agent's action instead of letting it proceed, which matters for guardrails and approval checks. Pin the CLI version alongside the SDK, since an older CLI will raise CLIConnectionError when on_failure is set to block.
Get stories like this every weekday
One short email with the day's agent tooling news.