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 - TypeScript changedagent-sdk/typescript

Upstream edited this page at 28 Nov 2026 19:16 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 28 Nov 2026 19:37 UTC.

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

### `SDKSessionWritesLostMessage` #### Cache-write token fields

The whole hunk

from line 109, old and new numbered
/
lines

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 109
109109 
110110#### Returns
111111 
112Returns a `Promise<`[`WarmQuery`](#warmquery)`>` that resolves once the subprocess has spawned and completed its initialize handshake.
112Returns a `Promise<`[`WarmQuery`](#warmquery)`>` that resolves once the subprocess has spawned and completed its initialize handshake. If the promise rejects, check the error for an untyped `startupFailureReason` property holding a [`startup_failure_reason`](#startup_failure_reason) value. `startupFailureReason` requires Agent SDK v0.3.312 or later.
113113 
114114Of the [`hook_progress`](#sdkhookprogressmessage) messages a `SessionStart` or `Setup` hook emits before the handshake completes, you get only the newest, which carries all of the hook's output so far. `startup()` holds that message, the hook's [`hook_started`](#sdkhookstartedmessage) message, and anything else the subprocess emits before the handshake completes. The held messages reach you once you call `.query()` on the `WarmQuery` and iterate the result.
115115 
from line 1125
11251125 absPath: string;
11261126 truncated?: boolean;
11271127 encoding?: 'base64';
1128 lossy?: boolean;
11281129};
11291130```
11301131 
11311132`contents` holds the file text, or base64 data when you requested `encoding: 'base64'`; the response's `encoding` field is set to `'base64'` in that case. `absPath` is the resolved absolute path. `truncated` is set when the file was longer than the `maxBytes` cap and the contents were cut at that limit.
11321133 
1134When `lossy` is `true`, the bytes read weren't all valid UTF-8, so read the file again with `encoding: 'base64'`. `lossy` requires Claude Code v2.1.317 or later.
1135 
11331136#### What `readFile()` can read
11341137 
11351138`readFile()` serves a narrower set of files than the Read tool:
from line 1703
17001703 | SDKModelRefusalNoFallbackMessage
17011704 | SDKMirrorErrorMessage
17021705 | SDKInformationalMessage
1706 | SDKSessionWritesLostMessage
17031707 | SDKConversationResetMessage;
17041708```
17051709 
from line 2085
20812085 | "worktree_unverified"
20822086 | "cli_version_too_old"
20832087 | "bypass_root"
2088 | "initialize_not_first"
20842089 | "org_config_required_unavailable"
20852090 | "org_config_refused"
20862091 | "sandbox_required_unavailable"
from line 2114
21092114| `worktree_unverified` | The session's worktree couldn't be verified right now, and retrying may succeed |
21102115| `cli_version_too_old` | This Claude Code version is below the minimum Anthropic requires |
21112116| `bypass_root` | Bypass permissions mode was requested while running as root |
2117| `initialize_not_first` | The first line on Claude Code's stdin wasn't the expected [`initialize`](#sdkcontrolinitializeresponse) control request. In a wrapper script that starts Claude Code, pass stdin through unchanged. Requires Claude Code v2.1.317 or later |
21122118| `org_config_required_unavailable` | The session needs the organization's policies and managed settings before it can start, and they couldn't be loaded, for example because of a network failure or an Anthropic server error. Requires Agent SDK v0.3.293 or later |
21132119| `org_config_refused` | Anthropic refused to provide the organization's policies and managed settings for this sign-in, for example because the sign-in expired or was revoked, or the organization doesn't allow Claude Code for this account. Requires Agent SDK v0.3.293 or later |
21142120| `sandbox_required_unavailable` | [`failIfUnavailable`](#sandboxsettings) is on and the sandbox can't start. The text in `errors` ends with `Set sandbox.failIfUnavailable=false to allow unsandboxed execution.` Requires Agent SDK v0.3.314 or later |
from line 2269
22632269};
22642270```
22652271 
2272### `SDKSessionWritesLostMessage`
2273 
2274Claude Code couldn't save changes to `~/.claude.json` or part of a session transcript because the disk or disk quota was full. Check `lost` for what wasn't saved. The value `global_config` means `~/.claude.json`. [Free up space](https://code.claude.com/docs/en/errors.md#could-not-save-because-the-disk-is-full) before the next run. Requires Claude Code v2.1.317 or later.
2275 
2276```typescript theme={null}
2277type SDKSessionWritesLostMessage = {
2278 type: "system";
2279 subtype: "session_writes_lost";
2280 error_code: "ENOSPC" | "EDQUOT";
2281 lost: ("transcript" | "global_config")[];
2282 transcript_session_ids?: string[]; // the sessions whose transcripts lost lines
2283 uuid: UUID;
2284 session_id: string;
2285};
2286```
2287 
22662288### `SDKPluginInstallMessage`
22672289 
22682290Plugin installation progress event. Emitted when [`CLAUDE_CODE_SYNC_PLUGIN_INSTALL`](https://code.claude.com/docs/en/env-vars) is set, so your Agent SDK application can track marketplace plugin installation before the first turn. The `started` and `completed` statuses bracket the overall install. The `installed` and `failed` statuses report individual marketplaces and include `name`.
from line 4620
45984620| Field | Type | Description |
45994621| - | - | - |
46004622| `status` | `"async_launched" \| "remote_launched"` | The tool accepted the invocation. `"async_launched"` for in-process runs, `"remote_launched"` for runs dispatched to a cloud session instead of running in-process |
4601| `taskId` | `string` | Background task identifier for the run |
4602| `taskType` | `"local_workflow" \| "remote_agent"` | Task type of the registered background task, matching the `status` arm |
4603| `workflowName` | `string` | The `meta.name` from the workflow script |
4604| `runId` | `string` | Workflow run identifier to pass as `resumeFromRunId` on a later invocation. Absent for `remote_launched` runs, where the cloud session URL is the resume handle |
4605| `summary` | `string` | One-line description of what the workflow does |
4606| `transcriptDir` | `string` | Directory where subagent transcripts are written during execution |
4607| `scriptPath` | `string` | Path to the persisted workflow script for this run. Edit it and pass back as `scriptPath` to rerun without resending the script |
4608| `sessionUrl` | `string` | Cloud session URL, set when `status` is `"remote_launched"` |
4609| `warning` | `string` | Non-blocking heads-up, such as local git state diverging from the pushed branch a cloud session will clone |
4610| `error` | `string` | Set when the script fails its syntax check. When present, the run did not start despite the launched status |
4611 
4612### TodoWrite
4613 
4614**Tool name:** `TodoWrite`
4615 
4616```typescript theme={null}
4617type TodoWriteOutput = {
4618 oldTodos: Array<{
4619 content: string;
4620 status: "pending" | "in_progress" | "completed";
4621 activeForm: string;
4622 }>;
4623 newTodos: Array<{
4624 content: string;
4625 status: "pending" | "in_progress" | "completed";
4626 activeForm: string;
4627 }>;
4628};
4629`
4623| `taskId` | `string` | Background
Feedback