# Agent SDK vs API vs Claude Code

Choosing the right Claude build surface: raw API, the Agent SDK harness, or the full Claude Code product.

## Why the CCAR-P exam tests this

Picking the wrong abstraction wastes engineering effort or forfeits needed control, so the exam checks whether you match the surface to the control-versus-maintenance trade-off.

## Definition

These three are **different levels of abstraction** over the same model, and the exam wants you to choose by how much control you need versus how much you want to build and maintain. The **Messages API** is the lowest level: you own the agent loop, tool orchestration, context management, and retries. Maximum control, maximum code you must write and keep working.

The **Claude Agent SDK** is a harness that provides the agentic loop, tool execution, context handling, and permissioning so you build a **custom agent** without reinventing the plumbing — the right pick when you need a bespoke, embedded, or headless agent but not a raw protocol. **Claude Code** is the fully built product: an interactive and headless coding agent with Skills, MCP, subagents, hooks, and permissions already assembled — the right pick when the packaged developer workflow fits and you would rather configure than build.

The decision rule is **use the highest-level surface that meets your requirements**. Reach for Claude Code when it already does the job; drop to the Agent SDK when you need a custom agent it cannot express; drop to the raw API only when you need control neither higher layer offers. Building on the API what the SDK already provides — or rebuilding Claude Code on the SDK — is the enablement anti-pattern.

## Exam trap

Defaulting to the raw Messages API for full control when the Agent SDK or Claude Code already provides what you need trades maintenance burden for control you will not use — pick the highest-level surface that satisfies the requirement.

## Commonly confused with

- **claude-code-in-cicd** — Running Claude Code headless in a pipeline is one deployment of the product surface; this concept is the prior choice of which surface to build on at all.
- **skills-distribution** — Skills are a feature you distribute within Claude Code and the SDK; choosing the runtime surface is upstream of how you version those Skills.

## Related

- claude-code-in-cicd
- skills-distribution
- golden-paths

---

Source: Claude Cert Prep — an independent, unofficial CCAR-P study resource (domain P7). Not affiliated with Anthropic.
