7 ファイル変更 +31 -27

この更新の概要

TypeScriptおよびPython SDKにおいて、プラットフォームごとのネイティブバイナリがパッケージに同梱されるようになり、個別のClaude CodeやNode.jsのインストールが不要になりました。npmを用いたインストール手順が整理され、非推奨扱いの記述から標準的な導入方法の一つとして再定義されています。インストール時にバイナリが見つからない場合の対処法や、オプション依存関係の重要性についての説明がトラブルシューティングに追加されました。SDKの初期化オプションでは、内蔵バイナリの自動解決とパスの手動指定に関する詳細が更新されています。

agent-sdk/hosting +2 -2

SDKパッケージに各プラットフォーム向けのネイティブバイナリが同梱されるようになったため、個別のNode.jsインストールが不要になった旨が明記されました。

@@ -24,8 +24,8 @@ The SDK also supports [programmatic sandbox configuration](/en/agent-sdk/typescr
Each SDK instance requires:
- **Runtime dependencies**
- Python 3.10+ (for Python SDK) or Node.js 18+ (for TypeScript SDK)
- Node.js (required by the bundled Claude Code CLI that the SDK spawns; both SDK packages include it, so no separate install is needed)
- Python 3.10+ for the Python SDK, or Node.js 18+ for the TypeScript SDK
- Both SDK packages bundle a native Claude Code binary for the host platform, so no separate Claude Code or Node.js install is needed for the spawned CLI
- **Resource allocation**
- Recommended: 1GiB RAM, 5GiB of disk, and 1 CPU (vary this based on your task as needed)
agent-sdk/overview +2 -0

TypeScript SDKがオプションの依存関係としてネイティブバイナリを含むようになり、Claude Codeの単体インストールが不要になったことが追記されました。

@@ -54,6 +54,8 @@ npm install @anthropic-ai/claude-agent-sdk
pip install claude-agent-sdk
```
The TypeScript SDK bundles a native Claude Code binary for your platform as an optional dependency, so you don't need to install Claude Code separately.
Get an API key from the [Console](https://platform.claude.com/), then set it as an environment variable:
```bash theme={null}
agent-sdk/quickstart +2 -0

SDKにプラットフォーム別のバイナリが統合され、別途セットアップを行う必要がなくなったことが案内されています。

@@ -49,6 +49,8 @@ python3 -m venv .venv && source .venv/bin/activate
pip3 install claude-agent-sdk
```
The TypeScript SDK bundles a native Claude Code binary for your platform as an optional dependency, so you don't need to install Claude Code separately.
Get an API key from the [Claude Console](https://platform.claude.com/), then create a `.env` file in your project directory:
```bash theme={null}
agent-sdk/typescript-v2-preview +2 -0

V2プレビュー版においても、SDKがネイティブバイナリを同梱することで導入手順が簡略化されたことが説明されています。

@@ -23,6 +23,8 @@ The V2 interface is included in the existing SDK package:
npm install @anthropic-ai/claude-agent-sdk
```
The SDK bundles a native Claude Code binary for your platform as an optional dependency, so you don't need to install Claude Code separately.
## Quick start
### One-shot prompt
agent-sdk/typescript +3 -1

バイナリが見つからない際のエラー対応策や、pathToClaudeCodeExecutableオプションによるパスの自動解決と手動指定の詳細が追加されました。

@@ -15,6 +15,8 @@ source: https://code.claude.com/docs/en/agent-sdk/typescript.md
npm install @anthropic-ai/claude-agent-sdk
```
The SDK bundles a native Claude Code binary for your platform as an optional dependency such as `@anthropic-ai/claude-agent-sdk-darwin-arm64`. You don't need to install Claude Code separately. If your package manager skips optional dependencies, the SDK throws `Native CLI binary for <platform> not found`; set [`pathToClaudeCodeExecutable`](#options) to a separately installed `claude` binary instead.
## Functions
### `query()`
@@ -342,7 +344,7 @@ Configuration object for the `query()` function.
| `mcpServers` | `Record<string, [`McpServerConfig`](#mcp-server-config)>` | `{}` | MCP server configurations |
| `model` | `string` | Default from CLI | Claude model to use |
| `outputFormat` | `{ type: 'json_schema', schema: JSONSchema }` | `undefined` | Define output format for agent results. See [Structured outputs](/en/agent-sdk/structured-outputs) for details |
| `pathToClaudeCodeExecutable` | `string` | Uses built-in executable | Path to Claude Code executable |
| `pathToClaudeCodeExecutable` | `string` | Auto-resolved from bundled native binary | Path to Claude Code executable. Only needed if optional dependencies were skipped during install or your platform isn't in the supported set |
| `permissionMode` | [`PermissionMode`](#permission-mode) | `'default'` | Permission mode for the session |
| `permissionPromptToolName` | `string` | `undefined` | MCP tool name for permission prompts |
| `persistSession` | `boolean` | `true` | When `false`, disables session persistence to disk. Sessions cannot be resumed later |
setup +10 -24

npmによるインストール手順が整理され、ネイティブバイナリを配布するためのプラットフォーム別パッケージの仕組みと対応OS一覧が更新されました。

@@ -38,19 +38,19 @@ To install Claude Code, use one of the following methods:
**macOS, Linux, WSL:**
```bash theme={null}
```bash theme={null} theme={null} theme={null} theme={null}
curl -fsSL https://claude.ai/install.sh | bash
```
**Windows PowerShell:**
```powershell theme={null}
```powershell theme={null} theme={null} theme={null} theme={null}
irm https://claude.ai/install.ps1 | iex
```
**Windows CMD:**
```batch theme={null}
```batch theme={null} theme={null} theme={null} theme={null}
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
```
@@ -60,7 +60,7 @@ If you see `The token '&&' is not a valid statement separator`, you're in PowerS
Native installations automatically update in the background to keep you on the latest version.
```bash theme={null}
```bash theme={null} theme={null} theme={null} theme={null}
brew install --cask claude-code
```
@@ -68,7 +68,7 @@ Homebrew offers two casks. `claude-code` tracks the stable release channel, whic
Homebrew installations do not auto-update. Run `brew upgrade claude-code` or `brew upgrade claude-code@latest`, depending on which cask you installed, to get the latest features and security fixes.
```powershell theme={null}
```powershell theme={null} theme={null} theme={null} theme={null}
winget install Anthropic.ClaudeCode
```
@@ -274,31 +274,17 @@ curl -fsSL https://claude.ai/install.sh | bash -s 2.1.89
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd 2.1.89 && del install.cmd
```
### Deprecated npm installation
npm installation is deprecated. The native installer is faster, requires no dependencies, and auto-updates in the background. Use the [native installation](#install-claude-code) method when possible.
### Install with npm
#### Migrate from npm to native
If you previously installed Claude Code with npm, switch to the native installer:
You can also install Claude Code as a global npm package. The package requires [Node.js 18 or later](https://nodejs.org/en/download).
```bash
# Install the native binary
curl -fsSL https://claude.ai/install.sh | bash
# Remove the old npm installation
npm uninstall -g @anthropic-ai/claude-code
npm install -g @anthropic-ai/claude-code
```
You can also run `claude install` from an existing npm installation to install the native binary alongside it, then remove the npm version.
#### Install with npm
The npm package installs the same native binary as the standalone installer. npm pulls the binary in through a per-platform optional dependency such as `@anthropic-ai/claude-code-darwin-arm64`, and a postinstall step links it into place. The installed `claude` binary does not itself invoke Node.
If you need npm installation for compatibility reasons, you must have [Node.js 18+](https://nodejs.org/en/download) installed. Install the package globally:
```bash
npm install -g @anthropic-ai/claude-code
```
Supported npm install platforms are `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64`, and `win32-arm64`. Your package manager must allow optional dependencies. See [troubleshooting](/en/troubleshooting#native-binary-not-found-after-npm-install) if the binary is missing after install.
Do NOT use `sudo npm install -g` as this can lead to permission issues and security risks. If you encounter permission errors, see [troubleshooting permission errors](/en/troubleshooting#permission-errors-during-installation).
troubleshooting +10 -0

npmインストール後にバイナリが見つからない原因として、オプション依存関係のスキップや未対応プラットフォーム、企業内ミラーの欠如などの解決策が提示されました。

@@ -616,6 +616,16 @@ If you previously installed with npm and are hitting npm-specific permission err
curl -fsSL https://claude.ai/install.sh | bash
```
### Native binary not found after npm install
The `@anthropic-ai/claude-code` npm package pulls in the native binary through a per-platform optional dependency such as `@anthropic-ai/claude-code-darwin-arm64`. If running `claude` after install prints `Could not find native binary package "@anthropic-ai/claude-code-<platform>"`, check the following causes:
- **Optional dependencies are disabled.** Remove `--omit=optional` from your npm install command, `--no-optional` from pnpm, or `--ignore-optional` from yarn, and check that `.npmrc` does not set `optional=false`. Then reinstall. The native binary is delivered only as an optional dependency, so there is no JavaScript fallback if it is skipped.
- **Unsupported platform.** Prebuilt binaries are published for `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64`, and `win32-arm64`. Claude Code does not ship a binary for other platforms; see the [system requirements](/en/setup#system-requirements).
- **Corporate npm mirror is missing the platform packages.** Ensure your registry mirrors all eight `@anthropic-ai/claude-code-*` platform packages in addition to the meta package.
Installing with `--ignore-scripts` does not trigger this error. The postinstall step that links the binary into place is skipped, so Claude Code falls back to a wrapper that locates and spawns the platform binary on each launch. This works but starts more slowly; reinstall with scripts enabled for direct execution.
## Permissions and authentication
These sections address login failures, token issues, and permission prompt behavior.