Claude Agent SDK vs Claude Code: What’s the Difference?

Claude Agent SDK vs Claude Code comparison: what each is for and how billing differs

Short answer: In the Claude Agent SDK vs Claude Code question, Claude Code is the finished tool you use to write code yourself, and the Claude Agent SDK is the library you use to build your own agent on the same engine. Use Claude Code when you want a coding assistant in your terminal, editor or browser. Use the SDK when you want to run Claude’s agent loop inside your own Python or TypeScript application.

They share one engine, which is why people mix them up. Our Claude Code page covers the product and our Claude Agent SDK page covers the library. This post explains where they split. If you also compare other SDKs, see our guide to LangGraph and the Agent SDKs.

Claude Agent SDK vs Claude Code at a glance

Claude CodeClaude Agent SDK
What it isA coding agent you use directlyA library for building your own agents
Who runs itYou, interactivelyYour code, in a process you operate
Where you reach itTerminal, VS Code, JetBrains, desktop app, webPython and TypeScript
Installcurl -fsSL https://claude.ai/install.sh \| bashpip install claude-agent-sdk or npm install @anthropic-ai/claude-agent-sdk
Sign-inClaude subscription, Console account or API keyAPI key (or Bedrock, Vertex or Foundry)
Built-in toolsYesYes, the same ones
Hooks, subagents, MCPYesYes
Best forDaily coding workCustom agents, products and pipelines

What is Claude Code?

Claude Code is an agentic coding tool that reads your codebase, edits files, runs commands and works with your development tools. Anthropic’s docs list four places to use it: the terminal, IDE extensions, a desktop app and the browser. They all connect to the same engine, so your CLAUDE.md files, settings and MCP servers carry across.

You talk to it in plain language. It plans the work, changes files across your project and can create commits and pull requests. It also runs in scripts, for example claude -p "translate new strings into French and raise a PR for review". For the full picture of what it costs, read the pricing section below.

What is the Claude Agent SDK?

The Claude Agent SDK is a library that gives you the same tools, agent loop and context management that power Claude Code, programmable in Python and TypeScript. Anthropic describes it as Claude Code as a library.

You do not click through a terminal session. You write code that sends a prompt, lets Claude decide which tools to call and streams the messages back. Here is the shape of a minimal Python agent from the quickstart:

import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions

async def main():
    async for message in query(
        prompt="Review utils.py for bugs that would cause crashes. Fix any issues you find.",
        options=ClaudeAgentOptions(
            allowed_tools=["Read", "Edit", "Glob"],
            permission_mode="acceptEdits",
        ),
    ):
        print(message)

asyncio.run(main())

You choose which tools the agent may use and how much approval it needs. The SDK handles the orchestration, tool execution and context so you only consume the stream of messages.

How the two relate

The SDK is not a separate brain. Anthropic’s docs say it runs the Claude Code binary, and both the Python and TypeScript packages bundle a native Claude Code binary, so most installs need no separate Claude Code install. Claude Code is the finished application; the SDK is the same machinery with a programming interface.

Anthropic’s own comparison puts it plainly. For interactive development or one-off terminal tasks, use the Claude Code CLI. To embed the agent in your own Python or TypeScript application, use the Agent SDK. To call the Claude API directly and write the tool loop yourself, use the Client SDK. To have Anthropic host the agent, use Managed Agents.

There is one bridge between the two. The CLI has a -p flag with --output-format json, and the docs suggest running it as a subprocess if you want the same agent loop from a language other than Python or TypeScript.

What they share

Both give you the capabilities Anthropic lists for the SDK, which come straight from Claude Code:

  • Built-in tools: read, write and edit files, run commands and search the web.
  • Hooks: run custom code at key points in the agent lifecycle.
  • Subagents: spawn specialized agents for focused subtasks.
  • MCP: connect external tools through the Model Context Protocol. Our guide to adding MCP servers to Claude Code shows the Claude Code side.
  • Permissions and sessions: control what runs automatically and keep context across exchanges.
  • Skills, commands and memory: load from your project’s .claude/ folder, the same as Claude Code.

If you already know Claude Code, the SDK will feel familiar. The ideas are the same; only the way you drive them changes.

Pricing and billing side by side

This is where the two differ most. Both use Anthropic’s models, but you pay differently.

Claude CodeClaude Agent SDK
The softwareIncluded with paid Claude plansFree to install
Pro$20 a month billed monthly, $17 a month billed yearly ($200 up front)Not used
MaxFrom $100 a month, at 5x or 20x Pro’s usageNot used
Team Standard seat$25 a month billed monthly, $20 a month billed yearlyNot used
Team Premium seat$125 a month billed monthly, $100 a month billed yearlyNot used
Enterprise$20 a seat a month billed yearly, plus usage at API ratesNot used
API usageOptional, per tokenPer token on your API key

On Anthropic’s pricing page the Free plan does not include Claude Code, and every plan has usage limits that reset on a rolling five-hour window. Claude Code shares one usage pool with the rest of your plan.

