🎓 Claude Certification Prep

Home › CCDV-P › M02

Production Integration, Reliability, and Knowledge Grounding

Domain 2 20% of exam 60 practice questions ~24 min read

Handling errors and retries according to the type of signal, fallbacks across models and platforms, rate-limit strategy and Message Batches at scale, operating remote MCP and managing model/prompt changes, plus retrieval and grounding with citations.

Skills measured in this domain:
  • Reliability Engineering for Claude Services: retry and backoff, circuit breakers, graceful degradation, cross-model/region/platform fallbacks; rate limits vs refusals vs context-window stops
  • Scale and Throughput Management: rate-limit strategy, queueing and backpressure, batch pipelines, multi-tenant quotas, capacity planning
  • Production MCP and Change Management: remote MCP and authentication, tool and schema versioning, migration testing, prompt versioning, progressive rollout and rollback
  • Retrieval and Knowledge Grounding at Scale: agentic search vs RAG, chunking and embedding, hybrid search, reranking, citation, uncertainty; diagnosing failures by stage

Domain overview

Domain 2 accounts for 20% of the CCDV-P exam. Items usually present an error trace, a throughput table, or a description of an incident after a model change, and then ask where you should fix it. The domain covers four skill areas:

  1. Reliability: retry/backoff, circuit breakers, graceful degradation, fallbacks across models/regions/platforms. Distinguishing 429, 529, refusals, and stops caused by max_tokens or the context window.
  2. Scale & throughput: rate-limit strategy, queueing and backpressure, Message Batches pipelines, multi-tenant quotas, capacity planning.
  3. Production MCP & change management: authenticated remote MCP, versioning of tools/schemas and prompts, testing on model changes, configuration parity, gateways, rollout and rollback.
  4. Retrieval & grounding: agentic search or RAG, chunking, hybrid retrieval, reranking, citations, declaring uncertainty, diagnosing failures by stage.

(Source: CCDV-P Exam Guide, Domain 2)

Reliability: classify the error before retrying

Signals and actions

Rule number one: each type of signal needs its own action. A single retry loop for every error wastes money on errors that never clear by themselves, and misses the cases that return HTTP 200.

Signal Meaning Correct action
429 rate_limit_error with retry-after RPM/ITPM/OTPM exceeded Wait for retry-after, back off, reduce the send rate
429, error.details.error_code: "enforced_spend_limit_reached" Monthly spend cap reached Do not retry (there is no retry-after); raise the limit or alert
429, error_code: "ramp_limit_exceeded" Traffic increased too quickly, even though ITPM/OTPM has not been reached Ramp up gradually, at most one step per minute; move bulk jobs to Batches
529 overloaded_error High load across the whole system Back off, spread the load, queue, or switch models (Haiku is usually less loaded)
500 api_error, 504 timeout_error Server error or timeout Retry with backoff; use streaming or Batches for long requests
400 invalid_request_error Malformed request (unsupported parameter, prefill on a newer model...) Fix the request; resending it unchanged will never succeed
401 / 403 / 404 Wrong credentials, missing permissions, wrong endpoint or model ID Fix the configuration, do not retry
413 request_too_large Size limit exceeded (Messages 128 MB, Batch 256 MB) Reduce the payload
HTTP 200, stop_reason: "refusal" The model declined for safety reasons Do not resend to the same model; fall back or inform the user
HTTP 200, stop_reason: "max_tokens" Output budget exhausted Raise max_tokens or ask the model to continue
HTTP 200, model_context_window_exceeded Context window exhausted Shrink the context (compaction, context editing)
HTTP 200, stop_reason: "pause_turn" The server tool loop hit its 10-iteration limit Send the response back to continue

(Sources: Claude Docs: Claude API errors; Anthropic Skills: claude-api — HTTP Error Codes Reference, Tool Use Concepts)

Exam trap

A refusal returns HTTP 200 with stop_reason: "refusal" and stop_details (containing type, category, explanation). Retry logic based on HTTP status never sees it. Branch on stop_reason; don't guess by reading the text. stop_details is null for every other stop_reason.

