sandbox settings are passed through without the failIfUnavailable default the TypeScript SDK applies
Summary
ClaudeAgentOptions.sandbox is merged into the --settings JSON exactly as given (_internal/transport/subprocess_cli.py:517-521). The TypeScript SDK's sandbox option documents a dependency check: when enabled: true is passed and failIfUnavailable is absent, it defaults to true, so a missing sandbox dependency (for example bubblewrap on Linux) produces an error result instead of commands running unsandboxed (sdk.d.ts:2099-2103; the setting itself at 8355-8358). The Python SDK applies no such default, so a Python host with sandbox={"enabled": True} on a machine without the dependency gets the CLI's own default for that setting.
Checked at v0.2.159 (bundled CLI 2.1.281); paths are under src/claude_agent_sdk/. TypeScript references are to @anthropic-ai/claude-agent-sdk 0.3.280, sdk.d.ts.
Repro
from claude_agent_sdk import ClaudeAgentOptions
from claude_agent_sdk._internal.transport.subprocess_cli import SubprocessCLITransport
t = SubprocessCLITransport(prompt="x", options=ClaudeAgentOptions(cli_path="/bin/sh", sandbox={"enabled": True}))
c = t._build_command(); print(c[c.index("--settings") + 1])Observed: {"sandbox": {"enabled": true}}, no failIfUnavailable.
What the CLI does when the sandbox is unavailable is its own behavior; this report is about the two SDKs sending different settings for the same option. The TypeScript contract describes the unsandboxed fallback as the thing the default exists to prevent.
Expected
The same default as the TypeScript SDK when enabled is set and failIfUnavailable is absent, or a documented note that Python hosts must set it themselves.
Source: anthropics/claude-agent-sdk-python