← Projects

open-claude-agent-sdk

open source

Drop-in, open-source replacement for @anthropic-ai/claude-agent-sdk. Readable TypeScript that runs on the Claude CLI you already have installed.

open-claude-agent-sdk cover art

Overview

The official Claude Agent SDK ships minified JavaScript plus a Claude CLI binary for each platform. When an agent misbehaves, there is nothing useful to step through. This package keeps the same API and the same types, but the source is plain TypeScript and it talks to the Claude CLI you already have installed.

Switching is a one-line change:

diff
- import { query } from '@anthropic-ai/claude-agent-sdk';
+ import { query } from 'open-claude-agent-sdk';

Why use it

  • Debuggable: breakpoints and source maps work, and coding agents can read the source too
  • Small: about 564 KB in node_modules, compared with the official SDK's JavaScript plus a ~208 MB CLI binary per platform
  • Type compatible: it re-exports the official SDK's types, so existing code type-checks unchanged

What it supports

  • One-shot, multi-turn and streaming queries
  • Control methods: interrupt, close, setModel, setPermissionMode, setMaxThinkingTokens
  • Structured outputs, extended thinking, system prompt presets and canUseTool permission callbacks
  • Sessions: resume, fork, continue and custom session IDs
  • MCP servers, both in-process (createSdkMcpServer with Zod tools) and stdio, with reconnect and toggle controls
  • Subagents, hooks, skills, output styles and sandbox settings
  • Lightweight subpath exports (/query, /mcp, /storage) so you only load what you use

Not implemented yet: rewindFiles() and agent teams. The full status matrix is in the repository.

Built with

TypeScript on Bun, with integration and unit tests and three demo apps ported from the official SDK.