What Is the Claude Agent SDK?
What is the Claude Agent SDK? A Python and TypeScript library from Anthropic that gives you the agent loop, tools, and context management behind Claude Code.
The Claude Agent SDK is a library from Anthropic that lets developers build custom AI agents using the same engine that powers Claude Code. Available in Python and TypeScript, it provides the agent loop, built-in tools, and context management, callable from your own code. This article explains what the SDK is, how it works, and how it differs from a basic model API.
What the Claude Agent SDK Is
The Claude Agent SDK gives developers the same agent loop, tools, and context management that power Claude Code, Anthropic's coding agent, but programmable from their own applications. You provide a prompt and configuration, and the SDK runs the model, executes tools, and streams messages back until it produces a result. In effect, it packages the hard parts of building an agent into a reusable library.
This enables building autonomous agents that can read files, run commands, search the web, edit code, and interact with external systems. Because these capabilities come built in, developers do not have to implement tool execution from scratch—the SDK provides the loop and the tools out of the box, letting them focus on the task and which tools to allow.
How It Differs from a Basic Model API
A key distinction is who owns the loop. With a standard client SDK for calling a model, the developer implements the tool-use loop themselves: send a message, receive a request to call a tool, run the tool, send the result back, and repeat. This is workable but involves a lot of plumbing for every agent.
With the Claude Agent SDK, the model owns that loop. You describe the task and specify which tools are allowed, and the SDK runs the model, executes both built-in and custom tools, manages context, and streams messages back until it reaches a final result. This shifts the burden of orchestration from the developer to the SDK, making it much faster to build capable agents.
Capabilities and Languages
Both the Python and TypeScript versions are first-class and expose the same capabilities, including the core query interface, configurable options, permissions, hooks, subagents, and support for the Model Context Protocol. MCP support is significant because it lets agents connect to external systems and tools through a standard protocol rather than bespoke integrations.
The SDK requires a reasonably recent runtime for each language and is installed through the standard package managers. For enterprise deployments, it can authenticate through cloud providers rather than only a direct API key, with environment settings to route through major cloud platforms. This flexibility helps teams fit the SDK into existing infrastructure and governance arrangements.
Who It Is For
The Claude Agent SDK is aimed at developers who want to build custom, autonomous agents with capabilities similar to Claude Code, without reimplementing the agent loop and tooling themselves. It suits both Python and TypeScript teams equally, and its MCP support makes it a good fit for connecting agents to external systems. Usage is billed through Anthropic's model pricing, with enterprise cloud authentication options available.
Frequently Asked Questions
What languages does the Claude Agent SDK support?
Both Python and TypeScript are first-class and expose the same capabilities, including the query interface, options, permissions, hooks, subagents, and Model Context Protocol support.
How is the Agent SDK different from a regular client SDK?
With a client SDK, you implement the tool-use loop yourself. With the Agent SDK, the model owns the loop—it runs the model, executes tools, manages context, and streams results until done.
What is the connection to Claude Code?
The SDK exposes the same agent loop, built-in tools, and context management that power Claude Code, so you can build custom agents with similar capabilities from your own code.
