Agent SDK reference - TypeScript changedagent-sdk/typescript
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,336
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits128to this page, all time
The whole hunk
from line 1336, old and new numbered
/
This page is larger than the 256 KiB this site keeps, so one side of the diff below stops where the stored text does.
from line 1336
13361336 | "default" // Standard permission behavior
13371337 | "acceptEdits" // Auto-accept file edits
13381338 | "bypassPermissions" // Bypass permission checks; explicit ask rules still prompt
1339 | "plan" // Planning mode - explore without editing
1339 | "plan" // Planning mode - Claude explores and plans
13401340 | "dontAsk" // Don't prompt for permissions, deny if not pre-approved
13411341 | "auto"; // A model classifier reviews actions such as shell commands and network requests
13421342```
from line 1345
13451345
13461346Custom permission function type for controlling tool usage.
13471347
1348The function 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 `allowedTools` 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.
1348The function replaces the interactive permission prompt. The SDK calls `canUseTool` 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 `canUseTool`:
13491349
1350* A call that an `allowedTools` entry or a settings allow rule approves
1351* A call the permission mode approves, such as a file edit in `acceptEdits` mode
1352
1353To check those calls, use a [`PreToolUse` hook](https://code.claude.com/docs/en/agent-sdk/hooks), which runs for them too.
1354
13501355An 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.
13511356
13521357```typescript theme={null}
from line 4795
47904795**Tool name:** `PushNotification`
47914796
47924797```typescript theme={null}
4793type PushNotificationOutput = {
4794 message: string;
4795 pushSent?: boolean;
4796 localSe
4798type PushNoti
No line in this hunk matches that.