Retry, backoff, and jitter

  • The official SDKs retry 2 times automatically with exponential backoff and honor retry-after; adjust this with max_retries. Retried errors: 429, 500, 529, and connection errors.
  • Anthropic's eval-runner guidance calls for jittered backoff on 429/overloaded, a cap on the number of attempts, and recording the retry count. Retrying without delay silently multiplies cost and can ruin an entire batch.
  • Errors can arrive mid-stream after HTTP 200, as an SSE error event (for example overloaded_error).
  • Log the request-id for every error (on Claude Platform on AWS, the ID is x-amzn-requestid).
  • Requests estimated to take longer than 10 minutes need streaming or Batches; the SDK rejects non-streaming requests expected to exceed 10 minutes.

Recovering an interrupted stream. On 4.6 models and later, put the text already received into a user message: "Your previous response was interrupted and ended with [previous_response]. Continue from where you left off." tool_use and thinking blocks cannot be partially recovered.

(Sources: Anthropic Skills: claude-api — HTTP Error Codes Reference, Building an Eval for a Claude-Powered Application; Claude Docs: Streaming messages)

Circuit breakers, graceful degradation, and idempotency

These are general practices listed in the exam guide; the API has no parameter by these names.

  • Circuit breaker: after a run of consecutive 529/5xx errors on one model or platform, "open the circuit" and go straight to the backup path for a cool-down period, then send a few probe requests (half-open).
  • Graceful degradation: degrade instead of failing outright, for example by using a smaller model, turning off secondary features, returning cached results, or queuing non-urgent work into Batches.
  • Idempotency: a retry means an action may run twice, so tools with side effects (refunds, sending email) need an idempotency key. Managed Agents webhooks can deliver the same event more than once with the same event.id (equal to the webhook-id header), so you must dedupe on that ID. Each event is delivered at most 3 times (jittered backoff of 5–120 seconds); if the last attempt fails, the event is dropped, so you need to reconcile by re-fetching the resource.

(Source: Anthropic Skills: claude-api — Managed Agents: Webhooks)

Key point

Retries only fix transient errors (429 with retry-after, 500, 529, lost connections). Deterministic errors (400, 401/403/404, 429 from the spend cap, refusals) require a change to the request, the configuration, or the model. Retrying them only costs money and hides the cause.

Fallbacks across models, regions, and platforms

Fallback on refusal (server-side)

  • fallbacks: [{"model": "claude-opus-4-8"}] (beta server-side-fallback-2026-06-01) or fallbacks: "default" (beta server-side-fallback-2026-07-01). When the primary model refuses, the API automatically reruns on the fallback model within the same request.
  • A {"type": "fallback"} block marks each switch. message.model is the model that answered; usage.iterations is the source of truth for cost and analytics.
  • If the fallback cannot run, the response is still a refusal, with stop_details.recommended_model.
  • Available only on the Claude API and Claude Platform on AWS; not on Bedrock, Vertex, or Foundry, and not usable in Message Batches. Haiku 5.5 returns 400 if you send fallbacks.

Exam trap

Common anti-patterns: enabling fallback on only some request paths (forgetting the "try again" button, regenerate, the turn after a tool result); leaving the fallback off subagent calls (every agent needs it, and only the agent that was refused switches models); resending to the same model after a refusal (it will refuse again); building analytics on the requested model instead of usage.iterations.

(Sources: Claude Cookbooks: Classifier Fallback & Billing; Anthropic Skills: claude-api — HTTP Error Codes Reference)

Fallback on overload and parity across platforms

For 529, fallback is a client-side decision: switch the model, region, or platform. Before adding a platform to failover, check feature parity against the Platform Availability table in the claude-api skill (Anthropic Skills).

Feature Claude API Platform on AWS Bedrock Vertex Foundry
Messages, streaming, tool use, citations, prompt caching Yes Yes Yes Yes Yes
Message Batches Yes Yes No No No
Server-side fallbacks beta beta No No No
MCP connector beta beta No No beta
Files API Yes Yes No No beta
inference_geo Yes Yes No No No

