The Claude Agent SDK: building your own agents, and when a business needs it
The Claude Agent SDK: building your own agents, and when a business needs it

The Claude Agent SDK is a software library that lets developers build their own AI agents on the same engine as Claude Code. Anthropic describes it as giving you "the same tools, agent loop, and context management that power Claude Code, programmable in Python and TypeScript." Instead of a person typing into Claude Code, your own application starts the agent, gives it a task and the tools it may use, and gets the result back.
Most businesses don't need it. If you want Claude to edit your website, update content or fix bugs, Claude Code itself does that, and you don't build anything. The SDK makes sense when an agent has to live inside your own software: a back-office tool that drafts product page updates for review, an internal checker that audits content before it publishes, or a service that runs the same agent for many staff. It also brings real decisions about hosting, cost, credentials and licensing, which this guide covers as of October 2026.
Key Takeaways
- The Agent SDK is "A library that runs the Claude Code binary," in Python (pip install claude-agent-sdk) or TypeScript (npm install @anthropic-ai/claude-agent-sdk). It needs Python 3.10+ or Node.js 18+.
- It is the renamed Claude Code SDK. It includes Claude Code's built-in tools, permissions, hooks, subagents, MCP connections, sessions, skills and plugins.
- Products built on it use API key authentication from the Claude Console or a supported cloud provider. Anthropic doesn't allow third-party developers to offer claude.ai login in their products unless previously approved.
- There is no separate SDK fee on Anthropic's pages; usage is billed as API tokens. The SDK's cost fields are estimates, "not authoritative billing data."
- If you don't want to run the agent loop on your own servers, Anthropic points to Managed Agents, where "Anthropic hosts the agent loop."
Where the Agent SDK fits among Anthropic's tools
Anthropic's Agent SDK overview compares four ways to build with Claude. The descriptions below are Anthropic's.
| Option | What it is | Who runs the agent | Typical business use |
|---|---|---|---|
| Claude Code CLI | "The terminal interface, built for daily interactive use" | A person, on their machine | Building and maintaining your website or software |
| Agent SDK | "A library that runs the Claude Code binary," with built-in tools, permissions, sessions and hooks | Your application, in a process you operate | An agent embedded in your own tool or service |
| Client SDK (Claude API) | "Direct access to the Claude API ... You write the tool loop yourself" | Your code, call by call | AI features such as summaries, classification or chat inside an app |
| Managed Agents | "A hosted agent harness that runs the agent loop," in an Anthropic-managed or self-hosted sandbox | Anthropic's infrastructure, configured through the API | Long-running agent tasks without hosting the loop yourself |
If the difference between Claude Code, the Claude apps and the API is still fuzzy, start with our explainer on Claude Code vs Claude.ai vs the Claude API.
What the SDK gives a developer
The SDK's value is that the hard parts of an agent already exist. Anthropic lists these capabilities:
- Built-in tools: read, write and edit files, run commands and search the web.
- Permissions: control which tools run automatically and which need approval. Anthropic's quickstart pre-approves only Read, Edit and Glob for its example agent.
- Hooks: run your own code at points in the agent's lifecycle, for example to log every action or block a command.
- Subagents: hand focused subtasks to specialized agents.
- MCP: connect external tools and data sources through the Model Context Protocol.
- Sessions: keep context across exchanges, then resume or fork later.
- Skills, commands and memory: loaded from the project's .claude/ folder and ~/.claude/, "same as Claude Code."
- Plugins: package skills, agents, hooks and MCP servers and load them by path.
Both SDKs bundle a native Claude Code binary for most installs, so most setups need no separate Claude Code install. For other languages, Anthropic's route is to run the CLI as a subprocess with -p and --output-format json, which our guide to headless mode and scripting covers. For many one-off website jobs, that script route is enough.
When a business needs the SDK, and when it doesn't
| Your goal | Likely fit |
|---|---|
| Change, fix or rebuild your website | Claude Code, used by a person or your agency. No SDK needed. |
| A recurring report or check on your site's code | A scheduled job, GitHub Action or claude -p script |
| Add a summary, chat or classification feature to your app | The Claude API through a client SDK |
| An agent inside your own product or back-office tool that works on files, runs steps and uses your systems | The Agent SDK |
| The same, without running servers for the agent loop | Managed Agents |
A useful test: if a person would happily open Claude Code and do the task, you don't need the SDK. If the task has to happen inside your software, triggered by your systems, with your rules applied every time, you might.
Illustrative examples of SDK-shaped jobs, not client stories:
- A content team's publishing tool where an agent checks each draft against the style guide and flags unsupported claims before an editor approves it.
- An internal operations tool where an agent reads a request, gathers data from connected systems and prepares a draft response for staff.
- A website audit service that runs a fixed set of checks against each site's repository and returns a structured report.
Each keeps a person approving the output. That is a design choice you build in, not something the SDK does for you.
What it costs to run
- No SDK fee. Anthropic's pages show no separate SDK price or plan as of October 2026. You pay for model usage at API token rates.
- Token prices. Per million tokens on the Claude API: Sonnet 5.5 is $2 input and $10 output, Opus 5.5 is $4 input and $20 output, and Haiku 5.5 is $0.10 input and $0.50 output for prompts up to 100K tokens. The API pricing page has the full list. Agents use many tokens per task because they read files and call tools in a loop.
- Estimates vs bills. The SDK reports total_cost_usd and costUSD, but Anthropic says these "are client-side estimates, not authoritative billing data." Use the Usage page or the Usage and Cost API in the Claude Console for real figures.
- Hosting. You run the agent. Anthropic's hosting guide gives "1 GiB RAM, 5 GiB disk, and 1 CPU per agent" as "a reasonable starting point" and calls it "a floor, not the ceiling." Container state doesn't survive a restart by default.
- Subscriptions don't cover a product. Pro and Max limits "assume ordinary, individual usage of Claude Code and the Agent SDK," and Anthropic directs SDK products to API key authentication.
Our Claude Code pricing guide explains how subscriptions and API billing differ.
Credentials, licensing and branding rules
These rules decide whether a build plan is allowed. This is a summary, not legal advice; confirm your setup with counsel and, for edge cases, Anthropic's sales team.
- Authentication. "Unless previously approved, Anthropic does not allow third party developers to offer claude.ai login or rate limits for their products, including agents built on the Claude Agent SDK." Use a Console API key or Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry credentials. Developers "may not collect, store, or intermediate Claude.ai credentials or session tokens."
- Terms. The SDK is "governed by Anthropic's Commercial Terms of Service, including when you use it to power products and services that you make available to your own customers and end users." The exception is any component whose own LICENSE file names a different license. As of October 2026, the Python SDK's GitHub repository lists the MIT License, and the npm package says "SEE LICENSE IN README.md."
- Running Claude Code inside a product. Anthropic's legal page sets conditions for "preinstalling or running Claude Code in your products or services," including that the binary "must not be modified" and that "Customers may not pay for, resell, or intermediate Claude usage on their end users' behalf." The same page says this doesn't restrict a business provisioning its own API keys for its own authorized users, billed to the key owner. How these rules apply to a product you sell to others is a question for Anthropic and your lawyer before you build.
- Branding. You may call an agent "Claude Agent" or "{YourAgentName} Powered by Claude." You may not call it "Claude Code" or "Claude Code Agent," or use Claude Code-style visuals.
Two practical consequences for a business hiring a developer or agency. First, the business should own the Console account and API keys for its own agents, so usage bills to the business directly. Second, who owns the agent's code is a contract question; our guide to AI-written code ownership covers the points to settle.
Data and safety
An agent you build acts with the permissions you give it. The same rules that apply to Claude Code apply here, with the difference that your code, not a person, approves each step.
- Give the agent the fewest tools it needs, and pre-approve only safe ones.
- Use hooks to log actions and block dangerous commands.
- Run it in a container or VM with limited network access and no production credentials it doesn't need.
- Treat anything it reads from the web, email or user input as untrusted.
- Keep a person approving anything that publishes, sends or spends.
API use runs under Anthropic's Commercial Terms. For Claude Code under commercial terms, Anthropic says it does not train generative models on code or prompts unless the customer has chosen to provide data for model improvement. Our guide to what happens to your code and data covers retention and settings.
Getting started without overbuilding
- Prove the task in Claude Code first. If a person can't get a reliable result interactively, an SDK wrapper won't fix it.
- Script it with claude -p and structured JSON output. Many needs stop here.
- Move to the SDK when you need approval callbacks, sessions, or integration with your application's own logic.
- Decide hosting: your own containers, or Managed Agents if you'd rather not run the loop.
- Set budgets and monitoring in the Claude Console before real traffic.
Teams moving from the older Claude Code SDK packages follow Anthropic's migration guide; the packages and some option names changed.
Conclusion
The Claude Agent SDK is the right tool when an agent has to run inside your own software, with your rules, on your infrastructure. It gives developers Claude Code's tools, permissions and loop as a library, billed as API usage. For editing or maintaining a website, Claude Code alone is simpler. Before building, settle the credentials, licensing and branding rules, own your API keys, and design human approval into every step that publishes or spends. If you're weighing an agent inside your business software, our AI-powered software and CRM development team builds Claude features into apps, and our Claude Code development team handles website and internal-tool work. Our write-up on integrating Claude into custom business software shows the broader approach. More guides are in our Claude Code Guide.
Frequently asked questions
Is the Claude Agent SDK free?
The libraries are free to install. Running agents costs API usage at standard token prices, plus whatever you pay to host them. Anthropic lists no separate SDK fee as of October 2026.
Can my agent use my Claude Pro or Max subscription?
Not for a product or service. Anthropic requires API key authentication for agents built on the SDK and doesn't allow third-party products to offer claude.ai login unless previously approved.
Is the Agent SDK the same as the Claude Code SDK?
Yes. Anthropic renamed the Claude Code SDK to the Claude Agent SDK. The packages are now @anthropic-ai/claude-agent-sdk and claude-agent-sdk.
Can I call my product "Claude Code for X"?
No. Anthropic's branding rules don't permit "Claude Code" or "Claude Code Agent" in your product. They allow "Claude Agent" or "{YourAgentName} Powered by Claude," and say your product should keep its own branding and not appear to be Claude Code.
Do I need a developer to use it?
Yes. The SDK is a programming library for Python or TypeScript. Business owners who don't code will get more from Claude Code's desktop app, or from a developer who builds the agent for them.
Put this into action with eSEOspace
We help businesses grow with seo, geo & aeo that actually performs. Explore the services behind this guide:
Get a FREE Audit
We'll perform a comprehensive SEO, AEO, GEO & CRO audit of your website — completely free — and show you exactly how to outrank your competitors.
Don't have a site yet? Get in touch →
Get a FREE GEO/AEO/SEO Audit
We'll analyze your site's SEO, GEO, AEO & CRO — completely free — and show you exactly how to get found across Google and AI answers.
Don't have a site yet? Get in touch →
Great — your audit is on the way!
We'll send your free SEO/GEO/AEO/CRO audit within the next few hours. Where should we send it?
You're all set! ✓
Your free audit is being prepared — check your inbox in the next few hours. Talk soon!
On this page





