Claude Agent SDK for VS Code
Exposes @anthropic-ai/claude-agent-sdk to other VS Code extensions as a single shared installation.
The SDK is 200+ MB with native platform binaries. Rather than bundling it with VS Code, this extension can be installed on demand — saving hundreds of MB of duplicate downloads. It also handles the CJS/ESM boundary so consumers don't have to.
Usage
1. Declare a dependency in your extension's package.json:
{
"extensionDependencies": ["ms-vscode.vscode-claude-sdk"]
}
VS Code will activate this extension before yours.
2. Get the SDK in your extension code:
import type * as sdk from '@anthropic-ai/claude-agent-sdk';
import type { ExtensionContext } from 'vscode';
type SDKActivation =
| { sdk: typeof sdk; error: null }
| { sdk: null; error: Error };
export async function activate(context: ExtensionContext) {
const sdkExt = vscode.extensions.getExtension<SDKActivation>('ms-vscode.vscode-claude-sdk');
const { sdk, error } = await sdkExt!.activate();
if (error) {
// SDK failed to load (e.g. missing native binary for this platform)
throw error;
}
// sdk is the full @anthropic-ai/claude-agent-sdk module
}
API
type SDKActivation =
| { sdk: typeof import('@anthropic-ai/claude-agent-sdk'); error: null }
| { sdk: null; error: Error };
activate() always resolves — it never rejects. Check error before using sdk.