Skip to content

Anthropic Claude Agent SDK (TypeScript)

TypeScript port of the Claude Agent SDK. Same Computer Use, MCP, tool-use, and streaming capabilities — built for Node and browser environments.

Install

Terminal window
npm install @anthropic-ai/claude-agent-sdk

Version

v0.3.165 · June 2026 · Node 18+

Best for

Full-stack Claude apps, Node streaming servers, MCP-rich workflows.

  • v0.3.165 (June 2026) — Patch release; no API changes; same 25-export surface as 0.3.162. @anthropic-ai/claude-agent-sdk@0.3.165 confirmed latest stable via npm registry (2026-06-05); query, tool, createSdkMcpServer, session helpers, and all constants unchanged.
  • v0.3.164 (June 2026) — Patch release; stability and dependency updates.
  • v0.3.163 (June 2026) — Patch release; stability and dependency updates.
  • v0.3.162 (June 2026) — Patch release; no API changes; same 25-export surface as 0.3.161. @anthropic-ai/claude-agent-sdk@0.3.162 confirmed latest stable via npm registry (2026-06-04); query, tool, createSdkMcpServer, session helpers, and all constants unchanged.
  • v0.3.161 (June 2026) — Patch release; no API changes; same 25-export surface as 0.3.160. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.161 (/tmp/npm-0603); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.160 (June 2026) — Patch releases 0.3.159–0.3.160; no API changes; same 25-export surface as 0.3.158. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.160 (/tmp/npm-0602); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.159 (June 2026) — Patch release; stability and dependency updates.
  • v0.3.158 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.156. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.158 (/tmp/npm-check-0530); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.157 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.156 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.153. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.156 (/tmp/npm-check-0529); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.155 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.154 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.153 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.152. Version confirmed latest from npm registry (2026-05-28); export surface unchanged at 25 symbols (query, tool, createSdkMcpServer, session helpers, error types, and constants).
  • v0.3.152 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.150. Version confirmed latest from npm registry (2026-05-27); export surface unchanged at 25 symbols (query, tool, createSdkMcpServer, session helpers, error types, and constants).
  • v0.3.151 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.150 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.148. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.150 (.routine-envs/check-0523-node); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.149 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.148 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.145. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.148 (.routine-envs/check-0522-node); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.147 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.146 (May 2026) — Patch release; stability and dependency updates.
  • v0.3.145 (May 2026) — Patch release. No API changes; same 25-export surface as 0.3.144. All exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.145 (.routine-envs/check-0520-node); query, tool, createSdkMcpServer, session helpers, and all constants confirmed present.
  • v0.3.144 (May 2026) — Major minor-version bump (0.2 → 0.3). Three unstable_v2_* preview exports (unstable_v2_createSession, unstable_v2_prompt, unstable_v2_resumeSession) that were present in 0.2.x have been removed; the package now exports 25 stable symbols. Full export surface verified against installed @anthropic-ai/claude-agent-sdk@0.3.144 (.routine-envs/check-0519-node): query, tool, createSdkMcpServer, session helpers (forkSession, listSessions, getSessionInfo, getSessionMessages, InMemorySessionStore, renameSession, tagSession, deleteSession, importSessionToStore, listSubagents, getSubagentMessages), error types (AbortError, DirectConnectError), transport (DirectConnectTransport, parseDirectConnectUrl), constants (EXIT_REASONS, HOOK_EVENTS, SYSTEM_PROMPT_DYNAMIC_BOUNDARY), and utilities (resolveSettings, startup, filterEscalatingDefaultMode, foldSessionSummary) all confirmed present. If your code referenced any unstable_v2_* export, remove or replace it.
  • v0.2.141 (May 14) — Final 0.2.x release; stability and dependency updates. 28 exports confirmed including query, tool, createSdkMcpServer, session helpers, and the three unstable_v2_* preview exports (now removed in 0.3.x).
  • v0.2.140 (May 13) — Patch release; stability and dependency updates.
  • v0.2.139 (May 12) — Patch release; stability and dependency updates. Runtime exports (query, tool, createSdkMcpServer) verified against installed @anthropic-ai/claude-agent-sdk@0.2.139 (.routine-envs/check-0512-node).
  • v0.2.129–0.2.138 (May 6–9) — Ten patch releases promoting session management APIs to stable. New stable exports: InMemorySessionStore, createSdkMcpServer, forkSession, deleteSession, listSessions, getSessionInfo, getSessionMessages, getSubagentMessages, importSessionToStore, listSubagents, renameSession, tagSession, resolveSettings, startup. New error types: AbortError, DirectConnectError. New transport: DirectConnectTransport with parseDirectConnectUrl. New constants: EXIT_REASONS, HOOK_EVENTS, SYSTEM_PROMPT_DYNAMIC_BOUNDARY.
  • v0.2.127–0.2.128 (May 5) — Patch releases; dependency updates.
  • v0.2.124–0.2.126 (May 1) — Patch releases; dependency updates. Note: 0.2.125 was not published.
  • v0.2.122–0.2.123 (April 29) — Patch releases; dependency updates.
  • v0.2.120–0.2.121 (April 26–28) — Patch releases; dependency updates.
  • v0.2.118–0.2.119 (April 23–24) — Patch releases; dependency updates.
  • v0.2.117 (April 21) — Patch release; dependency updates.
  • v0.2.116 (April 20) — Stability improvements.
  • v0.2.111–0.2.114 (April 16–17) — Patch series: MCP protocol alignment, extended-thinking type alignment with Python SDK, performance improvements.
  • v0.2.110 — Multibyte character fix; MCP cleanup; extended thinking config types.
  • Prior: package rename (@anthropic-ai/claude-code-sdk@anthropic-ai/claude-agent-sdk); Computer Use; MCP; session management; hooks.

