-p flag and --output-format json. For the thinking behind agent harness design, see A harness for every task: dynamic workflows in Claude Code on the blog.
Quickstart
Build a bug-fixing agent in minutes
Example agents
Email assistant, research agent, and more
Get started
1
Install the SDK
- TypeScript
- Python (uv)
- Python (pip)
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.
2
Set your API key
Get an API key from the Console, then set it as an environment variable.On macOS or Linux:On Windows PowerShell:The SDK also supports authentication via third-party API providers:
- Amazon Bedrock: set
CLAUDE_CODE_USE_BEDROCK=1environment variable and configure AWS credentials - Claude Platform on AWS: set
CLAUDE_CODE_USE_ANTHROPIC_AWS=1andANTHROPIC_AWS_WORKSPACE_ID, then configure AWS credentials - Google Cloudâs Agent Platform: set
CLAUDE_CODE_USE_VERTEX=1environment variable and configure Google Cloud credentials - Microsoft Azure: set
CLAUDE_CODE_USE_FOUNDRY=1environment variable and configure Azure credentials
Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK. Please use the API key authentication methods described in this document instead.
3
Run your first agent
This example creates an agent that lists files in your current directory using built-in tools.
Capabilities
Everything that makes Claude Code powerful is available in the SDK:- Built-in tools
- Hooks
- Subagents
- MCP
- Permissions
- Sessions
Your agent can read files, run commands, and search codebases out of the box. Key tools include:
For the full list, including scheduling and worktree tools, see the tools reference.This example creates an agent that searches your codebase for TODO comments:
Claude Code features
The SDK also supports Claude Codeâs filesystem-based configuration. With default options the SDK loads these from.claude/ in your working directory and ~/.claude/. To restrict which sources load, set setting_sources (Python) or settingSources (TypeScript) in your options.
Compare the Agent SDK to other Claude tools
The Claude Platform offers multiple ways to build with Claude. Hereâs how the Agent SDK fits in:- Agent SDK vs Client SDK
- Agent SDK vs Claude Code CLI
- Agent SDK vs Managed Agents
The Anthropic Client SDK gives you direct API access: you send prompts and implement tool execution yourself. The Agent SDK gives you Claude with built-in tool execution.With the Client SDK, you implement a tool loop. With the Agent SDK, Claude handles it:
Changelog
View the full changelog for SDK updates, bug fixes, and new features:- TypeScript SDK: view CHANGELOG.md
- Python SDK: view CHANGELOG.md
Reporting bugs
If you encounter bugs or issues with the Agent SDK:- TypeScript SDK: report issues on GitHub
- Python SDK: report issues on GitHub
Branding guidelines
For partners integrating the Claude Agent SDK, use of Claude branding is optional. When referencing Claude in your product: Allowed:- âClaude Agentâ (preferred for dropdown menus)
- âClaudeâ (when within a menu already labeled âAgentsâ)
- â Powered by Claudeâ (if you have an existing agent name)
- âClaude Codeâ or âClaude Code Agentâ
- Claude Code-branded ASCII art or visual elements that mimic Claude Code
License and terms
Use of the Claude Agent SDK is governed by Anthropicâs Commercial Terms of Service, including when you use it to power products and services that you make available to your own customers and end users, except to the extent a specific component or dependency is covered by a different license as indicated in that componentâs LICENSE file.Next steps
Quickstart
Build an agent that finds and fixes bugs in minutes
Example agents
Email assistant, research agent, and more
TypeScript SDK
Full TypeScript API reference and examples
Python SDK
Full Python API reference and examples