Skip to content

Harness profile

Claude Code and the Claude Agent SDK: Anthropic's coding agent, and the same agent as a library

Claude Code is Anthropic's agentic coding tool that reads a codebase, edits files and runs commands from the terminal, IDE, desktop app or browser. The Claude Agent SDK packages the same agent loop and tools as a Python and TypeScript library, for building your own agents on Claude.

StudiedLast reviewed 4 min read

Explained from public sources. Mai has not built this yet.

On this page

In plain English

Claude Code is Anthropic’s agent for software work. You describe what you want, and it reads the code, plans an approach, edits files across a project, runs commands and tests, and handles git. You can use it in a terminal, inside VS Code or JetBrains, in a desktop app or in the browser. The Claude Agent SDK takes the same engine and makes it a library, so a developer can build an agent of their own, for code or for other work, with the same tools and safety controls.

How it works

Claude Code installs with a one-line script, Homebrew or WinGet, and runs as claude in a project folder. It needs a Claude subscription or an Anthropic Console account; the terminal and IDE versions can also use third-party providers. Every surface uses the same engine, so a project’s instructions, settings and MCP servers work wherever you open it. It is not open source: its licence reserves all rights to Anthropic, with use subject to Anthropic’s Commercial Terms of Service.

The Agent SDK is installed as @anthropic-ai/claude-agent-sdk for TypeScript or claude-agent-sdk for Python, and bundles a Claude Code binary, so most installs need nothing else. It authenticates with an API key, either from the Anthropic Console or through Amazon Bedrock, Google Cloud or Microsoft Foundry. The Python repository carries an MIT label, but the README and docs say use of the SDK is governed by the Commercial Terms.

Ask: CLI or IDE, Your app via the SDK. Then Agent loop. Then Checks: Hooks, Deny and ask rules, Permission mode, Allow rules. Then Your approval callback. Then Act: Files and shell, Web, MCP servers, Sub-agents.

Each tool call passes a fixed sequence of checks before it runs

What the two share, according to the docs:

  • Built-in tools to read, write and edit files, run commands and search the web, plus MCP for external systems.
  • Sub-agents for focused subtasks, where a lead agent hands out work and merges results.
  • Hooks that run your own code at points in the agent’s lifecycle, such as before a tool call.
  • Permissions. Each tool call passes, in order, hooks, deny rules, ask rules, the permission mode, allow rules and finally a callback in your code. Modes run from default, which asks about anything not pre-approved, to dontAsk, which turns every would-be prompt into a refusal for headless use, through to bypassPermissions, which the docs say to use only in controlled environments.
  • Sessions that keep context across turns and can be resumed or forked.
  • Memory and skills. A CLAUDE.md file holds project instructions read at the start of every session, Claude Code can save its own learnings as auto memory, and skills package repeatable workflows.

Claude Code adds surfaces of its own: scheduled tasks in the cloud or on the desktop, GitHub Actions and GitLab CI, a Slack integration that turns a bug report into a pull request, and Channels for pushing events from Telegram, Discord or webhooks into a session.

What it does best

For software work it is a complete, polished agent: it plans, edits across many files, runs tests and opens pull requests, with careful permission handling. The SDK’s strength is that you inherit all of that rather than writing your own loop, tools and context management. The permission sequence is documented step by step, and the ability to start strict and loosen mid-session as trust builds suits real deployments. MCP support means the same agent reaches business systems as easily as code.

Where it stops

It is built around Claude models; the documented provider options are different clouds for reaching Claude, not a way to swap in other model families. It is proprietary, governed by commercial terms, and products built on the SDK must keep their own branding and use API keys rather than claude.ai login. The SDK is offered for Python and TypeScript; other languages drive the command line as a subprocess. If you want Anthropic to host the agent loop and sandbox for you, the docs point to a separate product, Managed Agents.

Where it goes wrong

The permissions page is full of warnings worth heeding. Tools that are auto-approved never reach your approval callback, so checks you place there are silently skipped for them. In bypassPermissions mode, an allow list does not restrict anything; only deny rules, ask rules and hooks still bite. A deny rule on a path stops Claude’s own file tools, but a script it runs can still write there unless you use operating-system sandboxing. Sub-agents can inherit broad modes from the main session.

How Mai AI uses it

I would reach for the Agent SDK when a client system needs an agent that works with files, documents and commands, and the client is happy to run on Claude. Starting from a tested loop with strong permissions is better than rebuilding one.

The idea I take from it, whatever the stack, is the fixed order of permission checks ending in a human decision, which is the backbone of human approval gates and agent safety. Its single MCP layer across every surface is a good model for the tool layer and MCP. For how these pieces fit a system built around one business, see how Mai AI designs custom AI operations systems.

Questions and answers

What is the difference between Claude Code and the Claude Agent SDK?

Claude Code is the finished tool you use interactively, in a terminal, IDE, desktop app or browser. The Agent SDK is a Python and TypeScript library that runs the same agent, with the same tools, permissions, sessions and hooks, inside an application you build and operate.

Is Claude Code open source?

No. The licence file in its GitHub repository reserves all rights to Anthropic and says use is subject to Anthropic's Commercial Terms of Service. The Agent SDK is also governed by those terms, including when you use it in products for your own customers.

Do I need a Claude subscription to use the Agent SDK?

No. The SDK uses API key authentication, through an Anthropic Console key or through Amazon Bedrock, Google Cloud or Microsoft Foundry. Anthropic does not allow third-party products built on the SDK to offer claude.ai login unless previously approved.

Does Claude Code support MCP?

Yes. Claude Code and the Agent SDK both connect to external tools and data through the Model Context Protocol, so an agent can reach systems such as Google Drive, Jira or your own services.

Can a Claude Agent SDK agent ask a person before it acts?

Yes. Each tool call passes through hooks, deny rules, ask rules, the permission mode and allow rules, and anything still undecided goes to a callback in your code, where you can ask a person to approve or refuse it.

Sources

  1. Claude Code overviewcode.claude.com
  2. Agent SDK overviewcode.claude.com
  3. Agent SDK quickstartcode.claude.com
  4. Agent SDK permissionscode.claude.com
  5. claude-code on GitHub (README)github.com
  6. claude-code licence filegithub.com
  7. claude-agent-sdk-python on GitHubgithub.com