The SDK is billed through the API instead. As of our check, Sonnet 5.5 costs $2 per million input tokens and $10 per million output tokens. Opus 5.5 costs $4 and $20. Anthropic’s docs also say that, unless previously approved, third-party developers may not offer claude.ai login or rate limits for products built on the SDK, so use API key authentication.

The Agent SDK works with cloud providers too. You can set CLAUDE_CODE_USE_BEDROCK=1 for Amazon Bedrock, CLAUDE_CODE_USE_VERTEX=1 for Google Cloud’s Agent Platform or CLAUDE_CODE_USE_FOUNDRY=1 for Microsoft Foundry.

Where each one wins

Claude Code wins when you are the developer. It needs no code from you, it works inside your editor and it gives you diffs to review. It also has desktop and web surfaces, scheduled tasks and Slack and GitHub integrations that you would have to build yourself with the SDK.

The Agent SDK wins when the agent is the product. You control the prompt, the tools, the permissions and where it runs. That suits a support bot, a CI step, an internal tool or a feature inside your own app. You can package skills, agents, hooks and MCP servers as plugins and load them from a local path.

What neither does

Neither works with models from other companies. Both are built around Claude models, so if you want one agent to switch between providers, look at a framework such as our LangGraph page instead.

The SDK is not a no-code builder. You write and host the code, handle API keys and decide how to deploy. Claude Code is not a library, so you cannot embed it in a product you sell. Anthropic’s branding rules also say that products built on the SDK must not call themselves “Claude Code” or “Claude Code Agent”.

On licensing, Anthropic says use of the SDK is governed by its Commercial Terms of Service. The Python repository’s sidebar lists MIT, but the README says components may carry other licenses. Read the terms before you ship.

Which should you choose?

  • You want help writing code in your own project today: Claude Code.
  • You want an agent in your CI pipeline, app or backend: Agent SDK.
  • You want to try things before writing code: start with Claude Code, then move to the SDK when you know the workflow.
  • You need a plan with predictable monthly cost: Claude Code on a paid plan.
  • You need to bill per request or per customer: Agent SDK with API keys.
  • You work in another language such as Go or Rust: run the Claude Code CLI as a subprocess, or use the Client SDK.
  • You want custom tools as Python functions: Agent SDK. The Python README shows custom tools running as in-process MCP servers.
  • You want Anthropic to host the agent: neither; look at Managed Agents.

Many teams use both. Developers use Claude Code every day and the same team ships an SDK-based agent for a repeatable job.

FAQ

Is the Claude Agent SDK the same as Claude Code?

No, but they share an engine. Claude Code is the finished coding tool you use directly. The Agent SDK is a Python and TypeScript library that exposes Claude Code’s tools, agent loop and context management so you can build your own agents.

Is the Claude Agent SDK free?

The library is free to install with pip install claude-agent-sdk or npm install @anthropic-ai/claude-agent-sdk. You pay for the tokens your agent uses through the Claude API, or through Bedrock, Vertex or Foundry.

Do I need Claude Code to use the Agent SDK?

Usually not. Both SDK packages bundle a native Claude Code binary. A few installs have no bundled binary, such as the Python source distribution on ARM64 Windows. In that case you install Claude Code natively.

Can I use my Claude Pro or Max plan with the Agent SDK?

Anthropic says that, unless previously approved, third-party developers cannot offer claude.ai login or rate limits in products built on the SDK. Use API key authentication as the quickstart describes.

What languages does the Claude Agent SDK support?

Python (3.10 or newer) and TypeScript (Node.js 18.14 or newer). For other languages, run the CLI as a subprocess with the -p flag and --output-format json.

Which one should a beginner use?

Claude Code. You install it, run claude in a project folder and describe what you want. Move to the SDK when you want to automate a task inside your own software.

Keep reading

Facts here come from Anthropic’s Agent SDK overview, the Agent SDK quickstart and the Claude Code overview, checked in October 2026. To see how Claude Code compares with other coding tools, read our Claude Code vs Cowork post or browse the best AI coding agents.

Is the Claude Agent SDK the same as Claude Code?
No, but they share an engine. Claude Code is the finished coding tool you use directly. The Agent SDK is a Python and TypeScript library that exposes Claude Code’s tools, agent loop and context management so you can build your own agents.
Is the Claude Agent SDK free?
The library is free to install with pip install claude-agent-sdk or npm install @anthropic-ai/claude-agent-sdk. You pay for the tokens your agent uses through the Claude API, or through Bedrock, Vertex or Foundry.
Do I need Claude Code to use the Agent SDK?
Usually not. Both SDK packages bundle a native Claude Code binary. A few installs have no bundled binary, such as the Python source distribution on ARM64 Windows. In that case you install Claude Code natively.
Can I use my Claude Pro or Max plan with the Agent SDK?
Anthropic says that, unless previously approved, third-party developers cannot offer claude.ai login or rate limits in products built on the SDK. Use API key authentication as the quickstart describes.
What languages does the Claude Agent SDK support?
Python (3.10 or newer) and TypeScript (Node.js 18.14 or newer). For other languages, run the CLI as a subprocess with the -p flag and –output-format json.
Which one should a beginner use?
Claude Code. You install it, run claude in a project folder and describe what you want. Move to the SDK when you want to automate a task inside your own software.