Claude Agent SDK
PaketClaude Code's agent loop and built-in tools as a Python and TypeScript library
- Erişim
- Anthropic API key
Hakkında
The Claude Agent SDK packages Claude Code as a library: an agent loop with file, shell and web tools, hooks, subagents, MCP and sessions. It runs in a process you operate and works only with Claude models, billed as Claude API usage.
Neler yapabilirsin
- Build a coding agent that reads, edits and fixes files in a repo
- Automate tasks with shell commands, web search and MCP tools
- Run subagents with hooks and permission controls in your own app
Başlarken
- Install @anthropic-ai/claude-agent-sdk or pip install claude-agent-sdk
- Set ANTHROPIC_API_KEY in your environment
Örnek kod
import { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Review utils.py for bugs that would cause crashes. Fix any issues you find.",
options: { allowedTools: ["Read", "Edit", "Glob"], permissionMode: "acceptEdits" },
})) {
if (message.type === "result") console.log(`Done: ${message.subtype}`);
}Ayrıntılar
- Barındırma
- Kendi bilgisayarında
- Kullanılabildiği yerler
- Tüm dünya
- Resmi SDK'lar
- Python, JavaScript/TypeScript
- MCP sunucusu
- Yok
- Entegrasyonlar
- Claude