Chapter 02 · 7 min read
Choose how to build it
A single call, a workflow or an agent; the four ways to build an agent on Claude; and which model to start with.
Everything you build on Claude goes through one endpoint, POST /v1/messages. Tools, structured output and thinking are options on that one request, not separate products. What changes between approaches is who runs the loop and who hosts it.
Start with the simplest tier
| You need | Build |
|---|---|
| Classify, summarise, extract or answer one question | A single call |
| Fixed steps where your code decides the order | A workflow: your code calls Claude at the right step |
| An open-ended job where the model chooses the steps | An agent: Claude plus tools in a loop |
Four ways to build an agent
Two questions separate them: who writes the loop, and who hosts it.
| Approach | You write | Loop and hosting | Choose it when |
|---|---|---|---|
| Manual loop (Messages API) | The loop: call, run tools, send results, repeat | You build the loop and host it | You want to own every step, or need a control flow nothing else fits |
| Tool runner (in the Anthropic SDK) | Just your tool functions | The SDK runs the loop; you host it | Most custom workers. This guide uses it |
| Managed Agents (beta) | An agent configuration and your tool results | Anthropic runs the loop and hosts a sandbox for each session | Long-running or scheduled agents, with files, code execution and versioned configurations |
| Claude Agent SDK | A prompt and options | Claude Code's full loop and built-in tools as a library; you host it | A coding or file-handling agent with read, write, edit, bash and search already built |
Two of these are easy to confuse. The tool runner is a helper in the regular anthropic package: it loops over tools you define and has no built-in tools. The Claude Agent SDK (claude-agent-sdk) is a separate package that brings Claude Code's own tools and loop. Both run on your own servers; only Managed Agents is hosted by Anthropic.
This guide builds with the tool runner, and shows Managed Agents in the production chapter. For the Claude Agent SDK, which is a different product with its own built-in tools, see its documentation at code.claude.com/docs/en/agent-sdk.
Which model
Start with the most capable model that fits your budget, get the worker right, then measure whether a smaller one holds the same quality. Prices are per million tokens, input and output.
| Model | ID | Price (in / out) | Good for |
|---|---|---|---|
| Claude Opus 5.5 | claude-opus-5-5 | $4 / $20 | The default: agents, judgement, multi-step tool use |
| Claude Sonnet 5.5 | claude-sonnet-5-5 | $2 / $10 | High-volume everyday work at speed |
| Claude Haiku 5.5 | claude-haiku-5-5 | $0.10 / $0.50 | Simple, fast steps: routing, classification, short extraction |
| Claude Fable 5.2 | claude-fable-5-2 | $8 / $40 | The hardest long-running reasoning, when cost matters less |
Use the model IDs exactly as written. Haiku 5.5's price applies to prompts up to 100K tokens. All of these have a context window of one million tokens.
One model, tuned, before many
A common mistake is building a cascade of models (a cheap one first, an expensive one when it fails) on day one. On the current models, the capable model at a lower effort setting (covered in the chapter on cost) often matches a bigger setting for less money, and one model keeps prompt caching simple. Measure first; split later if the numbers say so.