claude-agent-sdk-basics
Installation
SKILL.md
Claude Agent SDK Basics
Anthropic provides two official agent SDKs: one for Python and one for TypeScript. Both wrap the Claude API with agent-specific abstractions: tool use, multi-turn conversation loops, agent handoffs, and guardrails. Use the SDK instead of raw API calls when building agents that need tool use, multi-step reasoning, or orchestration.
When to Use the SDK vs Raw API
| Scenario | Use SDK | Use raw API |
|---|---|---|
| Agent with tools (search, CRM read/write, enrichment) | Yes | No |
| Multi-turn conversation loop (agent reasons, acts, observes, repeats) | Yes | No |
| Simple single-turn generation (write one email from a prompt) | No | Yes |
| Multi-agent orchestration with handoffs | Yes | No |
| Batch processing with no tool use (score 1,000 leads from CSV) | No | Yes (with Batch API) |
| Streaming responses to a UI | Either | Either |
Rule of thumb: If the agent needs to take actions (call tools, make decisions, loop), use the SDK. If you're generating a single output from a single prompt, the raw API is simpler.