Agent SDK Deep Dive
Build custom AI agents with the Anthropic Agent SDK. Covers both TypeScript and Python SDKs, custom tools, MCP integration, sub-agents, streaming, and production deployment.
Prerequisites: Familiarity with the Claude API (complete Claude API Essentials first).
Steps
- Agent SDK — Overview
anthropic-platform
intermediate
Introduction to Anthropic's Agent SDK for building custom AI agents with tool use, MCP, and sub-agents.
Start here to understand what the Agent SDK provides beyond the raw Messages API. It handles the agentic loop, tool execution, and multi-turn orchestration that you would otherwise build yourself.
- Quickstart
anthropic-platform
beginner
Get a working agent running in minutes. Focus on the AgentConfig pattern since it is the central abstraction — everything else (tools, subagents, hooks) plugs into this configuration object.
- Typescript
anthropic-platform
intermediate
The TypeScript SDK uses generics extensively for type-safe tool definitions. If you are a TypeScript shop, start here instead of the Python guide — the APIs are equivalent but the type system catches configuration errors at compile time.
- Python
anthropic-platform
intermediate
The Python SDK is async-first using asyncio, so make sure your runtime supports it. Python typically receives new Agent SDK features first, making it the safer choice for accessing the latest capabilities.
- Custom Tools
anthropic-platform
intermediate
Tools are what make agents useful beyond conversation. The quality of your JSON Schema definitions directly determines how reliably the agent invokes your tools — invest time in clear parameter names and descriptions.
- Mcp
anthropic-platform
intermediate
MCP integration lets your agent use any compatible tool server without writing custom tool code. This is the extensibility story — read this after custom tools to understand when to build tools inline versus connecting an MCP server.
- Subagents
anthropic-platform
intermediate
Subagents enable delegation patterns where a coordinator agent farms out tasks to specialized workers. Compare this with OpenAI's handoff pattern — Anthropic uses delegation with context passing while OpenAI uses explicit transfer of control.
- Streaming Vs Single Mode
anthropic-platform
intermediate
Single-mode is simpler to implement and debug, while streaming gives users real-time feedback. Start with single-mode for development, then switch to streaming for production UIs — the migration path is straightforward.
- Streaming Output
anthropic-platform
intermediate
This covers the event types you will receive during streaming execution. Understanding the event lifecycle (turn_start, tool_use, tool_result, turn_end) is essential for building responsive agent UIs that show progress.
- Hooks
anthropic-platform
intermediate
Hooks let you intercept agent behavior at key lifecycle points — before/after tool calls, on errors, and at turn boundaries. They are the right place for logging, guardrails, and approval workflows without modifying agent logic.
- Permissions
anthropic-platform
intermediate
Permissions control what an agent can do at the tool level. This is critical for production — develop with permissive settings but deploy with least-privilege, or a prompt injection could escalate through your tool surface area.
- Hosting
anthropic-platform
intermediate
Agent runs can take seconds to minutes, which is fundamentally different from typical API request durations. Focus on the timeout and concurrency considerations — these affect your infrastructure choices more than anything else.
- Secure Deployment
anthropic-platform
intermediate
Agent security goes beyond API security because agents autonomously execute tools. Focus on the prompt injection mitigations and input validation guidance — these are the primary attack vectors for deployed agents.