Claude Agent SDK 0.3.332: Power-User Guide to Permission Modes, Hooks and Sandbox

Last updated: November 29, 2026

Claude Agent SDK for TypeScript 0.3.332, published November 24, 2026, adds a PreSkillShellCommand hook and makes setPermissionMode() return the mode actually in effect. Together with 0.3.325, which stopped auto-approving sandboxed Bash commands unless autoAllowBashIfSandboxed is true, it changes how hosts control what an agent may run.

Contents

What changed in 0.3.325 to 0.3.332

The Claude Agent SDK is Anthropic’s library for running Claude Code’s agent loop, built-in tools, permissions, sessions and hooks inside your own Python or TypeScript application. Each TypeScript release states the Claude Code version it matches; 0.3.332 matches Claude Code v2.1.332, which our Claude Code 2.1.332 guide covers. Eight releases shipped in under two weeks (GitHub releases):

Version Published (ET) Main change for hosts
0.3.325 November 13, 3:39 p.m. Sandboxed Bash needs autoAllowBashIfSandboxed: true to skip approval; archiveSession()
0.3.326 November 16, 5:11 p.m. mcpServersDelivery: ‘initialize’; sending mcpServers on the command line deprecated
0.3.327 November 17, 6:17 p.m. Breaking: hook options must be arrays; non-serializable options refused
0.3.328 November 18, 8:14 p.m. onFailure: “block” for mcp_tool hooks; inline agents win over same-named agents
0.3.329 November 19, 5:14 p.m. Warning when managed hooks fail to load; idle sessions release memory after 30 seconds
0.3.330 November 20, 5:32 p.m. Warning when a settings file fails validation; query() errors on unparseable settings JSON
0.3.331 November 23, 4:34 p.m. rewindFiles() refuses when managed file checkpointing is off
0.3.332 November 24, 8:31 p.m. PreSkillShellCommand hook; setPermissionMode() resolves with { mode }

setPermissionMode() now returns the mode

Permission modes control which tool calls run without asking. The documentation lists default, dontAsk, acceptEdits, bypassPermissions, plan and auto, and says setPermissionMode() changes the mode mid-session, only in streaming input mode (Permissions docs).

In 0.3.332, Query.setPermissionMode() resolves with { mode }, the mode now in effect, or undefined. Code that types the returned promise as Promise<void> no longer compiles (0.3.332 release notes). This matters because a request does not always produce the mode you asked for: the docs say a call to switch to auto fails while a model without auto mode is active, and that switching to bypassPermissions later requires allowDangerouslySkipPermissions from the start (Permissions docs). The TypeScript reference page still showed Promise<void> when we checked it on November 29.

PreSkillShellCommand and other hook changes

0.3.332 adds the PreSkillShellCommand hook event with its own input and output types (0.3.332 release notes). The release notes do not describe its behavior beyond the name and types, so check the type definitions in the package before relying on it. The same release adds tool_result_meta[].rewritten_by_plugin, set when a mod’s session.append hook changed a tool result, so a host can tell when a plugin altered what the model saw.

Other hook changes in this period (GitHub releases):

  • 0.3.327 (breaking): a hook event’s value and a matcher’s hooks must be arrays. A Set, generator, plain object, true or number is refused.
  • 0.3.328: mcp_tool hooks accept onFailure: "block", so a hook whose call fails blocks the action it guards. A shell command rewritten by a PermissionRequest hook now has its own permission check decide the sandbox.
  • 0.3.329: a system/informational warning tagged managed_hooks_not_loaded appears when hooks in managed settings fail to load.
  • 0.3.325: a warning tagged hook_no_verdict appears when a PreToolUse hook can’t run or answer, or times out, without refusing its tool call.

Sandboxed Bash is no longer auto-approved

Since 0.3.325, sandboxed Bash commands are no longer auto-approved unless autoAllowBashIfSandboxed: true is set in the sandbox option. The same release sends read-only git commands in a repository outside the working, additional or trusted directories through the permission flow instead of approving them (0.3.325 release notes). The TypeScript reference lists the option with a default of false, alongside enabled, failIfUnavailable (default true) and allowUnsandboxedCommands (TypeScript reference). If your agent ran unattended with the sandbox on, expect more canUseTool calls or denials after upgrading.

