Agent SDK reference - Python changedagent-sdk/python
Nearest release: v2.1.318, published 20 hours before 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 4 Nov 2026 18:12 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 4 Nov 2026 18:37 UTC.
Upstream edited
Recorded here
Lines+8added
Lines−3removed
From line
1,171
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits68to this page, all time
The whole hunk
from line 1171, old and new numbered
/
from line 1171
11711171PermissionMode = Literal[
11721172 "default", # Standard permission behavior
11731173 "acceptEdits", # Auto-accept file edits
1174 "plan", # Planning mode - explore without editing
1174 "plan", # Planning mode - Claude explores and plans
11751175 "dontAsk", # Deny anything not pre-approved instead of prompting
11761176 "bypassPermissions", # Bypass permission checks; explicit ask rules still prompt (use with caution)
11771177 "auto", # A model classifier reviews actions such as shell commands and network requests
from line 1210
12101210
12111211Returns a `PermissionResult` (either `PermissionResultAllow` or `PermissionResultDeny`).
12121212
1213The callback is the SDK replacement for the interactive permission prompt: it's invoked only when the [permission evaluation flow](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) resolves to a prompt. Tool calls already approved by an `allowed_tools` entry, a settings allow rule, or the permission mode, such as `acceptEdits` or `bypassPermissions`, never invoke it. To gate every tool call, use a [`PreToolUse` hook](https://code.claude.com/docs/en/agent-sdk/hooks) instead.
1213The callback replaces the interactive permission prompt. The SDK calls `can_use_tool` when the [permission evaluation flow](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) resolves to a prompt. Calls approved in either of these ways run without calling `can_use_tool`:
12141214
1215* A call that an `allowed_tools` entry or a settings allow rule approves
1216* A call the permission mode approves, such as a file edit in `acceptEdits` mode
1217
1218To check those calls, use a [`PreToolUse` hook](https://code.claude.com/docs/en/agent-sdk/hooks), which runs for them too.
1219
12151220An allow rule doesn't pre-approve the [actions no mode auto-approves](https://code.claude.com/docs/en/permission-modes.md#actions-no-mode-auto-approves); see [How permissions are evaluated](https://code.claude.com/docs/en/agent-sdk/permissions.md#how-permissions-are-evaluated) for which of them reach the callback and what happens in `dontAsk` and `auto` mode.
12161221
12171222### `ToolPermissionContext`
from line 3660
36553660
36563661> [!NOTE]
36573662>
3658> The built-in sandbox proxy enforces the network allowlist based on the requested hostname and does not terminate or inspect TLS traffic, so techniques such as [domain fronting](https://en.wikipedia.org/wiki/Domain_fronting) can potentially bypass it. See [Sandboxing security limitations](https://code.claude.com/docs/en/sandboxing.md#security-limitations) for details and [Secure deployment](https://code.claude.com/docs/en/agent-sdk/secure-deployment.md#traffic-forwarding) for configuring a TLS-terminating proxy.
3663> The built-in sandbox proxy enforces the network allowlist based on the requested hostname. By default, the proxy doesn't terminate or inspect TLS traffic, so techniques such as [domain fronting](https://en.wikipedia.org/wiki/Domain_fronting) can potentially bypass the allowlist. See [Sandboxing security limitations](https://code.claude.com/docs/en/sandboxing.md#security-limitations) for details and [Secure deployment](https://code.claude.com/docs/en/agent-sdk/secure-deployment.md#traffic-forwarding) for configuring a TLS-terminating proxy.
36593664
36603665### `SandboxIgnoreViolations`
36613666
No line in this hunk matches that.