Follow Discord
Sweep 03 Dec 2026 · 19:13Z Build v2.1.336 553 read Stable v2.1.332 Latest v2.1.336 Next v2.1.336 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Agent SDK reference - Python changedagent-sdk/python

Nearest release: v2.1.335, published an hour after upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 2 Dec 2026 20:52 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 2 Dec 2026 21:07 UTC.

Upstream edited
Recorded here
Lines+6added
Lines−4removed
From line 1,554 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits93to this page, all time

The whole hunk

from line 1554, old and new numbered
/
lines
from line 1554
15541554 apiUsage: NotRequired[dict[str, Any] | None]
15551555```
15561556 
1557Each `ContextUsageCategory` entry carries `name`, `tokens`, `color`, and an optional `isDeferred` flag. `totalTokens` is the session's current context usage, and `maxTokens` is the window that usage is measured against. That window is the model's context window, or the lower auto-compaction window when one applies, and `rawMaxTokens` carries the same value as `maxTokens`. `apiUsage` holds the usage from the latest API response, not a running total for the session. Claude Code leaves the optional `deferredBuiltinTools`, `systemTools`, and `systemPromptSections` keys unset, so expect them to be absent even though the type declares them.
1557Each `ContextUsageCategory` entry carries `name`, `tokens`, `color`, and an optional `isDeferred` flag. `totalTokens` is the session's current context usage, and `maxTokens` is the window that usage is measured against. That window is the model's context window, or the lower auto-compaction window when one applies, and `rawMaxTokens` carries the same value as `maxTokens`.
15581558 
1559`apiUsage` holds the usage from the latest API response, not a running total for the session. The optional `deferredBuiltinTools`, `systemTools`, and `systemPromptSections` keys are absent from the response.
1560 
15591561### `SdkPluginConfig`
15601562 
15611563Configuration for loading plugins in the SDK.
from line 3654
36523654 
36533655| Property | Type | Default | Description |
36543656| :- | :- | :- | :- |
3655| `allowedDomains` | `list[str]` | `[]` | Domain names that sandboxed processes can access |
3657| `allowedDomains` | `list[str]` | `[]` | Domain names that sandboxed processes can access [without approval](https://code.claude.com/docs/en/sandboxing.md#hosts-outside-your-allowed-domains) |
36563658| `deniedDomains` | `list[str]` | `[]` | Domain names that sandboxed processes cannot access. Takes precedence over `allowedDomains` |
36573659| `allowManagedDomainsOnly` | `bool` | `False` | Managed-settings only: when set in managed settings, ignore `allowedDomains` and `WebFetch(domain:...)` allow rules from non-managed settings sources. Has no effect when set via SDK options |
36583660| `allowUnixSockets` | `list[str]` | `[]` | macOS only: Unix socket paths that processes can access, such as the Docker socket. Ignored on Linux |
from line 3678
36763678 
36773679### Permissions Fallback for Unsandboxed Commands
36783680 
3679When `allowUnsandboxedCommands` is enabled, the model can request to run commands outside the sandbox by setting `dangerouslyDisableSandbox: True` in the tool input. These requests fall back to the existing permissions system, meaning your `can_use_tool` handler is invoked, allowing you to implement custom authorization logic.
3681When the `allowUnsandboxedCommands` option is enabled, the model can request to run commands outside the sandbox by setting `dangerouslyDisableSandbox: True` in the tool input. Claude Code [evaluates permissions](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) for these requests, and some skip your `can_use_tool` handler. For example, Claude Code skips the handler when an [allow rule like `Bash(curl *)`](https://code.claude.com/docs/en/sandboxing#the-unsandboxed-retry-escape-hatch) approves the command.
36803682 
36813683Your `excludedCommands` entries instead take a call out of the sandbox with no model involvement; [`sandbox.excludedCommands`](https://code.claude.com/docs/en/settings-reference#sandbox-excludedcommands) covers when an entry applies.
36823684 
3683The following example logs each unsandboxed request and denies it unless your own authorization logic allows it:
3685This example's handler denies the unsandboxed Bash requests it receives unless your `is_command_authorized` function approves them:
36843686 
36853687```python theme={null}
36863688import asyncio
Feedback