How to upgrade to 0.3.332

  1. Install the release: npm install @anthropic-ai/claude-agent-sdk@0.3.332 (yarn, pnpm and bun commands are in the release notes).
  2. Run your type checker. Replace any Promise<void> annotation on setPermissionMode(), and read the returned mode to confirm the switch.
  3. Convert hook options that are not arrays, such as a Set or a plain object, into arrays, as 0.3.327 requires.
  4. If you rely on the sandbox to run Bash without prompts, add autoAllowBashIfSandboxed: true; otherwise make sure canUseTool handles the extra requests.
  5. Move any createSdkMcpServer() servers from an agent’s mcpServers to top-level mcpServers, since 0.3.327 ignores them there with a warning.
  6. Watch system/informational messages for the new warnings, including settings_not_in_effect and managed_hooks_not_loaded.

Step 1 follows the 0.3.332 notes (release notes); steps 3 to 6 follow the 0.3.325 to 0.3.330 notes (GitHub releases).

How this compares with earlier versions and Claude Code

Behavior Before Now
setPermissionMode() result Promise<void> Resolves with { mode } or undefined (0.3.332)
Sandboxed Bash Auto-approved Needs autoAllowBashIfSandboxed: true (0.3.325)
Hook option shape Non-array values accepted Arrays required (0.3.327)
SDK MCP servers in an agent’s mcpServers Used Ignored with a warning (0.3.327)
mcpServers delivery Command line (argv) only ‘initialize’ option added; command line deprecated (0.3.326)

The Claude Code CLI is built for interactive terminal use, while the Agent SDK embeds the same loop in a process you operate (Agent SDK overview). For other ways to run Claude agents, see our self-hosted Claude Managed Agents guide and Claude Code Code Mode guide. For competing SDKs, compare the OpenAI Agents SDK 0.26 guide and the Cursor Agent SDK guide.

Limits and caveats

  • The release notes and documentation used here do not list a separate price for the SDK. The overview asks third-party developers to use API key authentication rather than claude.ai login, and use is governed by Anthropic’s Commercial Terms of Service (overview).
  • 0.3.327 reverted a 0.3.326 fix for lost SDK MCP tool results after a reconnect; 0.3.330 shipped a new fix.
  • setPermissionMode(), setModel() and similar setters work only in streaming input mode.
  • This guide covers the TypeScript package; the Python SDK has its own changelog.

Frequently asked questions

What is new in Claude Agent SDK 0.3.332?

Version 0.3.332, published November 24, 2026 (ET), adds the PreSkillShellCommand hook event, makes Query.setPermissionMode() resolve with the mode now in effect, adds tool_result_meta[].rewritten_by_plugin, fixes auto mode missing mid-turn user messages, and matches Claude Code v2.1.332.

Is setPermissionMode() a breaking change in 0.3.332?

For TypeScript type checking, yes. setPermissionMode() now resolves with { mode } or undefined, and the release notes say code that holds its promise as Promise<void> no longer compiles. Code that simply awaits the call keeps working.

Are sandboxed Bash commands still auto-approved?

Not by default. Since 0.3.325, sandboxed Bash commands go through the normal permission flow unless you set autoAllowBashIfSandboxed: true in the sandbox option. The TypeScript reference lists the default as false.

How do I install Claude Agent SDK 0.3.332?

Run npm install @anthropic-ai/claude-agent-sdk@0.3.332. The release notes also give yarn add, pnpm add and bun add commands for the same package and version.

Which permission modes does the Agent SDK support?

The permissions documentation lists six modes: default, dontAsk, acceptEdits, bypassPermissions, plan and auto. You can set one with permissionMode when starting a query or change it during a streaming session with setPermissionMode().

Sources

Featured image: Claude logo by Anthropic, public domain, via Wikimedia Commons. FreeAnswers is not affiliated with Anthropic.

Related answers

Leave a Comment