Three more points for failover:

  • Model IDs differ. Bedrock uses the anthropic. prefix (for example anthropic.claude-opus-5-5); sending a first-party ID to a Bedrock client returns 400. Vertex uses the bare ID plus project_id/region.
  • Cold cache. The prompt cache is isolated per workspace (per organization on Bedrock/Vertex), and changing the model chain also invalidates the cache.
  • Rate limits are shared across inference_geo values: switching geo does not add capacity.

(Sources: Anthropic Skills: claude-api — Platform Availability, Model Migration Guide, Prompt Caching: Design & Optimization; Claude Docs: Rate limits)

Scenario example

A team configures failover from the Claude API to Bedrock on 529. During failover, chat works, but the nightly pipeline and the agents that use the MCP connector all fail. Cause: Bedrock has neither Message Batches nor the MCP connector, and the code still sends first-party model IDs. Fix: build a parity matrix for each workload. Chat uses IDs with the anthropic. prefix, the batch pipeline queues and waits instead of failing over, and the MCP agents move to Claude Platform on AWS or Foundry.

Scale & throughput

Token bucket and rate-limit dimensions

  • Rate limits use a token bucket: capacity is replenished continuously rather than reset every minute. Limits are maximums, not guarantees, and may be enforced over shorter intervals: 60 RPM can become 1 request/second, so short bursts still hit 429.
  • RPM, ITPM, and OTPM apply per model class. Some models share a bucket: the Opus 4.x models, Fable 5.1 with Fable 5, the Sonnet 4.x models.
  • ITPM is cache-aware: cache_read_input_tokens do not count toward ITPM. With 2M ITPM and an 80% cache hit rate, effective throughput is equivalent to 10M input tokens per minute.
  • OTPM counts only tokens actually generated; max_tokens has no effect.
  • Headers: retry-after, anthropic-ratelimit-requests-*, anthropic-ratelimit-tokens-* (the most restrictive value), anthropic-ratelimit-input-tokens-*, anthropic-ratelimit-output-tokens-*.
  • Spend cap by tier: Start $500, Build $1,000, Scale $200,000, Custom unlimited. Example limits for Claude Opus 5.5: Start 4,000 RPM / 2M ITPM / 400k OTPM, Scale 13,000 RPM / 10M ITPM / 2M OTPM.

(Source: Claude Docs: Rate limits)

Identifying the binding constraint

Capacity planning starts with one question: which dimension hits its ceiling first? Raising RPM does nothing if ITPM is the dimension being throttled.

Scenario example

A Q&A service uses Claude Opus 5.5 on the Start tier (4,000 RPM, 2M ITPM, 400k OTPM). At peak there are 600 requests/minute, each with about 6,000 input tokens (5,000 of them a shared system prompt and documents) and 400 output tokens.

  • RPM: 600 against 4,000, plenty of headroom.
  • ITPM without caching: 600 × 6,000 = 3.6M, above 2M. This is the binding constraint.
  • OTPM: 600 × 400 = 240k against 400k, plenty of headroom.

If you cache the shared portion, only about 1,000 tokens per request count toward ITPM, i.e. 600k, within the limit. The answer is prompt caching; raising RPM or lowering max_tokens does not touch the dimension that is being throttled.

Exam tip

With a throughput table, multiply the request count by the tokens for each dimension and compare with the limit. The correct option acts on the dimension that exceeds its ceiling: for ITPM, cache or trim the context; for OTPM, shorten the output; for RPM, consolidate requests. "Request a higher tier" is usually a trap when a cheaper option exists.

Queueing, backpressure, and multi-tenancy

  • Queue and backpressure (general practice): put a queue in front of the API and read the anthropic-ratelimit-*-remaining headers to pace how fast it drains. When the queue exceeds a threshold, slow down or reject producers instead of letting every worker retry in a storm.
  • Ramp limit: a sudden traffic increase can get 429 ramp_limit_exceeded even before ITPM/OTPM is reached. Start bulk jobs at a low rate and then spread them evenly; Batches are not subject to the ramp limit.
  • Workspace limits isolate tenants/workloads: set limits below the org's for each workspace (for example, org 40,000 ITPM, batch workspace 30,000). You cannot set a spend limit on the default workspace, the org limit always applies, and this feature is not available on Claude Platform on AWS.
  • The prompt cache and Batches are both isolated per workspace, so separating tenants by workspace also separates their caches.

