Claude Code

Claude Agent SDK vs Claude Code: when to use which

Claude Code is the CLI tool. The Claude Agent SDK is the library for building your own agents. They share infrastructure. Here's the decision tree.

In short

Claude Code is the CLI you install and run interactively (or in headless mode for cron-driven agents). Claude Agent SDK is the library you import into your own Python or TypeScript code to build agents that ship inside your products. They share the same underlying engine, so skills, hooks, MCP servers and tool patterns transfer between them.

Anthropic ships two main developer-facing surfaces for building agents:

  1. Claude Code, a CLI you install with npm i -g @anthropic-ai/claude-code and run from your terminal
  2. Claude Agent SDK, a library you pip install claude-agent-sdk (or npm i @anthropic-ai/claude-agent-sdk) into your own application

They’re built on the same engine. The question is which interface you want.

Use Claude Code when

  • You’re the operator, you’re the one prompting, watching outputs, approving actions
  • You want the experience of pair-programming with an AI assistant
  • The agent runs on your machine, your laptop, or your VPS as a scheduled task
  • You’re doing ad-hoc business operations (data analysis, content drafting, file editing)
  • You want zero infrastructure overhead, claude and you’re working

Use the Claude Agent SDK when

  • You’re building software that other people use (a SaaS, a customer-facing tool, an embedded assistant)
  • The agent runs in your application’s backend, triggered by user actions or events
  • You want fine-grained control over the loop, when to add tools, when to stop, what to do with intermediate output
  • You’re building a multi-tenant system (each user gets their own agent context)
  • You need to integrate with your existing telemetry, auth, logging stack

What transfers between them

  • MCP servers: every MCP server works in both
  • Skills: a SKILL.md works in either (with minor packaging differences)
  • Tool patterns: the shape of tool calls is identical
  • Prompt engineering: everything you learn about prompting Claude transfers directly
  • Cost model: both bill against the same Anthropic Console tokens

What doesn’t transfer

  • Slash commands: Claude Code-only (they’re a CLI affordance)
  • Hooks (as defined in .claude/settings.json): Claude Code-only. The Agent SDK has its own pre/post-hook callbacks but the configuration shape is different.
  • The terminal UX: obviously

A concrete Australian example

At Boring Ventures we use Claude Code for:

  • Daily content production (this article was drafted in Claude Code)
  • the nightly inventory audits run via cron (headless mode)
  • Lead Gen Empire deploys + audits
  • Drafting client quotes + reports

We’d use the Claude Agent SDK to build:

  • A customer-facing agent inside a SaaS we ship (none yet, but it’s where we’d reach for it)
  • An embedded support agent inside a client’s web app
  • A multi-tenant ops automation tool

For 90% of Australian SMB operators, the answer is “use Claude Code, skip the SDK until you’re literally building software for sale.” The SDK is overkill if you’re the operator and there’s no end-user agent product involved.

What the SDK looks like (TypeScript, 30-second version)

import { Agent } from '@anthropic-ai/claude-agent-sdk'

const agent = new Agent({
 model: 'claude-sonnet-4-6',
 systemPrompt: 'You are an Australian small business operations agent. Australian English. AUD pricing.',
 tools: ['filesystem', 'bash', 'webSearch'],
 permissions: { allow: ['Read', 'Write(*.csv)'], deny: ['Bash(rm:*)'] },
})

const result = await agent.run({
 prompt: 'Read sales.csv and tell me the top 5 SKUs by revenue this month.',
 maxTurns: 20,
})

console.log(result.text)
console.log(`Cost: ${result.usage.estimatedCostAUD} AUD`)

That’s the entire surface for a one-shot agent run. Streaming, multi-turn, tool-use callbacks all expose with similar shape.

Bottom line

Build with Claude Code first. Move to the Claude Agent SDK only when you’re explicitly building agent-shaped software that ships to other people. The SDK is the right tool for the right job; for most Australian SMB workflows, Claude Code is the right job.

Common questions

Can I use the Agent SDK to write Claude Code-like tools myself?
Yes. The Claude Agent SDK is essentially the same harness Claude Code is built on, exposed for programmatic use. You can build your own CLI, your own background agent, your own embedded agent inside a web app.
Which one for non-developers?
Claude Code. The Agent SDK requires writing Python or TypeScript. Claude Code requires installing a CLI and typing prompts.
Does the Agent SDK support MCP?
Yes, fully. Any MCP server that works with Claude Code works with an Agent SDK-built agent.

Want this built for your business?

Book a free 30-minute AI audit. We'll map your business and show you exactly which systems we'd build first. No pitch deck, no scoping fee.

Book my free AI audit