Summary
The Claude Agent SDK is a Python and TypeScript library that embeds Claude Code's agent loop in your own process. You supply the prompt and the hosting; the SDK spawns a Claude Code subprocess and streams back its messages.
- Best for
- Developers already building on Claude (or Claude Code) who want its exact agent loop, tools and context management as a callable library, and are comfortable being single-vendor on Anthropic in exchange for the tightest possible integration with Claude Code's own capabilities.
- Not for
- Teams that need genuine multi-provider model flexibility in one agent loop. OpenAI Agents SDK, Google ADK and Microsoft Agent Framework all reach other vendors' models through a LiteLLM-style integration; the Claude Agent SDK doesn't, by Anthropic's own design decision.
- From
- $1/million input tokensmetered on usage
- Free tier
- PartlyThe npm and PyPI packages install free and Console signup is self-serve, but running an agent bills Anthropic API tokens; the docs publish no free token allowance for the SDK.
What it does
- Writes code
- YesThe agent calls the same file tools Claude Code uses, so it authors and edits code from a prompt.
An agent is an application that completes a task by planning its own steps and calling tools that read files, run commands, or edit code.
code.claude.com/docs/en/agent-sdk/overv… - Debugs and fixes
- YesThe vendor's own quickstart is an agent that locates crash bugs in a file and edits the fix in.
Use the Agent SDK to build an AI agent that reads your code, finds bugs, and fixes them, all without manual intervention.
code.claude.com/docs/en/agent-sdk/quick… - Writes tests
- YesThe agent-loop walkthrough has the agent updating and re-running a project's tests alongside its edits.
A complex task ("refactor the auth module and update the tests") can chain dozens of tool calls across many turns, reading files, editing code, and…
code.claude.com/docs/en/agent-sdk/agent… - Reviews code
- YesThe CLI surface is documented as a reviewer over a diff piped in from git or gh.
You can wrap a non-interactive call in a script to use Claude as a project-specific linter or reviewer.
code.claude.com/docs/en/headless - Whole-codebase work
- PartlyRepo-scale work is handled by fanning out subagents and by automatic compaction; no whole-repo index is claimed.
A research-assistant subagent can explore dozens of files without any of that content accumulating in the main conversation.
code.claude.com/docs/en/agent-sdk/subag… - Ships it
- PartlyBash gives it git and script execution, so a deploy command is reachable, but the SDK documents no deployment surface of its own.
Run shell commands, scripts, git operations
code.claude.com/docs/en/agent-sdk/agent…
How much it does unattended
- Runs autonomously
- YesWith no turn or budget cap the loop runs to completion without a human in it.
Without limits, the loop runs until Claude finishes on its own, which is fine for well-scoped tasks but can run long on open-ended prompts ("improve…
code.claude.com/docs/en/agent-sdk/agent… - Multi-agent
- YesSubagents are first-class: defined in code or as files, run concurrently, each with its own context and tool subset.
Parallelization: multiple subagents can run concurrently, so independent subtasks finish in the time of the slowest one rather than the sum of all of…
code.claude.com/docs/en/agent-sdk/subag… - Agent permissions
- YesSix permission modes plus allow/deny rules, hooks and a canUseTool callback, evaluated in a documented six-step order.
The Claude Agent SDK provides permission controls to manage how Claude uses tools. Use permission modes and rules to define what's allowed…
code.claude.com/docs/en/agent-sdk/permi…
Which models it runs on
- Claude
- YesClaude is the only model family; you can pin a specific Claude model per session.
Set it explicitly (for example, model="claude-sonnet-5") to pin a specific model or to use a smaller model for faster, cheaper agents.
code.claude.com/docs/en/agent-sdk/agent… - GPT
- NoEvery documented model path is a Claude endpoint: the Anthropic API or a cloud provider's Claude endpoint.
The SDK needs outbound HTTPS to api.anthropic.com, or to your provider's regional endpoint when running on Amazon Bedrock or Google Cloud's Agent…
code.claude.com/docs/en/agent-sdk/hosti… - Open models
- NoThe enumerated model aliases are all Claude models; no open-weight option appears anywhere in the option reference.
Accepts an alias such as 'fable', 'opus', 'sonnet', 'haiku', 'inherit', or a full model ID.
code.claude.com/docs/en/agent-sdk/subag… - Model choice
- PartlyYou choose the model per session and per subagent, but only from Claude models.
If you don't set model, the SDK uses Claude Code's default, which depends on your authentication method and subscription.
code.claude.com/docs/en/agent-sdk/agent…
Where you use it
- In your editor
- NoThe SDK ships as a library you embed; the editor and terminal surfaces belong to Claude Code, which the same table routes interactive work to.
The SDK is available as a library for Python and TypeScript only.
code.claude.com/docs/en/agent-sdk/overv… - On the command line
- Yesclaude -p is documented as the SDK's CLI surface, with JSON and stream-JSON output for scripted callers.
It's available as a CLI for scripts and CI/CD, or as Python and TypeScript packages for full programmatic control.
code.claude.com/docs/en/headless - In your pipeline
- YesBare mode exists for CI reproducibility, and exit codes plus init-event fields let a pipeline fail on a bad run.
Bare mode is useful for CI and scripts where you need the same result on every machine.
code.claude.com/docs/en/headless - In a browser
- NoYou host the SDK yourself; the hosted surface is Managed Agents, which the vendor names as a separate product.
Hosted REST API, a separate product from the Agent SDK. Anthropic runs the agent and the sandbox.
code.claude.com/docs/en/agent-sdk/overv…
Whose machine it runs on
- Self-hosted
- YesSelf-hosting is the default: your process spawns a claude CLI subprocess with your working directory and disk.
This page covers self-hosting on your own infrastructure.
code.claude.com/docs/en/agent-sdk/hosti… - Open source
- PartlyUse of the SDK is placed under Anthropic's Commercial Terms of Service rather than an open-source licence.
Use of the Claude Agent SDK is governed by Anthropic's Commercial Terms of Service, including when you use it to power products and services that you…
code.claude.com/docs/en/agent-sdk/overv…
What it costs to run
- How it meters
- YesMetered per million tokens against an API key, with cache-write, cache-read and output rates priced separately.
Claude Haiku 4.5 $1 / MTok $1.25 / MTok $2 / MTok $0.10 / MTok $5 / MTok
platform.claude.com/docs/en/about-claud… - Free tier
- PartlySignup and key creation are self-serve with no sales call, but every run bills API tokens and no free token allowance is published for the SDK.
Get an API key from the Claude Console, then set it as an environment variable in the shell where you'll run your agent
code.claude.com/docs/en/agent-sdk/quick… - API access
- YesThe product is itself a library for your stack, in Python or TypeScript, with a CLI fallback for other languages.
A library that runs the agent loop in your own process, in Python or TypeScript.
code.claude.com/docs/en/agent-sdk/overv… - MCP server
- PartlyThe agent is a full MCP client over stdio, HTTP/SSE and in-process servers; the docs describe no way to expose your agent as an MCP server another agent could query.
MCP servers can run as local processes, connect over HTTP, or execute directly within your SDK application.
code.claude.com/docs/en/agent-sdk/mcp - Bring your own key
- YesYour own Anthropic key, your own proxy via ANTHROPIC_BASE_URL, or your own cloud through Bedrock, Claude Platform on AWS, Google Cloud or Microsoft Foundry.
the subprocess reads ANTHROPIC_API_KEY from its environment. Supply it from your secret manager, or set ANTHROPIC_BASE_URL to route model calls…
code.claude.com/docs/en/agent-sdk/hosti…
Buying it for a team
- A company can buy it
- YesUsage is bought through a Console organization with members, roles, invites and workspaces, manageable by hand or through the Admin API.
To collaborate with teammates and add members, set up your organization in Console → Settings → Organization.
platform.claude.com/docs/en/manage-clau… - Seat model
- NoBilling is per million tokens on an API key; the docs publish no per-seat price, floor or ceiling for SDK usage.
Claude Haiku 4.5 $1 / MTok $1.25 / MTok $2 / MTok $0.10 / MTok $5 / MTok
platform.claude.com/docs/en/about-claud… - Pooled budget
- YesOne organization funds every key, with per-workspace monthly spend caps and alerts; the SDK also accepts a per-query maxBudgetUsd.
Use workspaces to separate different projects, environments, or teams while maintaining centralized billing and administration.
platform.claude.com/docs/en/manage-clau… - Admin controls
- YesThe embedding app sets allow/deny rules, a permission mode and PreToolUse hooks; organization-managed settings can override a subagent's bypassPermissions.
Organizations can set policies that apply across all users.
code.claude.com/docs/en/agent-sdk/secur… - Audit log
- PartlyAdministrative and API actions land in the Compliance API Activity Feed, which Anthropic must enable for the organization; separately the SDK exports per-user tool and permission events over OpenTelemetry.
The Activity Feed records authentication, chat, file, project, administrative, and platform activity across your organization and returns it in…
platform.claude.com/docs/en/manage-clau… - Single sign-on
- PartlyThe SDK authenticates with API keys or cloud credentials, never a user login; SSO sign-in and SCIM directory sync exist on the Anthropic organization that owns those keys.
An identity provider (such as Okta, Microsoft Entra ID, or JumpCloud) pushed a change through SCIM directory sync.
platform.claude.com/docs/en/manage-clau…
What happens to your code
- Opt out of training
- YesRetained API data is not used for training without express permission, and the opt-in route is a named program an admin must join.
Retained data is never used for model training without your express permission.
platform.claude.com/docs/en/manage-clau… - Data residency
- Partlyinference_geo pins inference to US infrastructure at a 1.1x token price, and workspace storage geo is currently US-only; no other jurisdiction is offered.
Inference runs only in US-based infrastructure.
platform.claude.com/docs/en/manage-clau… - Getting out
- PartlySession transcripts are plain JSONL on your own disk and can be mirrored to S3, Redis or Postgres with a SessionStore adapter; expiry of unused prepaid API credit is not stated in the pages read.
Claude Code stores sessions under ~/.claude/projects/<encoded-cwd>/*.jsonl.
code.claude.com/docs/en/agent-sdk/sessi… - Certifications
- YesSOC 2 Type 2 and ISO 27001 artefacts are published through the Trust Center, and the Claude API offers a self-serve BAA for HIPAA readiness; GDPR is not named on this page.
Learn more and access resources (SOC 2 Type 2 report, ISO 27001 certificate, etc.) at Anthropic Trust Center.
code.claude.com/docs/en/security
34 sourced claims on this page. Checked 2026-09-02. How we check.
Alternatives
Where we would send a reader instead, in that listing's own words.
Open-source Python framework for building agents with tools, handoffs, guardrails, sandboxes and tracing.
Google Agent Development Kit (ADK)
Open-source framework for building, evaluating and deploying AI agents in Python, TypeScript, Go, Java or Kotlin.
Open source agent frameworks plus LangSmith, the platform for tracing, evaluating and deploying agents.
Self-hosted gateway that connects chat apps like WhatsApp, Telegram and Slack to AI agents on your own machine.
Filed under
Sources and updates
The pages we read25
Every fact below comes from the vendor. Nothing here is independently corroborated yet.
- code.claude.com/docs/en/agent-sdk/overview9 fields
- code.claude.com/docs/en/agent-sdk/subagents6 fields
- code.claude.com/docs/en/agent-sdk/agent-loop5 fields
- code.claude.com/docs/en/agent-sdk/quickstart5 fields
- platform.claude.com/docs/en/about-claude/pricing4 fields
- code.claude.com/docs/en/agent-sdk/hosting3 fields
- code.claude.com/docs/en/headless3 fields
- code.claude.com/docs/en/authentication2 fields
- platform.claude.com/docs/en/manage-claude/compliance-activity-feed2 fields
- code.claude.com/docs/en/model-config2 fields
- github.com/anthropics/claude-agent-sdk-typescript1 field
- code.claude.com/docs/en/agent-sdk/claude-code-features1 field
- code.claude.com/docs/en/agent-sdk/cost-tracking1 field
- code.claude.com/docs/en/agent-sdk/mcp1 field
- code.claude.com/docs/en/agent-sdk/observability1 field
- code.claude.com/docs/en/agent-sdk/permissions1 field
- code.claude.com/docs/en/agent-sdk/secure-deployment1 field
- code.claude.com/docs/en/agent-sdk/session-storage1 field
- code.claude.com/docs/en/agent-sdk/sessions1 field
- code.claude.com/docs/en/data-usage1 field
- platform.claude.com/docs/en/manage-claude/admin-api1 field
- platform.claude.com/docs/en/manage-claude/api-and-data-retention1 field
- platform.claude.com/docs/en/manage-claude/data-residency1 field
- platform.claude.com/docs/en/manage-claude/workspaces1 field
- code.claude.com/docs/en/security1 field
Coverage elsewhere1
Updates3
- Capabilities · Commercial terms · Free tier · Price
- Capabilities · Commercial terms · Free tier · Price
- What is,tagline,verdict,editor note,pros,cons,key features,why use,limitations,pricing tiers,faq items
