What is the Claude Agent SDK?

Understand what the Agent SDK lets you build and what it needs, so you can decide if your team should build an agent or use Claude Code as it is.

Michel LiebenUpdated November 24, 20266 min read

Key takeaways

  • The Claude Agent SDK is a library for Python and TypeScript that gives your own program the same tools, agent loop and context management that power Claude Code.
  • An agent is a program that plans its own steps and calls tools, such as reading files, running commands or searching the web, until a task is done.
  • You install it with npm install @anthropic-ai/claude-agent-sdk or pip install claude-agent-sdk, and it needs Node.js 18.14+ or Python 3.10+.
  • It signs in with an API key from the Claude Console. Unless Anthropic approved it, a product you build for others cannot offer claude.ai login.
  • Usage is billed at Claude API token rates. Max, Ultra and Team plans include monthly API credits that cover the Agent SDK.

Find leads inside Claude

ColdIQ brings verified emails and phone numbers from 40+ data providers into Claude. Up to 1,450 free credits as you get started.

Quick steps

  1. Install Node.js 18.14+ or Python 3.10+.
  2. Install the SDK and set your ANTHROPIC_API_KEY.
  3. Call query() with a prompt and the tools the agent may use.

What is the Claude Agent SDK used for?

An SDK (software development kit) is a ready-made library you add to your code. The Claude Agent SDK lets you put a Claude Code style agent inside your own app, script or service.

You write a prompt and a list of allowed tools. The SDK runs the loop: Claude thinks, calls a tool, reads the result, and decides the next step, until the task is finished or fails.

It handles the hard parts for you: running the tools, managing the context (what Claude keeps in mind), and retrying. You read the stream of messages as Claude works.

Agent SDK, Claude Code, Client SDK or Managed Agents: which one?

Anthropic offers four ways to run Claude as an agent. They differ in who runs the agent and what comes built in.

  • Agent SDK: you embed Claude Code’s agent in your own Python or TypeScript app, in a process you run.
  • Claude Code CLI: you work with the agent yourself in a terminal, for daily use or one-off tasks.
  • Client SDK: you call the Claude API directly and write the tool loop yourself (or use its beta tool runner).
  • Managed Agents: Anthropic hosts the agent loop for you, with sessions in a cloud sandbox, configured through the API.

Claude tip

If a person will type the requests, Claude Code is enough. Reach for the Agent SDK when the agent must run inside your own product or on a schedule.

How do you install the Claude Agent SDK?

You need Node.js 18.14 or later for TypeScript, or Python 3.10 or later for Python, and an Anthropic account. Both SDKs bundle a native Claude Code binary, so most installs need no separate Claude Code install.

  1. Create a project folder. The agent can reach the files in that folder and its subfolders by default.
  2. TypeScript: run npm install @anthropic-ai/claude-agent-sdk. Python: run pip install claude-agent-sdk (or uv add claude-agent-sdk).
  3. Get an API key from the Claude Console and set it: export ANTHROPIC_API_KEY=your-api-key on Mac and Linux, or $env:ANTHROPIC_API_KEY = "your-api-key" in PowerShell.
  4. Write a script that calls query() with a prompt and options such as allowedTools and permissionMode.
  5. Run it (npx tsx agent.ts, or python agent.py) and watch the agent print its steps.

Good to know

The SDK does not load .env files on its own. If you keep the key in a .env file, load it yourself (for example with the dotenv package) before you call the SDK.

What can an Agent SDK agent do?

It gets the same capabilities as Claude Code, which you switch on in the options.

  • Built-in tools: read, write and edit files, run commands and search the web.
  • Permissions: choose which tools run on their own and which need approval.
  • Hooks: run your own code at key points, such as before or after a tool call.
  • Subagents: start helper agents for focused subtasks.
  • Sessions: keep context across exchanges, then resume or fork later.
  • Skills, commands and memory, loaded from your project’s .claude folder, as in Claude Code.
  • MCP servers: connect outside tools and data sources through the Model Context Protocol.

How do you connect tools and data to an agent?

MCP (Model Context Protocol) is the standard way to plug an app into an AI agent. You list MCP servers in the agent’s options, and their tools appear next to the built-in ones.

For a sales agent, this is where the data comes from. For example, the ColdIQ MCP server (https://mcp.coldiq.com/mcp) gives an agent leads, verified emails and phone numbers from 40+ data providers, with up to 1,450 free credits as you get started.

Keep the tool list short. An agent with only the tools it needs is easier to trust and cheaper to run.

How much does the Claude Agent SDK cost?

The SDK itself is free to install. You pay for the Claude tokens the agent uses, at Claude API rates. As of November 2026, Sonnet 5.5 costs $2 per million input tokens and $10 per million output tokens.

Max ($100 a month in credits), Ultra ($200) and Team (pooled, up to $500) include monthly API credits that cover the Agent SDK. You link them to a Console organization in Settings > Billing on claude.ai, after seven days on the plan.

When you run the SDK while signed in with your own Claude plan, the usage draws from your subscription limits.

Best practice

Anthropic does not allow third-party developers to offer claude.ai login or plan limits in their products unless previously approved. Products for other people use API keys.

Paste this in your terminal

Paste in your terminal

npm install @anthropic-ai/claude-agent-sdk

Say this

Prompt to use

Click the prompt to copy it

Install ColdIQ inside Claude

Claude gets 40+ B2B data providers: find companies and people, with verified emails and phone numbers. Get up to 1,450 credits for free as you get started.

Install it inside Claude
https://mcp.coldiq.com/mcp

Sources

Next: What is Claude Design?

[FAQ]

Frequently asked questions

The Claude Agent SDK is a Python and TypeScript library that gives your own app the tools and agent loop behind Claude Code. Then see install, API keys, costs and limits.

The Agent SDK took over from the older Claude Code SDK packages. Anthropic’s docs include a migration guide from one to the other.

Python and TypeScript. For other languages, Anthropic suggests running the Claude Code CLI as a subprocess with -p and JSON output.

Yes. It supports Amazon Bedrock, Claude Platform on AWS, Google Cloud and Microsoft Foundry, each set with its own environment variable.

No. Anthropic’s branding rules allow names such as "Claude Agent" or "YourAgent Powered by Claude", but not "Claude Code".