Skip to content
ML2
Multi-Step Agent SetupsToolframeworkAnthropicagents

Claude Agent SDK

Added Updated

Published Last verified Released

Our verdict

If Claude Code already does good work on your repo, the Agent SDK is the shortest path to running the same agent inside your own app, script or CI job: same built-in tools, permissions, sessions and hooks, in Python or TypeScript. You pay per token with an API key (claude.ai logins aren't allowed for third-party products), and it ties you to Claude models.

Who it's for
Developers building custom agents on Claude
Leverage
Production agent loop out of the box
Effort
Medium
Date added

What Claude Agent SDK does

The Claude Agent SDK packages Claude Code as a library. You call query() with a prompt and options, and the SDK runs the agent loop for you: Claude plans, calls built-in tools (read, write and edit files, run commands, search the web), sees the results and keeps going until the task is done, streaming each step back to your code. It also supports hooks, subagents, MCP servers and plugins, and loads skills, commands and memory from your project's .claude/ folder the same way Claude Code does.

How builders use Claude Agent SDK

  • Install with npm install @anthropic-ai/claude-agent-sdk or pip install claude-agent-sdk, then set ANTHROPIC_API_KEY.
  • Start read-only with tools Read, Glob and Grep for an analysis or Q&A bot, then add Edit and Bash once you trust it.
  • Run a code-review or fix-the-build agent in CI, with acceptEdits permission mode in a throwaway checkout.
  • Connect databases, browsers or internal APIs through MCP servers instead of writing tool code.
  • Use sessions to resume or fork a conversation for multi-turn agents such as a support bot.

Which Claude option to use

From Anthropic's Agent SDK overview, checked 17 Nov 2026.

You want toUse
Embed Claude Code's agent in your own Python or TypeScript appAgent SDK
Work interactively or run one-off tasks in a terminalClaude Code CLI
Call the Claude API and write the tool loop yourselfClient SDK
Have Anthropic host the agent loop and sandboxManaged Agents
Drive the loop from another languageThe CLI as a subprocess with -p and --output-format json

A first agent in practice

Anthropic's quickstart, checked 17 Nov 2026.

  • Needs Node.js 18.14+ or Python 3.10+. Both packages bundle a native Claude Code binary, so most installs need nothing else.
  • The demo agent gets the prompt "Review utils.py for bugs that would cause crashes. Fix any issues you find." with tools Read, Edit and Glob, and finds a divide-by-zero on an empty list and a crash on a missing user.
  • allowedTools pre-approves tools but doesn't restrict them; pass tools instead to limit which built-in tools the agent can call at all.
  • The SDK reads the key from the process environment and doesn't load .env files on its own.
  • Amazon Bedrock, Google Cloud, Microsoft Foundry and Claude Platform on AWS work through environment variables such as CLAUDE_CODE_USE_BEDROCK=1.

Claude Agent SDK: limits and gotchas

  • Claude models only. If you need to switch between model providers, a provider-agnostic framework fits better.
  • Usage is billed through an API key or a cloud provider. Unless Anthropic has approved it, you can't let users sign in with claude.ai or use their subscription limits in your product.
  • Branding rules apply: your product can say "Powered by Claude" but can't be called Claude Code or mimic its look.
  • Built-in tools can edit files and run shell commands, so set permissions and a sandbox before pointing it at anything important.
  • Use is governed by Anthropic's Commercial Terms of Service, including when you ship it to your own customers.

Claude Agent SDK compared with other tools here

  • OpenAI Agents SDK: a lighter framework with handoffs and guardrails, where you define the tools yourself.
  • LangGraph: graph-based workflows with checkpoints and human approval steps, for long or branching processes.
  • CrewAI: role-based crews of agents in Python, for multi-agent setups across model providers.
  • Claude Code subagents: if you only need specialist helpers inside Claude Code itself, not a separate app.
  • Claude Code GitHub Actions: the ready-made route for agents in pull requests and issues, without writing SDK code.
  • E2B sandboxes: isolated cloud machines to run an agent's code safely.

When to pick Claude Agent SDK

  • Pick the Claude Agent SDK if Claude Code already works well on your codebase and you want the same agent inside your own tool or pipeline.
  • Pick the OpenAI Agents SDK, LangGraph or CrewAI if you need to switch model providers or want to define every tool yourself.
  • Pick Claude Code GitHub Actions if all you want is an agent that responds in PRs and issues.
  • Pick Managed Agents if you'd rather Anthropic hosts the loop and sandbox.

How it compares

If you need to switch model vendors, the OpenAI Agents SDK keeps a small loop with handoffs and guardrails and reaches other providers through adapters. TypeScript teams that want agents, workflows and memory in one framework should also look at Mastra. See how the Claude Agent SDK compares with other agent SDKs, with languages, licences, MCP support, tracing and hosting side by side.

Claude Agent SDK questions

Is the Agent SDK the same as the Claude Code SDK?

It's the renamed successor. Anthropic publishes a migration guide from the Claude Code SDK packages to the Agent SDK.

Which languages does it support?

Python and TypeScript. From other languages you can run the Claude Code CLI as a subprocess with -p and --output-format json.

Can my users log in with their Claude subscription?

Not unless Anthropic has approved it. Third-party products built on the SDK should use API key authentication.

Does it load my CLAUDE.md, skills and hooks?

Yes. Skills, commands and memory load from the project's .claude/ folder and ~/.claude/, the same as Claude Code.

Related discoveries

See the newest picks →
  • ToolMulti-Step Agent Setups

    LangGraph

    Low-level framework for stateful, controllable agent workflows.

    Effort: High#Open source

  • ToolMulti-Step Agent Setups

    CrewAI

    An open-source Python framework for role-based agent crews, plus Flows for step-by-step control.

    Effort: Medium#Open source

Get the best new A.I. picks in your inbox

The best new agent workflows and tools we’ve vetted, with a clear verdict on each. Short, occasional, useful.

More in Multi-Step Agent Setups →

Free. No spam. Unsubscribe anytime.