เฟรมเวิร์ก · Anthropic
ภาพรวม Claude Agent SDK
SDK ของ Anthropic เปิดให้ใช้ harness ที่อยู่เบื้องหลัง Claude Code ผ่านโปรแกรม Python หรือ TypeScript ของคุณเอง โดยมีเครื่องมือสำหรับไฟล์และ shell, permissions, hooks, subagents และ skills ต่างจากตัวเลือกอื่นในรายการนี้ตรงที่รองรับเฉพาะ Claude models และการใช้งานอยู่ภายใต้ Commercial Terms ของ Anthropic
เหมาะสำหรับ: แอปที่ต้องการให้ Claude ทำงานจริงกับ filesystem โดยคุณควบคุม permissions ของเครื่องมือได้
ข้อมูลสำคัญ
- ผู้ดูแล
- Anthropic
- ภาษา
- Python, TypeScript
- ไลเซนส์
- Anthropic Commercial Terms
- เวอร์ชันล่าสุด
Python 0.2.163 / TypeScript 0.3.286· 30 กันยายน 2569- Repository
- anthropics/claude-agent-sdk-python
- ตัวเลือกแบบโฮสต์
- Claude Managed Agents
Quickstart
ติดตั้งแพ็กเกจ ตั้งค่าข้อมูลรับรอง แล้วเรียกใช้ agent ตัวอย่างที่เล็กที่สุดจากเอกสารทางการ Model ID เป็นค่าที่เอกสารใช้ และอาจยังไม่ได้เปิดใช้งานในบัญชีของคุณ
Python
pip install claude-agent-sdkimport asyncio
from claude_agent_sdk import query, ClaudeAgentOptions
async def main():
async for message in query(
prompt="Find and fix the bug in auth.py",
options=ClaudeAgentOptions(allowed_tools=["Read", "Edit", "Bash"]),
):
print(message) # Claude reads the file, finds the bug, edits it
asyncio.run(main())TypeScript
npm install @anthropic-ai/claude-agent-sdkimport { query } from "@anthropic-ai/claude-agent-sdk";
for await (const message of query({
prompt: "Find and fix the bug in auth.ts",
options: { allowedTools: ["Read", "Edit", "Bash"] }
})) {
console.log(message); // Claude reads the file, finds the bug, edits it
}ฟีเจอร์
| ใช้ได้กับทุกโมเดล | ไม่ | รองรับ Claude เท่านั้น ผ่าน Anthropic, Bedrock, Google Cloud หรือ Foundry |
|---|---|---|
| MCP client | ใช่ | ตั้งค่าได้ด้วยตัวเลือก mcpServers; plugins สามารถรวม MCP servers ไว้ด้วยกันได้ |
| MCP server | ยังไม่ยืนยัน | |
| หลาย agent | ใช่ | Subagents รับผิดชอบงานย่อยที่เฉพาะเจาะจง |
| การทำงานต่อเนื่องแบบทนทาน | ยังไม่ยืนยัน | กลับมาใช้ sessions ต่อหรือแยกเป็น fork ได้ แต่ไม่มี durable engine |
| การอนุมัติโดยมนุษย์ | ใช่ | Permission modes กำหนดว่าเครื่องมือใดต้องได้รับอนุมัติก่อนใช้ |
| Tracing | ใช่ | ส่งออกข้อมูลผ่าน OpenTelemetry; traces ยังอยู่ใน beta |
| Evals | ไม่ |
การเปลี่ยนแปลงล่าสุด
- เปลี่ยนชื่อจาก Claude Code SDK แล้ว โดยมีคู่มือการย้ายให้ใช้งาน
- ตอนนี้ SDK ทั้งสองตัวมาพร้อม Claude Code binary แบบ native
- ตั้งแต่ 15 June 2026 การใช้ SDK บน subscription plans จะใช้เครดิต Agent SDK รายเดือนแยกต่างหาก
- แอปของบุคคลที่สามห้ามให้เข้าสู่ระบบด้วย claude.ai เว้นแต่จะได้รับอนุมัติจาก Anthropic