- Updated to parity with Claude Code v2.1.98
- Updated to parity with Claude Code v2.1.97
- Updated to parity with Claude Code v2.1.96
- Updated to parity with Claude Code v2.1.95
- Fixed
getContextUsage()to include agents passed viaoptions.agentsin theagentsbreakdown - Fixed CJK and other multibyte text being corrupted with U+FFFD in stream-json input/output when chunk boundaries split a UTF-8 sequence
- Fixed MCP server child processes not being cleaned up when an SDK
query()session ends - Fixed a failed error-report write crashing the SDK process with
unhandledRejection - Updated to parity with Claude Code v2.1.94
- Updated to parity with Claude Code v2.1.93
- Updated to parity with Claude Code v2.1.92
- Added optional
terminal_reasonfield to result messages, exposing why the query loop terminated (completed,aborted_tools,max_turns,blocking_limit, etc.) - Added
'auto'to the publicPermissionModetype - Changed
sandboxoption to defaultfailIfUnavailabletotruewhenenabled: trueis passed —query()will emit an error result and exit if sandbox dependencies are missing, instead of silently running unsandboxed. SetfailIfUnavailable: falseto allow graceful degradation. - Updated to parity with Claude Code v2.1.91
- Updated to parity with Claude Code v2.1.90
- Added
startup()to pre-warm the CLI subprocess beforequery(), making the first query ~20x faster when startup cost can be paid upfront - Added
includeSystemMessagesoption togetSessionMessages()to optionally include system messages in session history - Added
listSubagents()andgetSubagentMessages()functions to retrieve subagent conversation history from sessions - Added
includeHookEventsoption to enable hook lifecycle messages (hook_started,hook_progress,hook_response) for all hook event types - Fixed
ERR_STREAM_WRITE_AFTER_ENDerrors when single-turn queries with SDK MCP servers or hooks have control responses arriving after the result message - Fixed Zod v4 field
.describe()metadata being dropped fromcreateSdkMcpServertool schemas - Fixed
side_questionreturning null on resume before the first turn completes - Fixed
settingSourcesempty array causing--setting-sources ""to consume the next CLI flag - Fixed error result messages (
error_during_execution,error_max_turns,error_max_budget_usd) to correctly setis_error: truewith descriptive messages - Fixed MCP servers getting permanently stuck in a failed state after a connection race — they now retry on the next message
- Updated to parity with Claude Code v2.1.87
- Added
getContextUsage()control method to retrieve a breakdown of context window usage by category - Made
session_idoptional inSDKUserMessagetype — callers no longer need to provide a session ID when sending user messages, as the SDK assigns one automatically - Fixed TypeScript types resolving to
anyby adding@anthropic-ai/sdkand@modelcontextprotocol/sdkas dependencies - Updated to parity with Claude Code v2.1.86
- Added
reloadPlugins()SDK method to reload plugins and receive refreshed commands, agents, and MCP server status - Fixed PreToolUse hooks with
permissionDecision: "ask"being ignored in SDK mode - Updated to parity with Claude Code v2.1.85
- Added
taskBudgetoption for API-side token budget awareness, allowing the model to pace tool use within a token limit - Added
enableChannel()method andcapabilitiesfield onMcpServerStatusfor SDK-driven MCP channel activation - Exported
EffortLeveltype ('low' | 'medium' | 'high' | 'max') for consumers to reference effort values directly - Fixed showing "[Request interrupted by user]" for errors that were not caused by user interruption
- Updated to parity with Claude Code v2.1.84
- Added
seed_read_statecontrol subtype to seedreadFileStatewith{path, mtime}soEditworks after the originatingReadwas removed from context - Changed
session_state_changedevents to opt-in: setCLAUDE_CODE_EMIT_SESSION_STATE_EVENTS=1to receive them - Updated to parity with Claude Code v2.1.83
- Updated to parity with Claude Code v2.1.82
- Fixed
canUseToolnot providing a workingaddRulessuggestion when a write under.claude/skills/{name}/hits the bypass-immune safety check - Updated to parity with Claude Code v2.1.81
- Fixed
getSessionMessages()dropping parallel tool results — sessions with parallel tool calls now return all tool_use/tool_result pairs - Updated to parity with Claude Code v2.1.80
- Added
'resume'to theExitReasontype for distinguishing resume-triggered session ends in hooks - Updated to parity with Claude Code v2.1.79
- Updated to parity with Claude Code v2.1.78
- Added
api_retrysystem messages when retrying transient API errors, exposing attempt count, max retries, delay, and error status - Updated to parity with Claude Code v2.1.77
- Added
forkSession(sessionId, opts?)for branching conversations from a point - Added
cancel_async_messagecontrol subtype to drop a queued user message by UUID before execution - Added
planFilePathfield toExitPlanModetool input for hooks and SDK consumers - Added MCP elicitation hook types and
SDKElicitationCompleteMessagesystem message for handling MCP server input requests programmatically - Updated to parity with Claude Code v2.1.76
- Added
tagandcreatedAtfields toSDKSessionInfo - Added
getSessionInfo(sessionId, opts?)for single-session metadata lookup - Added
offsetoption tolistSessionsfor pagination - Added
tagSession(sessionId, tag, opts?)for tagging session files - Added
queued_to_runningstatus toAgentToolOutput— returned whenAgent({resume})targets a still-running agent - Improved error messages when the Claude Code subprocess returns an error result — the SDK now surfaces the actual error text instead of a generic "process exited with code 1"
- Updated to parity with Claude Code v2.1.75
- Added
renameSession(sessionId, title, opts?)for renaming session files - Fixed
import typefrom@anthropic-ai/claude-agent-sdk/sdk-toolsfailing under NodeNext/Bundler module resolution (missing exports map entry since v0.2.69) - Fixed skills with
user-invocable: falsebeing included insupportedCommands()and thesystem:initmessage'sslash_commands/skillslists - Updated to parity with Claude Code v2.1.74
- Fixed
options.envbeing overridden by the~/.claude/settings.jsonenv block when not usinguseras asettingSourcesoption - Updated to parity with Claude Code v2.1.73
- Added
agentProgressSummariesoption to enable periodic AI-generated progress summaries for running subagents (foreground and background), emitted ontask_progressevents via the newsummaryfield - Added
getSettings()appliedsection with runtime-resolvedmodelandeffortvalues - Fixed
toggleMcpServerandreconnectMcpServerfailing with "Server not found" for servers passed viaquery({mcpServers}) - Updated to parity with Claude Code v2.1.72
- Updated to parity with Claude Code v2.1.71
- Fixed
type: "http"MCP servers failing with HTTP 406 "Not Acceptable" on Streamable HTTP servers that strictly enforce theAccept: application/json, text/event-streamheader - Changed
AgentToolInput.subagent_typeto optional — defaults to thegeneral-purposeagent when omitted - Updated to parity with Claude Code v2.1.70
- Added
toolConfig.askUserQuestion.previewFormatoption to configure the content format ('markdown'or'html') for thepreviewfield on AskUserQuestion tool options. Thepreviewfield andannotationsoutput are now exposed in the public SDK types. - Added
supportsFastModefield toModelInfoindicating whether a model supports fast mode - Added
agent_id(for subagents) andagent_type(for subagents and--agent) fields to hook events - Fixed SDK-mode MCP servers (registered via
sdkMcpServersin theinitializecontrol request) getting disconnected when background plugin installation refreshes project MCP config - Fixed breaking change:
system:initandresultevents now emit'Task'as the Agent tool name again (reverted from'Agent', which was an unintentional breaking change in a patch release). The wire name will migrate to'Agent'in the next minor release. - Fixed control responses with malformed
updatedPermissionsfrom SDK hosts blocking tool calls with a ZodError; the invalid field is now stripped and a warning is logged instead. - Improved memory usage of
getSessionMessages()for large sessions with compacted history
- Updated to parity with Claude Code v2.1.68
- Updated to parity with Claude Code v2.1.66
- SDK: Fixed
pathToClaudeCodeExecutablefailing when set to a bare command name (e.g.,"claude") that should resolve via PATH - Added
supportedAgents()method to the Query interface to view available subagents - Fixed MCP replacement tools being incorrectly denied in subagents when using unprefixed MCP tool names
- Updated to parity with Claude Code v2.1.61
- Added
getSessionMessages()function for reading a session's conversation history from its transcript file, with support for pagination vialimitandoffsetoptions
- Updated to parity with Claude Code v2.1.58
- Updated to parity with Claude Code v2.1.56
- Updated to parity with Claude Code v2.1.55
- Updated to parity with Claude Code v2.1.54
- Added
listSessions()for discovering and listing past sessions with light metadata
- Updated to parity with Claude Code v2.1.52
- Updated to parity with Claude Code v2.1.51
- Fixed SDK crashing with
ReferenceErrorwhen used inside compiled Bun binaries (bun build --compile) - Fixed unbounded memory growth in long-running SDK sessions caused by message UUID tracking never evicting old entries
- Fixed local slash command output not being returned to SDK clients
- Added
task_progressevents for real-time background agent progress reporting with cumulative usage metrics, tool counts, and duration - Fixed
session.close()in the v2 session API killing the subprocess before it could persist session data, which brokeresumeSession()
- Updated to parity with Claude Code v2.1.50
- Updated to parity with Claude Code v2.1.49
- SDK model info now includes
supportsEffort,supportedEffortLevels, andsupportsAdaptiveThinkingfields so consumers can discover model capabilities. - Permission suggestions are now populated when safety checks trigger an ask response, enabling SDK consumers to display permission options.
- Added
ConfigChangehook event that fires when configuration files change during a session, enabling enterprise security auditing and optional blocking of settings changes.
- Updated to parity with Claude Code v2.1.47
- Added
promptSuggestion()method onQueryto request prompt suggestions based on the current conversation context - Added
tool_use_idfield totask_notificationevents for correlating task completions with originating tool calls
- Updated to parity with Claude Code v2.1.46
- Added support for Claude Sonnet 4.6
- Added
task_startedsystem message to the SDK stream, emitted when subagent tasks are registered - Fixed
Session.stream()returning prematurely when background subagents are still running, by holding back intermediate result messages until all tasks complete - Improved memory usage for shell commands that produce large output — RSS no longer grows unboundedly with command output size
- Updated to parity with Claude Code v2.1.44
- Updated to parity with Claude Code v2.1.43
- Updated to parity with Claude Code v2.1.42
- Updated to parity with Claude Code v2.1.41
- Updated to parity with Claude Code v2.1.40
- Updated to parity with Claude Code v2.1.39
- Updated to parity with Claude Code v2.1.38
- Updated to parity with Claude Code v2.1.37
- Updated to parity with Claude Code v2.1.36
- Updated to parity with Claude Code v2.1.35
- Updated to parity with Claude Code v2.1.34
- Added
TeammateIdleandTaskCompletedhook events with correspondingTeammateIdleHookInputandTaskCompletedHookInputtypes - Added
sessionIdoption to specify a custom UUID for conversations instead of auto-generated ones - Updated to parity with Claude Code v2.1.33
- Updated to parity with Claude Code v2.1.32
- Added
stop_reasonfield toSDKResultSuccessandSDKResultErrorto indicate why the model stopped generating
- Added
debuganddebugFileoptions for programmatic control of debug logging - Added optional
pagesfield toFileReadToolInputfor reading specific PDF page ranges - Added
partsoutput type toFileReadToolOutputfor page-extracted PDF results - Fixed "(no content)" placeholder messages being included in SDK output
- Updated to parity with Claude Code v2.1.29
- Added optional
annotationssupport to thetool()helper function for specifying MCP tool hints (readOnlyHint, destructiveHint, openWorldHint, idempotentHint) - Fixed
mcpServerStatus()to include tools from SDK and dynamically-added MCP servers - Updated to parity with Claude Code v2.1.27
- Updated to parity with Claude Code v2.1.25
- Fixed structured output validation errors not being reported correctly
- Updated to parity with Claude Code v2.1.23
- Fixed structured outputs to handle empty assistant messsages
- Updated to parity with Claude Code v2.1.22
- Added
config,scope, andtoolsfields toMcpServerStatusfor richer server introspection - Added
reconnectMcpServer()andtoggleMcpServer()methods for managing MCP server connections - Added
disabledstatus toMcpServerStatus - Fixed PermissionRequest hooks not being executed in SDK mode (e.g., VS Code extension)
- Updated to parity with Claude Code v2.1.21
- Added support for loading CLAUDE.md files from directories specified via
additionalDirectoriesoption (requires settingCLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1in theenvoption) - Added
CLAUDE_CODE_ENABLE_TASKSenv var, set totrueto opt into the new task system - Updated to parity with Claude Code v2.1.20
- Added
CLAUDE_CODE_ENABLE_TASKSenv var, set totrueto opt into the new task system
- Updated to parity with Claude Code v2.1.17
- Updated to parity with Claude Code v2.1.16
- Added notification hook support
- Added
close()method to Query interface for forcefully terminating running queries - Updated to parity with Claude Code v2.1.15
- Updated to parity with Claude Code v2.1.14
- Updated to parity with Claude Code v2.1.12
- Updated to parity with Claude Code v2.1.11
- Added
skillsandmaxTurnsconfiguration options to custom agent definitions.
- Updated to parity with Claude Code v2.1.9
- Updated to parity with Claude Code v2.1.8
- Updated to parity with Claude Code v2.1.7
- Updated to parity with Claude Code v2.1.6
- Added
claudeCodeVersionfield topackage.jsonfor programmatically determining compatible CLI version
- Updated to parity with Claude Code v2.1.5
- Updated to parity with Claude Code v2.1.4
- Updated to parity with Claude Code v2.1.3
- Added
errorfield toMcpServerStatusfor failed MCP server connections - Updated to parity with Claude Code v2.1.0
- Updated to parity with Claude Code v2.0.78
- Updated to parity with Claude Code v2.0.75
- Updated to parity with Claude Code v2.0.74
- Fixed a bug where Stop hooks would not consistently run due to
Stream closederror - Updated to parity with Claude Code v2.0.73
- Fixed
/contextcommand not respecting custom system prompts - Fixed non-streaming single-turn queries to close immediately on first result instead of waiting for inactivity timeout
- Changed V2 session API method
receive()tostream()for consistency with Anthropic SDK patterns - Updated to parity with Claude Code v2.0.72
- Added zod
^4.0.0as peer dependency option in addition to zod^3.24.1 - Added support for AskUserQuestion tool. If using
toolsoption, enable by including'AskUserQuestion'in list - Fixed visible console window appearing when spawning Claude subprocess on Windows
- Fixed spawn message being sent to stderr callback (#45)
- Updated to parity with Claude Code v2.0.71
- Updated to parity with Claude Code v2.0.69
- Fixed a bug where disallowed MCP tools were visible to the model
- Updated to parity with Claude Code v2.0.68
- Updated to parity with Claude Code v2.0.67
- Fixed project MCP servers from
.mcp.jsonnot being available whensettingSourcesincludesproject - Updated to parity with Claude Code v2.0.66
- Updated to parity with Claude Code v2.0.66
- Fixed issues where SDK MCP servers, hooks, or canUseTool callbacks could fail when stdin was closed too early after the first result
- Updated to parity with Claude Code v2.0.64
- Updated to parity with Claude Code v2.0.63
- Updated to parity with Claude Code v2.0.61
- Updated to parity with Claude Code v2.0.60
- Updated to parity with Claude Code v2.0.59
- Updated to parity with Claude Code v2.0.58
- Added
betasoption to enable beta features. Currently supports'context-1m-2025-08-07'for 1M token context window on Sonnet 4/4.5. See https://docs.anthropic.com/en/api/beta-headers for more details.
- Updated to parity with Claude Code v2.0.57
- Added
toolsoption to specify the exact set of built-in tools available to the agent. Usetools: ['Bash', 'Read', 'Edit']for a strict allowlist,tools: []to disable all built-in tools, ortools: { type: 'preset', preset: 'claude_code' }for all default tools. Omitting this option preserves existing behavior where all built-in tools are available (and can be filtered withdisallowedTools).
- Updated to parity with Claude Code v2.0.56
- Update to parity with Claude Code v2.0.55
- Updated to parity with Claude Code v2.0.54
- Added experimental v2 session APIs (
unstable_v2_createSession,unstable_v2_resumeSession,unstable_v2_prompt) for simpler multi-turn conversations - Fixed a bug where ExitPlanMode tool input was empty
- Updated to parity with Claude Code v2.0.53
- Updated to parity with Claude Code v2.0.52
- Updated to parity with Claude Code v2.0.51
- Added support for Opus 4.5! https://www.anthropic.com/news/claude-opus-4-5
- Updated to parity with Claude Code v2.0.50
- Updated to parity with Claude Code v2.0.49
- Updated to parity with Claude Code v2.0.47
- Add
errorfield to some messages
- Updated to parity with Claude Code v2.0.46
- Add support for Microsoft Foundry! See https://code.claude.com/docs/en/azure-ai-foundry
- Structured outputs support. Agents can now return validated JSON matching your schema. See https://platform.claude.com/docs/en/agent-sdk/structured-outputs.
- Updated to parity with Claude Code v2.0.45
- Updated to parity with Claude Code v2.0.44
- Updated to parity with Claude Code v2.0.43
- Updated to parity with Claude Code v2.0.42
- Updated to parity with Claude Code v2.0.41
- Updated to parity with Claude Code v2.0.37
- Updated to parity with Claude Code v2.0.36
- Updated to parity with Claude Code v2.0.35
- Updated to parity with Claude Code v2.0.34
- Updated to parity with Claude Code v2.0.33
- Updated to parity with Claude Code v2.0.32
- Added --max-budget-usd flag
- Fixed a bug where hooks were sometimes failing in stream mode
- Updated to parity with Claude Code v2.0.31
- Updated to parity with Claude Code v2.0.29
- Updated to parity with Claude Code v2.0.28
- Fixed a bug where custom tools were timing out after 30 seconds instead of respecting
MCP_TOOL_TIMEOUT(#42)
- Updated to parity with Claude Code v2.0.27
- Added
pluginsfield toOptions
- Updated to parity with Claude Code v2.0.26
- Updated to parity with Claude Code v2.0.25
- Fixed a bug where project-level skills were not loading when
'project'settings source was specified - Added
skillsfield toSDKSystemMessagewith list of available skills - Fixed a bug where some exported types were not importing correctly (#39)
- Updated to parity with Claude Code v2.0.22
- Updated to parity with Claude Code v2.0.21
- Updated to parity with Claude Code v2.0.20
- Updated to parity with Claude Code v2.0.19
- Updated to parity with Claude Code v2.0.18
- Updated to parity with Claude Code v2.0.17
- Updated to parity with Claude Code v2.0.15
- Updated
envtype to not use BunDicttype - Startup performance improvements when using multiple SDK MCP servers
- Updated to parity with Claude Code v2.0.14
- Updated to parity with Claude Code v2.0.13
- Updated to parity with Claude Code v2.0.12
- Increased SDK MCP channel closure timeout to 60s, addressing #15
- Updated to parity with Claude Code v2.0.11
- Updated to parity with Claude Code v2.0.10
- Added zod ^3.24.1 as peer dependency
- Fixed a bug where system prompt was sometimes not getting set correctly: #8
- Updated to parity with Claude Code v2.0.1
- Merged prompt options: The
customSystemPromptandappendSystemPromptfields have been merged into a singlesystemPromptfield for simpler configuration - No default system prompt: The Claude Code system prompt is no longer included by default, giving you full control over agent behavior. To use the Claude Code system prompt, explicitly set:
- No filesystem settings by default: Settings files (
settings.json,CLAUDE.md), slash commands, and subagents are no longer loaded automatically. This ensures SDK applications have predictable behavior independent of local filesystem configurations - Explicit settings control: Use the new
settingSourcesfield to specify which settings locations to load:["user", "project", "local"] - Programmatic subagents: Subagents can now be defined inline in code using the
agentsoption, enabling dynamic agent creation without filesystem dependencies. Learn more - Session forking: Resume sessions with the new
forkSessionoption to branch conversations and explore different approaches from the same starting point. Learn more - Granular settings control: The
settingSourcesoption gives you fine-grained control over which filesystem settings to load, improving isolation for CI/CD, testing, and production deployments - Comprehensive documentation now available in the API Guide
- New guides for Custom Tools, Permissions, Session Management, and more
- Complete TypeScript API reference