(Source: Claude Docs: Rate limits)

Message Batches pipelines

Criterion Messages API (real-time) Message Batches
Price Standard 50% off, stacks with the cache discount
Latency Seconds Most finish in under 1 hour; expire after 24h
Rate limits RPM/ITPM/OTPM, ramp limit Separate limits; does not consume Messages limits
Size 128 MB/request Up to 100,000 requests or 256 MB/batch
Not supported stream, speed, fallbacks, max_tokens: 0

A sound pipeline design:

  1. Dry-run one request with the Messages API first, because parameters in a batch are validated asynchronously.
  2. Set a unique custom_id matching ^[a-zA-Z0-9_-]{1,64}$. Results come back out of order and must be matched by custom_id.
  3. Poll processing_status until ended. Results are kept for 29 days.
  4. errored, canceled, and expired results are not billed; resend only those requests in a new batch.
  5. A submitted batch cannot be edited; to change it, cancel and resubmit.

Caching in batches is best-effort only (hit rates of about 30–98%); use identical cache_control and a 1-hour TTL to raise the hit rate. Batches are not ZDR-eligible.

(Sources: Claude Docs: Batch processing; Claude Docs: Rate limits)

Exam trap

Batches suit offline work (classification, evals, data generation), not users who are waiting. "Most finish in under 1 hour" is not an SLA. Batches also have no server-side fallback, so refusals inside a batch must be handled in a post-processing step.

Production MCP & change management

Authenticated remote MCP

The MCP connector (beta mcp-client-2025-11-20) lets the Messages API call remote MCP servers. It needs both parts: mcp_servers (type: "url", url, name, optional authorization_token) and a {"type": "mcp_toolset", "mcp_server_name": ...} tool. A missing toolset is a validation error. To allowlist, set default_config: {"enabled": false} and then enable individual tools in configs.

With Managed Agents, the agent declares mcp_servers, while a vault holds the credentials (mcp_oauth or static_bearer), matched by server URL:

  • OAuth tokens are refreshed automatically; credentials never enter the sandbox, and a proxy injects them into requests.
  • vault_ids is create-only: you cannot attach another vault to an existing session.
  • Bad credentials do not block session creation. A session.error event describes the auth failure, and auth is retried on the next idle → running transition. Fixing the credential in the vault is enough.
  • Hosted MCP servers need an OAuth bearer, not a REST API token. The default permission for MCP tools is always_ask.

If you self-host an MCP server behind a load balancer, use StreamableHTTP with stateless_http=True to scale horizontally. In exchange, you lose session IDs, server-to-client requests, sampling, progress, and subscriptions. Test with the same transport you use in production.

(Sources: Anthropic Skills: claude-api — Managed Agents: Tools & Skills, Managed Agents: Core Concepts; Anthropic Academy: Model Context Protocol: Advanced topics — The StreamableHTTP transport)

Versioning tools, schemas, and prompts

  • Changing tools changes the cache prefix. The prefix order is tools → system → messages, so editing a tool definition invalidates the cache for everything after it.
  • Schema changes can break running clients: add the new version alongside the old one, shift traffic gradually, and only then remove the old version (general practice).
  • Prompts are code. Anthropic's April 23 postmortem: one system-prompt line requiring "≤25 words between tool calls" lowered eval scores by 3%, and it was found only through ablation (removing one line at a time and measuring). Lesson: run a broad, per-model eval suite for every system prompt change, and add a soak period and a gradual rollout.

(Sources: Anthropic Skills: claude-api — Prompt Caching: Design & Optimization; Anthropic Engineering: An update on Claude Code quality reports)

Testing on model changes

The migration checklist splits changes into [BLOCKS] (causing 400s, loops, or timeouts) and [TUNE] (quality adjustments only):

  • Confirm the exact model ID; a guessed ID returns 404.
  • Remove parameters that are prohibited on the new model, for example temperature/top_p/top_k and budget_tokens on Opus 5.5, Opus 4.8, and Opus 4.7; prefill is rejected on 4.6+.
  • Test one request first, checking stop_reason, usage, tool behavior, and thinking, before rolling out.
  • Watch for silent default changes. Opus 4.7 hides thinking content by default. A different tokenizer means different token counts: re-measure with count_tokens (not a blanket multiplier), then update your cost estimator and rate-limit thresholds.
  • Overly forceful prompt language (CRITICAL, MUST) easily makes newer models overtrigger. Add handling branches for refusal and model_context_window_exceeded.

