Claude Agent SDK — Features & API
Core Capabilities
| Capability | Description |
|---|---|
| Codebase Understanding | Analyze and comprehend entire project structures |
| File Operations | Read, write, create, and edit files programmatically |
| Command Execution | Run shell commands within agent workflows |
| Web Search | Search the internet for information |
| Multi-Step Workflows | Chain complex autonomous tasks |
| Structured Outputs | Return validated JSON matching your schema |
| Session Management | V2 APIs for multi-turn conversations |
V2 Session API (New)
// Create a persistent session
const session = await claude.unstable_v2_createSession({
workingDirectory: "./project",
});
// Send messages within the session
const response = await claude.unstable_v2_prompt(session.id, {
prompt: "What files are in this project?",
});
// Continue the conversation
const followUp = await claude.unstable_v2_prompt(session.id, {
prompt: "Now refactor the main module",
});Available Tools
The SDK exposes the same 53 tools that Claude Code uses internally:
- File tools: Read, Write, Edit, Glob, Grep
- Shell tools: Bash command execution
- Search tools: Web search, web fetch
- Agent tools: Spawn sub-agents for parallel tasks
- Planning tools: Task decomposition and approval
Use Cases
- Custom Coding Agents — Build your own Claude Code with custom behaviors
- Email Assistants — Agents that read, classify, and respond to emails
- Research Agents — Multi-agent systems that search, analyze, and synthesize
- CI/CD Agents — Autonomous code review and fix workflows
- Document Processors — Analyze and transform documents at scale
Migration from Claude Code SDK
The package was renamed from @anthropic-ai/claude-code-sdk to @anthropic-ai/claude-agent-sdk. Update your import:
// Old
import { Claude } from "@anthropic-ai/claude-code-sdk";
// New
import { Claude } from "@anthropic-ai/claude-agent-sdk";FAQ
Q: What is the Claude Agent SDK? A: Anthropic's official TypeScript SDK that provides the same capabilities as Claude Code (file editing, command execution, codebase understanding) in a programmable API for building custom AI agents.
Q: Is it free? A: The SDK is free to install. You pay for Anthropic API usage (Claude model tokens). Governed by Anthropic's Commercial Terms of Service.
Q: How is this different from the regular Anthropic SDK?
A: The regular SDK (@anthropic-ai/sdk) sends messages to Claude models. The Agent SDK adds the full agent loop — tool execution, file system access, shell commands, and multi-step autonomous workflows.