Claude Agent SDK — MCP protocol
Official SDK for building custom agents based on Claude
Basic Information
| Program name | Claude Agent SDK (Cloud Agent SDK) |
|---|---|
| One-line introduction | Official SDK for building custom agents based on Claude |
| Developed and maintained by | Anthropic |
| Official homepage | https://www.anthropic.com/ |
| Official documentation | https://docs.anthropic.com/en/api/agent-sdk |
| Installation and distribution | pip install claude-agent-sdk |
| Runtime environment | Python 3.10+ · Node.js 18+ |
| License | MIT License |
| Stable version | PyPI 0.2.168 (confirmed 2026-10) — Confirmed on 2026-10-18 |
| GitHub repository | https://github.com/anthropics/claude-code |
| Category | MCP protocol (Tags: MCP, Agent, Claude, Anthropic, SDK) |
What is this program?
Claude Agent SDK is the official SDK for programmatically using the same runtime as the Claude Code terminal agent. It provides an agent loop that includes tool calling, file operations, and MCP connections.
It is available in both Python and TypeScript versions, and existing Claude Code skills and MCP settings can be reused as-is.
What problems does it solve?
- ('In custom agents', 'When you need to build a special-purpose agent based on Claude', 'Use the official agent runtime')
- ('In automation', 'When you need to control a terminal agent from code', 'Call the agent loop with the SDK')
Key Features
Agent loop
Provides the same agent loop as Claude Code
- Use case: Proven agent behavior
- Outcome: Tool calling and retries
- Limitations: Token cost management
MCP and skill integration
Reuse existing MCP and skill settings
- Use case: Extending agent capabilities
- Outcome: Shared configuration
- Limitations: Be careful with permission settings
Installation and Execution
pip
Install with pip.
pip install claude-agent-sdk
npm
Install with npm.
npm install @anthropic-ai/claude-agent-sdk
Practical Usage Example
Calling the agent
Run an agent with the SDK.
from claude_agent_sdk import query
Advantages and Limitations
Advantages
- Official Anthropic SDK
- Reuses the Claude Code runtime
- MIT License
Things to consider before use
- Incurs Claude API costs
- Requires an Anthropic account
Comparison with Similar Programs
| Program | Features | Suitable for |
|---|---|---|
| Claude Code CLI | Direct terminal use | Interactive development |
| OpenAI Agents | OpenAI agent SDK | GPT-based |
Official Resources and Further Learning
- Official homepage — https://www.anthropic.com/
- Official documentation / knowledge base — https://docs.anthropic.com/en/api/agent-sdk
- Installation & distribution — pip install claude-agent-sdk
- Release notes — https://github.com/anthropics/claude-code/releases
- Source / development resources — https://github.com/anthropics/claude-code
Version and supported environment information was confirmed on the official site as of 2026-10-18. Installation commands may vary depending on your distribution and version, so please also check the official installation documentation.
Actual Execution Screen
Synthetic example — not an actual execution result. The screen is a synthetic example and not an actual execution result.
!Claude Agent SDK usage example
A server in actual operation
Source (HTML): https://games.aidebatehub.com/programs/mcp/protocol/claude-agent-sdk.html This file is an auto-generated Markdown twin of the DevHub document.
AI Knowledge Hub
Visitor Comments