F5.1 F5

Agent SDK: Claude Code's Agentic Powers, Programmable

The Claude Agent SDK takes the agentic capabilities of Claude Code — tool use, sub-agents, multi-turn reasoning — and packages them into an SDK you can program against. The key insight: it’s for building agents in any domain, not just coding.

What it is

The Agent SDK (claude_agent_sdk package) provides the infrastructure for building autonomous, tool-using AI agents. Research assistants, data processors, customer support agents, document analyzers — anything that needs multi-step reasoning with tool execution.

It’s not a mobile framework, not a chatbot widget, not a testing harness. It’s a server-side/CLI SDK that gives you the same agentic loop that powers Claude Code, aimed at your domain.

Not just for code

A common misconception: the Agent SDK only works with code repositories. It doesn’t. It works with any domain. A research agent that searches the web, reads documents, and produces structured reports doesn’t need a repository at all. WebSearch, Read, and other tools work independently of any codebase.

Three core interfaces

The SDK provides three building blocks:

  • query() — stateless single-prompt operations. Process one document, classify one ticket, answer one question. No cross-call context.
  • ClaudeSDKClient — stateful multi-turn interactions. Maintain conversation context across multiple exchanges. Follow-up questions reference prior context automatically.
  • ClaudeAgentOptions — configuration for both interfaces. System prompt, allowed tools, permission mode, max turns, hooks, MCP servers.

Why not build on the raw Messages API?

You could build agents directly on the Claude Messages API. But then you’d need to implement the agentic loop yourself — the tool execution cycle, sub-agent management, permission controls, turn limits, hook execution. The Agent SDK provides all of this pre-built. It wraps the same API and uses the same models, so there’s no capability difference. The advantage is infrastructure, not enhanced model access.

The SDK doesn’t make API calls free (same token costs apply), doesn’t guarantee deterministic behavior (model outputs are still variable), and doesn’t use a different model. It gives you the plumbing so you can focus on your domain logic.


One-liner: The Agent SDK (claude_agent_sdk) packages Claude Code’s agentic capabilities into a programmable interface for building tool-using agents in any domain — not limited to coding.