5.2 Technical fundamentals
6.1% of the exam — the second-heaviest skill. It is the plumbing beneath every other domain: SDKs wrapping REST, transports, connections, and configuration.
SDKs wrap the REST API
Every SDK call is an HTTP request to the same endpoints. The SDK exists to remove the parts everyone gets wrong.
| The SDK gives you | What you would otherwise hand-roll |
|---|---|
| Credential resolution | Env var, auth token, CLI profile, workload identity federation, in a defined precedence |
| Typed request and response models | Hand-written interfaces that drift from the API |
| Typed exception classes | String-matching error messages |
| Automatic retries with backoff | Your own retry loop (defaults: 2 retries on 408/409/429/5xx and connection errors) |
| Streaming helpers | Manual SSE parsing and event reassembly |
| Pagination helpers | Cursor bookkeeping |
| Timeout defaults and scaling | A fixed timeout that breaks on long generations |
| Provider clients | Signing and endpoint construction for Bedrock, Vertex, Foundry |
Two rules:
- Do not mix an SDK with raw HTTP in the same project. Pick the SDK when one exists for your language; use raw HTTP only when there is no SDK or the project genuinely is a shell/cURL project.
- Do not reimplement SDK functionality. Use
finalMessage()/get_final_message()instead of wrapping stream events in a promise; use the SDK's types instead of redefining equivalents; use the typed error classes instead of parsing messages.
Client configuration that bites
| Setting | Default | Trap |
|---|---|---|
timeout | 10 minutes | Units differ: seconds in Python/Ruby, milliseconds in TypeScript, Duration/TimeSpan in Java/C# |
max_retries | 2 | Timeouts are retried, so worst-case wall clock is timeout × (retries + 1) |
base_url | First-party API | Do not point the first-party client at a partner platform — use that platform's client class |
| Auth | ANTHROPIC_API_KEY, then an auth token, then a CLI profile, then federation | An unset API key does not mean there are no credentials |
Transports: HTTP, SSE, and WebSockets
| Transport | Direction | Claude usage | Right for |
|---|---|---|---|
| HTTP request/response | Client → server, one shot | POST /v1/messages non-streaming; batches; files | Everything that fits in one round trip |
| Server-sent events (SSE) | Server → client, unidirectional stream over one HTTP response | Messages API streaming; Managed Agents session events | Token-by-token output, progress, long generations |
| WebSockets | Full duplex, persistent | Not how the Messages API is called | Your own client↔server channel: pushing deltas to a browser, bidirectional voice or collaboration, cancelling work mid-flight |
| Polling | Client-initiated, repeated | Batch processing_status | Long-running server-side jobs with no push channel |
The realistic architecture for a chat UI: the browser holds a WebSocket (or SSE) to your server, and your server holds an SSE stream from the Claude API, forwarding deltas. The API key never reaches the browser.
A key shipped to a client is a leaked key. Requests go through your backend, which holds the credential, enforces the user's authorization, applies rate limits, and logs usage. This is also the only place you can validate output before it reaches a downstream system.
Connection and concurrency management
| Practice | Why |
|---|---|
| Reuse one client instance | Connection pooling and keep-alive; constructing a client per request wastes handshakes |
| Bound concurrency with a semaphore or worker pool | Unbounded fan-out trips 429s and makes latency worse, not better |
Backoff with jitter, honour retry-after | Synchronised retries create a thundering herd |
| Stream long generations | Avoids request timeouts, gives progress, and is required for very large max_tokens |
| Set an end-to-end deadline | Per-attempt timeouts multiply with retries |
| Make retried operations idempotent | A retry after a timeout on a succeeded call otherwise duplicates side effects |
| Handle backpressure | If your consumer is slower than the stream, buffer with a bound or cancel |
Serialization and data handling
- Deterministic JSON for anything inside a cached prefix — stable key order, no timestamps, no UUIDs.
- Base64 with no newlines for inline images and PDFs; prefer the Files API when the same asset is reused.
- Size limits are real: 32 MB per request, 600 pages per PDF (100 on 200K-context models).
- UTF-8 throughout, and never truncate input silently to make it fit — chunk it or say so.
Configuration and environment hygiene
| Item | Where it belongs |
|---|---|
| API keys and tokens | Environment or a secret manager — never source, never a committed settings file |
Model ID, effort, max_tokens, timeouts, retry policy | Environment-specific config, changeable without a code edit |
| Beta headers | Config, behind a flag — they are part of the request contract |
Region / inference_geo | Config, driven by the residency requirement |
| Logging destination and redaction rules | Config, with PII rules enforced in code |
Quiz
- Question 1
A browser-based chat UI must render tokens as they arrive. Which architecture is correct?
- Question 2
Which statement about the official Anthropic SDKs is correct?
Links
- https://platform.claude.com/docs/en/api/client-sdks
- https://platform.claude.com/docs/en/api/rate-limits
- https://platform.claude.com/docs/en/build-with-claude/streaming
- https://en.wikipedia.org/wiki/Server-sent_events
- https://en.wikipedia.org/wiki/WebSocket
- https://en.wikipedia.org/wiki/Representational_state_transfer