There is no Agent class in @anthropic-ai/claude-agent-sdk 0.2.117. The public entry points are query() (one-shot) and the lower-level exports listed on the package. Earlier drafts of this page documented a new Agent({...}) constructor — it does not exist.

// One-shot query
import { query } from '@anthropic-ai/claude-agent-sdk';
for await (const message of query({
prompt: 'What is 15 + 27?',
options: {
model: 'claude-3-5-sonnet-latest',
systemPrompt: 'You are a helpful assistant.',
},
})) {
console.log(message);
}

For richer session flows use the session helpers (forkSession, listSessions, InMemorySessionStore) or the MCP server factory createSdkMcpServer.

Ready? Start Zero → Hero Step 1 →


DateFramework version (installed)Summary of changesReviewer
2026-06-05@anthropic-ai/claude-agent-sdk 0.3.165Patch releases 0.3.163–0.3.165; “What’s new” heading updated to v0.3.165; three patch bullets added; comprehensive guide header updated; revision history entry added. @anthropic-ai/claude-agent-sdk@0.3.165 confirmed latest stable via npm registry (2026-06-05); 25-export surface unchanged.Claude routine
2026-06-04@anthropic-ai/claude-agent-sdk 0.3.162Patch release 0.3.162; “What’s new” heading updated to v0.3.162; patch bullet added; revision history entry added. @anthropic-ai/claude-agent-sdk@0.3.162 confirmed latest stable via npm registry (2026-06-04); 25-export surface unchanged.Claude routine
2026-06-03@anthropic-ai/claude-agent-sdk 0.3.161Patch release 0.3.161; “What’s new” heading updated to v0.3.161; patch bullet added; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.161 (/tmp/npm-0603); query, tool, createSdkMcpServer, session helpers all PASS. Export count: 25 — PASS.Claude routine
2026-06-02@anthropic-ai/claude-agent-sdk 0.3.160Patch releases 0.3.159–0.3.160; “What’s new” heading updated to v0.3.160; two patch bullets added; comprehensive guide header updated; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.160 (/tmp/npm-0602); query, tool, createSdkMcpServer, session helpers all PASS. Export count: 25 — PASS.Claude routine
2026-05-30@anthropic-ai/claude-agent-sdk 0.3.158Patch releases 0.3.157–0.3.158; “What’s new” heading updated to v0.3.158; two patch bullets added; comprehensive guide header updated; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.158 (/tmp/npm-check-0530); query, tool, createSdkMcpServer, session helpers all PASS. Export count: 25 — PASS.Claude routine
2026-05-29@anthropic-ai/claude-agent-sdk 0.3.156Patch releases 0.3.154–0.3.156; “What’s new” heading updated to v0.3.156; three patch bullets added; comprehensive guide header updated; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.156 (/tmp/npm-check-0529); query, tool, createSdkMcpServer, session helpers all PASS. Export count: 25 — PASS.Claude routine
2026-05-28@anthropic-ai/claude-agent-sdk 0.3.153Patch release 0.3.153; no API changes. Latest: header updated 0.3.152 → 0.3.153; revision history entry added. npm @anthropic-ai/claude-agent-sdk@0.3.153 confirmed latest (2026-05-28); export surface unchanged at 25 symbols.Claude routine
2026-05-27@anthropic-ai/claude-agent-sdk 0.3.152Patch releases 0.3.151–0.3.152; “What’s new” heading updated to v0.3.152; two patch bullets added; comprehensive guide header updated; revision history entry added. npm @anthropic-ai/claude-agent-sdk@0.3.152 confirmed latest. Export surface unchanged at 25 symbols.Claude routine
2026-05-23@anthropic-ai/claude-agent-sdk 0.3.150Patch releases 0.3.149–0.3.150; “What’s new” heading updated to v0.3.150; two patch bullets added; comprehensive guide header updated; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.150 (.routine-envs/check-0523-node); query, tool, createSdkMcpServer, session helpers all PASS. Export count: 25 — PASS.Claude routine
2026-05-22@anthropic-ai/claude-agent-sdk 0.3.148Patch releases 0.3.146–0.3.148; “What’s new” heading updated to v0.3.148; three patch bullets added; comprehensive guide header updated; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.148 (.routine-envs/check-0522-node); query, tool, createSdkMcpServer, session helpers all PASS. Export count: 25 — PASS.Claude routine
2026-05-20@anthropic-ai/claude-agent-sdk 0.3.145Patch release bump 0.3.144 → 0.3.145; “What’s new” heading updated to v0.3.145; v0.3.145 bullet added; comprehensive guide header updated; revision history entry added. All 25 exports verified against installed @anthropic-ai/claude-agent-sdk@0.3.145 (.routine-envs/check-0520-node); query, tool, createSdkMcpServer, session helpers all PASS.Claude routine
2026-05-19@anthropic-ai/claude-agent-sdk 0.3.144Major version bump 0.2.141 → 0.3.144; “What’s new” updated; comprehensive guide header updated; revision history entry added. Three unstable_v2_* exports removed from public API. Full 25-export surface verified against installed @anthropic-ai/claude-agent-sdk@0.3.144 (.routine-envs/check-0519-node).Claude routine
2026-05-14@anthropic-ai/claude-agent-sdk 0.2.141Version bumped 0.2.140 → 0.2.141; “What’s new” updated; comprehensive guide header updated; revision history entry added. Full export surface verified against installed @anthropic-ai/claude-agent-sdk@0.2.141 (.routine-envs/check-0514-node): 28 exports confirmed including query, tool, createSdkMcpServer, session helpers, error types, and constants.Claude routine
2026-05-13@anthropic-ai/claude-agent-sdk 0.2.140Version bumped 0.2.139 → 0.2.140; “What’s new” updated; comprehensive guide header updated; revision history entry added. Runtime exports (query, tool, createSdkMcpServer) verified against installed @anthropic-ai/claude-agent-sdk@0.2.140 (.routine-envs/check-0513-node).Claude routine
2026-05-12@anthropic-ai/claude-agent-sdk 0.2.139Version bumped 0.2.138 → 0.2.139; “What’s new” updated; revision history entry added. Runtime exports (query, tool, createSdkMcpServer) verified against installed @anthropic-ai/claude-agent-sdk@0.2.139 (.routine-envs/check-0512-node).Claude routine
2026-05-09@anthropic-ai/claude-agent-sdk 0.2.138Version bumped 0.2.128 → 0.2.138 (ten patch releases 0.2.129–0.2.138); “What’s new” updated; all exports verified against npm @anthropic-ai/claude-agent-sdk@0.2.138 (2026-05-09, .routine-envs/check-0509-node).Claude routine
2026-05-05@anthropic-ai/claude-agent-sdk 0.2.128Version bumped 0.2.126 → 0.2.128 (two patch releases: 0.2.127, 0.2.128); “What’s new” updated; revision history entry added. query (runtime export), PermissionMode/McpServerConfig (TypeScript type exports in sdk.d.ts) verified against npm @anthropic-ai/claude-agent-sdk@latest (0.2.128, 2026-05-05, .routine-envs/check-0505-node).Claude routine
2026-05-01@anthropic-ai/claude-agent-sdk 0.2.126Version bumped 0.2.123 → 0.2.126 (two patch releases: 0.2.124, 0.2.126; 0.2.125 not published); “What’s new” section updated for 0.2.124–0.2.126 patch series. Version confirmed against npm @anthropic-ai/claude-agent-sdk@latest (0.2.126, 2026-05-01).Claude routine
2026-04-29@anthropic-ai/claude-agent-sdk 0.2.123Version bumped 0.2.121 → 0.2.123 (two patch releases: 0.2.122, 0.2.123); “What’s new” section updated for 0.2.122–0.2.123 patch series. Version confirmed against npm.Claude routine
2026-04-28@anthropic-ai/claude-agent-sdk 0.2.121Version bumped 0.2.119 → 0.2.121 (two patch releases); “What’s new” section updated for 0.2.120–0.2.121 patch series. Version confirmed against npm.Claude routine
2026-04-24@anthropic-ai/claude-agent-sdk 0.2.119Version bumped 0.2.117 → 0.2.119; “What’s new” section updated for 0.2.118–0.2.119 patch series.Claude routine
2026-04-22@anthropic-ai/claude-agent-sdk 0.2.117Version bumped 0.2.116 → 0.2.117; “What’s new” section updated; revision history entries added for 0.2.111–0.2.117 patch series.Claude routine
2026-04-21@anthropic-ai/claude-agent-sdk 0.2.116Minimal example rewritten after pkg introspection: new Agent(...) does not exist; use query() / session helpers. Banner bumped to 0.2.116.
2026-04-18@anthropic-ai/claude-agent-sdk 0.2.113Stability fixes; SDK rename stabilised.
2025Renamed from @anthropic-ai/claude-code-sdk to @anthropic-ai/claude-agent-sdk.

Note: Python implementation lives at Claude Agent SDK (Python).