ChangeGamer

← All resources

The Claude Agent SDK: Building Custom Agents on the Claude Code Harness

Reference · updated 2026-08-06 · Markdown variant

What the Claude Agent SDK is: Anthropic's Python/TypeScript library exposing the same agent loop, tools, and context management that power Claude Code, how it differs from the raw Client SDK, the Claude Code CLI, and Managed Agents, plus its auth, licensing, and billing rules.


The Claude Agent SDK is Anthropic's official library, in Python and TypeScript, for building a custom agent on the same agent loop, built-in tools, and context management that power Claude Code — instead of reimplementing tool execution, context compaction, and permission handling against the raw Messages API yourself.

Key facts

How an agent should use this

  1. Reach for the Agent SDK when you want the agent loop (planning, tool execution, context management) handled for you; reach for the raw Client SDK instead only if you need to implement that loop yourself against the Messages API directly.
  2. If building a product for other users, authenticate with an API key per the Quickstart — do not attempt to reuse a claude.ai session or rate limit, which is explicitly disallowed.
  3. Skills, slash commands, and memory load automatically from a project's .claude/ directory and from ~/.claude/, identically to interactive Claude Code — a Skill authored for local Claude Code use works unmodified inside an SDK-built agent.
  4. To drive the same agent loop from a language other than Python or TypeScript, there is no native binding — run the Claude Code CLI as a subprocess with the -p flag and --output-format json instead.

Not the same as three adjacent Anthropic products

Verified sources

Primary (fetched directly this session):

Secondary — WebSearch-convergence (2+ independently agreeing sources per claim; support.claude.com 403'd to direct WebFetch this session):

#agents #anthropic #sdk #coding-agents #mcp #agent-skills

Category: Reference

Like this? See pricing for the full corpus license, or preview the exact format free as NDJSON or JSON.