(Source: Anthropic Skills: claude-api — Model Migration Guide)

Key point

No HTTP errors does not mean it is safe. Compare the distribution of stop_reason, usage (input/output/cache), the refusal rate, and eval scores between the old and new versions on real traffic before increasing the rollout percentage.

Gateways, configuration parity, and rollout

  • Gateway: ANTHROPIC_BASE_URL routes Claude Code/Agent SDK requests through a proxy that can inspect and modify requests and inject credentials (for example LiteLLM, or Envoy with credential_injector to enforce an allowlist and log traffic).
  • Configuration parity: model IDs, beta headers, and feature lists must be managed per platform; don't copy the 1P configuration over as is.
  • Progressive rollout: canary → soak → gradually increasing percentages, with clear rollback criteria. The August–September 2025 postmortem shows the limits of canaries: three infrastructure bugs (context-window misrouting, output corruption on TPUs, an approximate top-k compilation bug) slipped past benchmarks and canaries because the evals were too noisy, and sticky routing meant some users were affected repeatedly. Remedies: more sensitive evals, running quality evals continuously on real production traffic, and fast debugging tools that still preserve privacy.

(Sources: Claude Code Docs: Securely deploying AI agents; Anthropic Engineering: A postmortem of three recent issues)

Scenario example

After 10% of traffic moves to a new model, there are no 4xx/5xx errors, but input cost rises noticeably and the cost estimator diverges from the invoice. What to do: hold at 10% (or roll back), re-measure tokens with count_tokens on a sample of real traffic, update the estimator and rate-limit thresholds, and only then increase the percentage. Increasing to 50% to "get more data" is wrong.

Retrieval & grounding

Choosing a knowledge-delivery strategy

Situation Strategy
Knowledge base under about 200,000 tokens (~500 pages) Put it straight into the prompt with prompt caching enabled; no RAG needed yet
Large, fairly static knowledge base that needs fast lookup RAG: chunking, embedding, hybrid retrieval, reranking
Dynamic information that requires multi-step exploration Agentic search: Claude calls search tools iteratively and receives results as search_result

Agentic search trades latency and tokens for the ability to refine its own queries. Programmatic tool calling cut input tokens by 24% on an agentic search benchmark because only filtered results enter the context.

Chunking: fixed-size with overlap is the default choice in production (it works for code too); structure-based is best when you control the format; sentence-based is the middle ground; semantic is the most expensive. Anthropic does not offer an embedding model and recommends VoyageAI.

(Sources: Anthropic Engineering: Contextual retrieval in AI systems; Anthropic Academy: Building with the Claude API — RAG and Agentic Search; Anthropic Skills: claude-api — Cost Optimization: Cutting Spend per Completed Task)

Contextual Retrieval, hybrid search, and reranking

A chunk cut out of its document often loses context ("revenue grew 3%": which company, which quarter?). Contextual Retrieval uses Claude to generate a 50–100 token context snippet for each chunk and prepends it to the chunk both when embedding (Contextual Embeddings) and when building the BM25 index (Contextual BM25).

Configuration Retrieval failure rate (top-20)
Baseline 5.7%
Contextual Embeddings 3.7% (35% reduction)
+ Contextual BM25 2.9% (49% reduction)
+ Reranking 1.9% (67% reduction)
  • Generating the context costs about $1.02 per million document tokens, thanks to prompt caching.
  • BM25 is good at catching exact identifiers such as "Error code TS-999", where embeddings often miss. Hybrid runs both and merges them with reciprocal rank fusion: RRF_score(d) = Σ 1/(k + rank_i(d)), usually with k = 60.
  • Reranking: retrieve the top 150, then a reranker picks the top 20, at the cost of extra latency and expense.
  • The top 20 chunks work better than the top 10 or top 5; a generic summary of the document helps very little. Always measure with evals.

