dotsagent.io
ภาษา:ไทย
เฟรมเวิร์ก · 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 · 8,200 ดาว
ตัวเลือกแบบโฮสต์
Claude Managed Agents
Anthropic เป็นผู้โฮสต์ harness ส่วน sessions จะทำงานใน sandbox ที่ Anthropic จัดการหรือที่คุณโฮสต์เอง

Quickstart

ติดตั้งแพ็กเกจ ตั้งค่าข้อมูลรับรอง แล้วเรียกใช้ agent ตัวอย่างที่เล็กที่สุดจากเอกสารทางการ Model ID เป็นค่าที่เอกสารใช้ และอาจยังไม่ได้เปิดใช้งานในบัญชีของคุณ

Python

ติดตั้ง
pip install claude-agent-sdk

ต้องใช้ ANTHROPIC_API_KEY

Python
import 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())

แหล่งข้อมูล Quickstart

TypeScript

ติดตั้ง
npm install @anthropic-ai/claude-agent-sdk

ต้องใช้ ANTHROPIC_API_KEY

TypeScript
import { 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
}

แหล่งข้อมูล Quickstart

ฟีเจอร์

ใช้ได้กับทุกโมเดลไม่รองรับ 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

ทางเลือกในภาษาเดียวกัน

แหล่งข้อมูล

  1. code.claude.com/docs/en/agent-sdk/overview
  2. code.claude.com/docs/en/agent-sdk/quickstart
  3. code.claude.com/docs/en/agent-sdk/observability
  4. code.claude.com/docs/en/bedrock-vertex
  5. pypi.org/pypi/claude-agent-sdk/json
  6. registry.npmjs.org/@anthropic-ai%2fclaude-agent-sdk
  7. api.github.com/repos/anthropics/claude-agent-sdk-python
  8. api.github.com/repos/anthropics/claude-agent-sdk-typescript