Last Updated on July 10, 2026
Every time you use Claude, through the browser, through Claude Code, through any Claude-powered product, you are using a harness. You just did not build it.
I have spent the last several years building production-grade cloud systems and, increasingly, agentic AI systems that run on top of them. The harness is the part most engineers underestimate. It sits between you and the underlying model, handling how your prompt gets sent, what tools Claude can access, what it is allowed to do, and how it loops through reasoning and action before returning a result. Most people never think about the harness because someone else built it for them. The Claude Agent SDK is how you build your own.
The model is the engine. The harness is the car. You are the driver.
A large language model (Claude Opus, Claude Sonnet, any of them) is extraordinarily capable and entirely inert. On its own, it can only respond to what you give it. It cannot remember previous sessions, access your files, send an email, call an API, or decide to check something before answering. It is an engine without a car.
The harness is the car. It provides the chassis, the controls, the fuel system, and the safety features that make the engine usable in the real world. When you go to claude.ai and have a conversation, that browser interface is a harness Anthropic built. When you use Claude Code, that is a harness too, one with file access, terminal commands, project memory, and configurable skills. Claude Cowork is another harness. Each one exposes the same underlying model but shapes what it can do and how.
The reason to build your own harness with the Claude Agent SDK is that you want to define those rules yourself.
What the Claude Agent SDK gives you
The Claude Agent SDK is Anthropic’s framework for building agents. Not the model itself, but the production layer around it. Think of it as the Claude-specific chassis: structural, opinionated, and designed so you can bring your own seats, color, and controls.
When you build with the Claude Agent SDK, you configure five things:
- System prompt. The instructions that shape how Claude behaves in every interaction: its persona, its constraints, what it knows about its operating context, and what it is trying to accomplish.
- Tools. The capabilities you give the agent. A tool might read a file, query a database, call an external API, or send a notification. The Claude Agent SDK handles tool definitions and manages how Claude decides when and how to use them. The principle here is least privilege: give the agent only the tools it actually needs for its job. An agent that summarizes documents does not need access to your email.
- Context management. How the agent maintains state across a session, what it carries forward, what it summarizes, what it discards. This is not automatic and it matters. A bloated context window degrades output quality. Production harnesses manage context deliberately.
- The agentic loop. This is the core of what makes an agent an agent rather than a chatbot. The loop follows a cycle of perception, reasoning, and action. For a task like “summarize this report,” the agent first reasons that it needs to read the file, takes the action of using a Read tool, perceives the result, and then reasons about what to do next. The Claude Agent SDK’s `query()` method is the entry point for this loop: the instruction you give the agent, along with the rules and tools it will use to carry it out.
- Guardrails and evaluation. Guardrails are the real-time enforcement layer that blocks or constrains unsafe inputs, tool calls, and outputs. Evaluations are the measurement layer that scores whether the agent meets the standards you defined. Together, they are what turns an agent prototype into something production-ready.
Claude API vs. Claude Agent SDK: contractor or employee?
The distinction maps cleanly to a workplace analogy:
| Claude API | Claude Agent SDK | |
| Mental model | Contractor | Employee |
| Scope | One task, one call | Ongoing, stateful, tool-using |
| Memory | None by default | You define and manage it |
| Tools | You handle externally | Defined and managed inside the harness |
| Loop | Single response | Perceive, reason, act, observe, repeat |
| When to use | One-off generation tasks | Production agents with ongoing responsibilities |
If you need Claude to draft a summary, translate a document, or classify a batch of records, the API is the right call. It is fast, stateless, and straightforward. You give it a job, it returns a result, done.
If you are building something that runs on a schedule, maintains context across sessions, makes decisions about which tools to use, and needs to behave reliably at scale, that is an employee, not a contractor. That is where the Claude Agent SDK earns its place.
Why you would build your own harness
The harnesses Anthropic ships, claude.ai and Claude Code, are general-purpose. They are built to work for a wide range of use cases, which means they are not optimized for any specific one.
When you build your own harness with the Claude Agent SDK, you can:
- Scope the agent’s persona and behavior to a specific function (a support agent that only handles billing questions, an analyst that only pulls from your internal data)
- Connect it to tools and data sources that a general-purpose harness cannot access
- Define exactly how context is managed, so the agent stays sharp across long sessions
- Build in the approval steps and guardrails your use case requires, and only those
- Run it on a schedule, trigger it from other systems, or integrate it into an existing product
The tradeoff is time and complexity. A general-purpose harness is available immediately. A custom harness built with the Claude Agent SDK takes engineering effort, but it gives you an agent that behaves the way your specific workflow requires.
What you need to learn to build your own
Building a harness with the Claude Agent SDK is not complicated in principle, but it does require understanding each of the five components well enough to make real decisions about them. A vague system prompt produces an agent that behaves unpredictably. Tools with too broad a scope create agents that do things they should not. A context window that is never managed gets slow and drifts. Guardrails added as an afterthought are not really guardrails.
The learning curve is less about syntax and more about judgment. Knowing when an agent should pause for human approval, how to write a tool definition that Claude will actually invoke correctly, how to structure an agentic loop so it fails gracefully rather than silently. These are the things that separate a prototype from something you would run in production.
The progression I would recommend: start by using an existing harness deeply. Claude Code is the obvious choice. Use it until you understand what it is doing for you and what it is not. Then build something small with the Claude Agent SDK: a single agent, a clear job, a constrained tool set. Let it break. Fix the guardrails. Once that runs reliably, you have the intuition to go further.
The engineers who get the most out of agentic AI are the ones who understand the full stack, not just the model, but the harness around it. That is where the real control lives. It is also what I spend most of my time teaching in the AI Engineering with Claude Nanodegree program, because it is the part most courses skip.