(Sources: Anthropic Engineering: Contextual retrieval in AI systems; Anthropic Academy: Building with the Claude API — RAG and Agentic Search)

Citations and declaring uncertainty

  • Enable citations: {"enabled": true} on all documents or none. PDFs are cited by page, plain text by character, and custom content by block (with no further splitting).
  • cited_text does not count toward output tokens and always points accurately into the source. A document's title and context are not cited.
  • Citations combined with structured outputs (output_config.format) return 400.
  • A search_result block (source, title, content) carries citations of type search_result_location and goes in a tool result or a user message. Citations are off by default and must be consistent across all results.

Reducing hallucinations: allow the model to say "I don't know"; for documents over 20k tokens, extract verbatim quotes first and analyze afterwards; require every claim to have a citation and retract claims that have no supporting quote; compare multiple generations (best-of-N) to spot contradictions.

(Sources: Claude Docs: Citations; Claude Docs: Search results; Claude Docs: Reduce hallucinations)

Key point

Good grounding means the answer is traceable to a source and the model says so clearly when the evidence is insufficient. Citations provide verifiable evidence; a prompt that permits "I don't know" keeps the model from having to make things up.

Diagnosing failures by stage

Symptom Suspected stage How to check and fix
Tables in PDFs are broken, paragraphs are jumbled Ingestion Inspect the extracted text; fix the parser
The right chunk is found but lacks the subject or a time reference Chunking Contextual Retrieval; adjust boundaries, size, overlap
Queries for an exact error code or ID miss Embedding/retrieval Add BM25 (hybrid)
The right chunk is in the top 150 but drops out of the top 20 Reranking Tune or replace the reranker, revisit the cutoff
The right chunk is in the context but the answer is still wrong or fabricated Generation Citations, extract verbatim quotes first, allow "I don't know"

Measure retrieval recall (whether the right chunk is in the top K) separately from answer correctness. If retrieval is already correct but the answer is wrong, fixing the embeddings is pointless.

Exam trap

When the item says "the chunk containing the answer is in the context", the failure is in generation, not retrieval. Don't tune the answer-generation prompt when the right chunk was never retrieved.

Quick summary

  • Classify first, retry second: retry only transient errors (429 with retry-after, 500, 529, connection errors) with jittered backoff and a cap on attempts.
  • A 429 from the spend cap (enforced_spend_limit_reached) has no retry-after and will keep failing; a 429 ramp_limit_exceeded is handled by increasing traffic gradually.
  • A refusal is HTTP 200 with stop_reason: "refusal"; branch on stop_reason and do not resend to the same model.
  • Server-side fallback (fallbacks) is available only on the Claude API and Claude Platform on AWS, and not in Batches; read usage.iterations to compute cost.
  • Failing over to another platform needs a parity matrix: Bedrock/Vertex have no Batches or MCP connector, Bedrock uses IDs with the anthropic. prefix, and the cache will be cold.
  • Circuit breakers, graceful degradation, and idempotency are client/gateway practices; dedupe webhooks by event.id.
  • Rate limits are token buckets per model class; cache reads do not count toward ITPM, and OTPM counts only tokens actually generated.
  • Find the dimension over its ceiling (RPM/ITPM/OTPM) before choosing a fix; when ITPM is exceeded, prompt caching comes first.
  • Batches: 50% off, up to 100,000 requests/256 MB, expire after 24h, match results by custom_id, dry-run with the Messages API first.
  • Workspace limits isolate tenants (no spend limit can be set on the default workspace). The MCP connector needs both mcp_servers and mcp_toolset; Managed Agents vault_ids is create-only.
  • Model changes: check the ID, remove [BLOCKS] parameters, test one request, re-measure tokens with count_tokens. Prompt changes: broad evals, ablation, soak, gradual rollout with rollback criteria.
  • Knowledge bases under ~200k tokens go straight into the prompt with caching; large ones use Contextual Retrieval + hybrid BM25 + reranking (67% fewer retrieval failures).
  • Diagnose RAG by stage: separate retrieval recall from answer correctness before fixing anything.