Technical Fundamentals
Official scope (Exam Guide v1.0): foundational technical concepts for AI application development, including basic engineering practices such as integrating with SDKs that wrap REST APIs, and websockets. This is the largest skill in Domain 5. Tokens and sampling belong to 5.2, not here.
What an SDK wraps
The Claude API is REST over HTTPS with JSON bodies; the main inference endpoint is POST /v1/messages. Official client SDKs exist for Python, TypeScript, C#, Go, Java, PHP and Ruby, plus the ant CLI. An SDK builds the request, reads ANTHROPIC_API_KEY, sends it, parses typed objects and adds:
- automatic retries with exponential backoff (2 by default, honouring
retry-after) for connection errors, 429 and 5xx; - typed exceptions per status (catch the specific class, not message text);
- request-id access (
_request_idin Python and TypeScript); - streaming helpers that can return the final assembled
Message; - TCP keep-alive and a guard against non-streaming requests expected to exceed 10 minutes.
Raw HTTP is for languages or runtimes no SDK covers, or exact control. You then own retries, error parsing, SSE parsing and version headers.
Client SDK vs Agent SDK
The client SDK wraps the API (you write the tool loop or use the beta tool runner). The Agent SDK wraps Claude Code's agent loop (built-in tools, permissions, sessions). Do not confuse them (1.2).
Streaming is SSE, not WebSockets (verified for SSE)
stream: truereturns server-sent events: one-way, server to client, over an ordinary HTTP response. Managed Agents also streams session events over SSE.- No Anthropic documentation page describes a WebSocket interface to the Messages API (searched 2026-10-16). Treat "the Claude API uses WebSockets" as false unless the docs change.
WebSockets as an integration concept (design guidance)
- A WebSocket is a persistent, two-way connection upgraded from HTTP. It suits interactive, bidirectional apps (live chat with interrupts, collaborative tools, voice).
- Typical architecture: browser ⇄ your server over a WebSocket (or SSE), your server → Claude API over HTTPS with SSE streaming. The API key stays on the server.
- Choose for your own front end: one-way token stream → SSE (simpler, works through most proxies). Two-way, low-latency, many message types → WebSocket. Plan for reconnection, proxy idle timeouts and backpressure either way.
Async and concurrency (design guidance, verified limits)
Async clients let one process run many requests; keep concurrency under RPM / ITPM / OTPM limits (token-bucket, so short bursts can trip a per-second equivalent). Always set timeouts and handle cancellation.
Reliability basics
- Retry 429, 500, 504, 529 with backoff and jitter; do not retry 400, 401, 403, 404, 413.
- A spend-cap 429 has no
retry-afterand keeps failing (error_code: enforced_spend_limit_reached); a spend limit you set returns 400. - Log the
request-id. Request size limit: 32 MB on Messages (413 returned at the edge). - Pin the
anthropic-versionheader and your SDK version; read changelogs before upgrading; beta headers can change.
Exam traps
- "Claude streams over WebSockets." It is SSE.
- API key in browser JavaScript to "stream directly".
- Retrying every error (400s will never succeed).
- Confusing the client SDK with the Agent SDK.
- Hard-coding a long timeout instead of streaming.
References
- Errors and long requests — checked Oct 16, 2026
- Rate limits — checked Oct 16, 2026
- Authentication — checked Oct 16, 2026
- Agent SDK overview — checked Oct 16, 2026
- Streaming — checked Oct 16, 2026
Check your understanding
A browser needs tokens as they are generated, one direction only. Simplest transport from your server?Show answerHide answer
Answer
SSE (a WebSocket works but is more than needed).Name two things the SDK gives you that raw HTTP does not.Show answerHide answer
Answer
Automatic backoff retries, typed errors (also request-id access, stream assembly).A 429 has no
retry-afterand retries keep failing. Likely cause?Show answerHide answerAnswer
Monthly spend cap reached; checkerror.details.error_code.Where does the API key live when a web app streams to browsers?Show answerHide answer
Answer
On your server.