Skip to content

CCAR-P : Claude Models & Prompting (Domain 2)

Domain 2 : Claude Models, Prompting & Context Engineering Quiz

20 questionsmedium

This domain focuses on the technical precision required to select appropriate Claude models and engineer prompts and context windows for production-grade AI solutions. Achieving a balance between reasoning capability, latency, and cost necessitates a deep understanding of model tiers, caching mechanics, and structured prompting methodologies.

CCAR-P Model Selection Strategy and Tier Trade-offs

Architectural success begins with selecting the correct model tier based on the complexity of the workload and business SLAs. The exam prioritizes trade-off judgment across capability, cost, and latency.

Claude 3.5 Model Tiers Explained

TierOptimized ForIdeal Use Cases
Opus Class (Top Capability)Deep reasoning and hard multi-step logic.Complex multi-turn agentic loops, high-stakes reasoning, and long-horizon tasks where failure is expensive.
Sonnet Class (Balanced)Capability, cost, and latency in equilibrium.The enterprise production default for the majority of workloads; balances high performance with cost-effectiveness.
Haiku Class (Fast)Lowest cost and near-instant latency.High-volume, well-bounded tasks such as classification, routing, data extraction, and simple triage.

Claude Model Selection Rules for Production

  • Default to Sonnet: Start with the balanced tier. Upgrade to the Opus class only when evaluations (evals) demonstrate reasoning failures. Downgrade to the Haiku class only when evals prove that accuracy is maintained at a lower cost.
  • Model Routing Strategy: For large-scale systems, use a “triage” pattern. A fast-tier model (Haiku) analyzes the incoming request; if the task is simple, it processes it. If the task is complex, it escalates the request to a more capable tier (Sonnet or Opus). This prevents “quality cliffs” while optimizing spend.
  • Latency vs. Performance: User-facing paths requiring immediate feedback favor the fast tier combined with streaming. Batch processes or overnight workloads that tolerate slower processing can use the Batch API for cost reduction.

Advanced Claude Prompt Engineering Techniques

Prompting for professional applications requires moving beyond simple instructions toward structured, testable, and example-driven frameworks.

Core CCAR-P Prompting Methods: Zero-shot, Few-shot, CoT

  1. Zero-shot: Instructions provided without examples. Best suited for simple, unambiguous tasks where the model’s pre-trained knowledge is sufficient.
  2. Few-shot: Includes 2 to 4 worked examples. This is critical for teaching specific output formats and edge-case judgment.
    • Correct Rejection Examples: A robust few-shot prompt must include examples of what the model should not process (e.g., “If the user asks about Topic X, respond with: ‘I cannot assist with this.’”). This teaches the model to handle ambiguity and maintain safety boundaries.
  3. Chain-of-Thought (CoT): Explicitly asking the model to “reason step-by-step” before providing a final answer. This is essential for multi-step logic and mathematical tasks, though it increases output token consumption and latency.

Designing a Professional System Prompt Architecture

A professional system prompt should follow a specific structural hierarchy to ensure reliability:

  • Role Definition: Establish the persona and professional context first.
  • Testable Criteria: Replace vague instructions with verifiable benchmarks. (Example: Use “Flag SQL injection and authentication bypass” instead of “Be careful with security.”)
  • Boundary Statements: Clearly define what the model must never do or discuss.
  • Output Format Specification: Define the exact structure (JSON, Markdown, etc.) and schema requirements.

Mastering Prompt Caching Mechanics

Prompt caching allows the API to store the processed state of stable prompt prefixes. This skips reprocessing for repeated calls, significantly reducing latency and costs.

Prompt Cache Performance and Token Constraints

The effectiveness of caching depends on the stability of the prompt prefix.

  • Minimum Cacheable Sizes:
    • Sonnet/Haiku: Minimum 1024 tokens.
    • Opus: Minimum 2048 tokens.
  • Billed Savings: Cached “reads” are billed at a steep discount compared to fresh input tokens. Initial “writes” to the cache carry a small premium.

Cache Hit Conditions and Best Practices

  • Stable-First Structure: To maximize cache hits, place stable elements (system prompts, tool definitions, reference documents) at the beginning of the prompt. Place per-request variables (user IDs, timestamps, or unique queries) at the very end, after the cache breakpoint.
  • Invalidation Mistakes: Any change in the prefix—even a single character—breaks the cache from that point forward. Common mistakes include placing a dynamic timestamp at the top of a system prompt or reordering tool definitions between calls. Shuffling the order of reference documents will also invalidate the cache.

Claude Context Window Engineering

Managing the context window is a matter of optimizing “attention” and token consumption. Claude’s attention is not uniform; it concentrates at the beginning and end of the window.

Managing Model Attention and Context Pruning

  • The “Middle” Problem: In extremely long prompts, information in the middle is more likely to be overlooked (skimmed). Critical instructions and key facts should be placed at the very beginning or end of the context.
  • Tool Output Pruning: When an agent uses a tool, it often returns more data than necessary. Architects must trim these outputs to retain only the fields required for the next step before appending them to the conversation history. This prevents context bloat and maintains model focus.

Modular Prompt Strategies and Claude Skills

  • Modular Prompts: Instead of monolithic, drifting prompt variants, use modular components that can be assembled dynamically.
  • Claude Skills: These are packaged, reusable instruction sets and resources that allow Claude to perform recurring tasks consistently across teams. Skills prevent the need to copy-paste large instruction blocks into every request, reducing token waste.
  • Progressive Discovery: Instead of “monolithic context” (loading everything at once), use progressive discovery to load tools, schemas, and data on demand as the task narrows. This improves tool-selection accuracy and reduces costs.

Domain 2 Scenario-Based Practice Questions

1. A developer is building a legal research agent using Claude 3.5 Sonnet. The system prompt contains 1,500 tokens of stable reference law. However, the developer places a unique {{TIMESTAMP}} at the very beginning of the system prompt. How does this affect prompt caching? Answer: The cache hit rate will be 0%. Because the timestamp is at the beginning of the prefix, every call becomes unique. Prompt caching requires an identical prefix to trigger a hit; placing variable data first invalidates the entire cache for subsequent tokens.

2. An architect must choose a model for a customer support triage system that handles 50,000 requests per hour. The task involves categorizing tickets into one of five departments. Which model tier should be the primary choice? Answer: Haiku. This is a high-volume, well-bounded classification task where lowest cost and latency are the primary business constraints.

3. During testing of a multi-agent system, the “Synthesis Agent” consistently fails to include data retrieved by the “Search Agent.” Both agents use a shared system prompt, but the “Synthesis Agent” prompt is 150,000 tokens long, and the missing data is located in the middle of the input. What is the likely cause? Answer: Information loss due to attention concentration. Claude’s attention is strongest at the beginning and end of a context window. In a 150k token prompt, facts in the middle are frequently skimmed or missed.

4. You are designing a system prompt for a financial assistant. You want to ensure the model never provides specific stock “buy” recommendations. Which structure is most professional: “Please try to be helpful but don’t give stock advice,” or a specific boundary statement? Answer: A specific boundary statement in the system prompt. Professional prompts use explicit, testable criteria (e.g., “Refuse any request to provide specific ‘buy’ or ‘sell’ recommendations for individual ticker symbols”) rather than vague instructions like “try to be helpful.”

5. A RAG system is experiencing high costs due to repeated processing of a 5,000-token knowledge base. The architect decides to use prompt caching. Which model tier requires a larger minimum prefix to enable caching? Answer: The Opus class. It requires a minimum of 2048 tokens, whereas Sonnet and Haiku only require 1024 tokens.

6. A news summarization agent often hallucinates facts when asked about topics it hasn’t seen before. What prompting technique should be added to the few-shot examples to mitigate this? Answer: Correct rejection examples. By providing examples where the model identifies it lacks information and responds with a standard “I do not have information on this topic,” the architect teaches the model its boundaries.

7. An agentic loop is failing because the model is overwhelmed by a catalog of 100 different tools. What is the best architectural fix? Answer: Decompose the “mega-agent” into scoped subagents or implement progressive discovery. Giving an agent too many tools (capability bloat) degrades selection accuracy and burns unnecessary tokens.

8. You are using Claude 3.5 Sonnet for a coding assistant. You have a stable set of 800 tokens of coding standards. Will this benefit from prompt caching? Answer: No. For the Sonnet class, the minimum cacheable size is 1024 tokens. An 800-token prefix does not meet the threshold.

9. When designing a system prompt, where should the output format specification be placed for maximum effectiveness? Answer: At the end of the system prompt. According to the standard structural hierarchy, role definition and criteria come first, while the output specification concludes the prompt to ensure the model’s final focus is on the required structure.

10. A workflow requires the model to solve complex logic puzzles. Zero-shot prompting is failing. Which technique should be applied next to improve reasoning? Answer: Chain-of-Thought (CoT). Asking the model to reason step-by-step before providing the answer is specifically designed to handle multi-step logic and reasoning failures.


Domain 2 Practice Questions Answer Key

  1. Incorrect Options: Shifting the timestamp to the middle (this would still break the cache for everything following it). Correct Reasoning: Only stable-first, variable-last structures enable caching.
  2. Incorrect Options: Opus (too expensive/slow for simple triage); Sonnet (overkill unless the triage reasoning is extremely complex). Correct Reasoning: Haiku optimizes for the specific constraints of volume and latency in classification.
  3. Incorrect Options: Hallucination (the data is there, just ignored); Model failure (the model is capable, the prompt structure is the issue). Correct Reasoning: Attention patterns dictate that the “long middle” is a high-risk zone for data loss.
  4. Incorrect Options: “Be careful” (not testable). Correct Reasoning: Professional architecture requires deterministic, verifiable boundary statements.
  5. Incorrect Options: Sonnet (1024); Haiku (1024). Correct Reasoning: The directive specifies Opus has a higher minimum threshold (2048).
  6. Incorrect Options: More positive examples (only teaches what to do, not what to avoid). Correct Reasoning: Rejection examples are the primary tool for grounding and reducing hallucinations in few-shot prompting.
  7. Incorrect Options: Adding “be careful” to the prompt (does not solve the token/attention issue). Correct Reasoning: Scoping tools to the minimal set required for a specific subtask is the professional standard to avoid capability bloat.
  8. Incorrect Options: Yes (ignores the token minimum). Correct Reasoning: Thresholds are strict; 800 < 1024.
  9. Incorrect Options: At the beginning (role comes first). Correct Reasoning: The standard structure places format last to guide the immediate transition to the response.
  10. Incorrect Options: Few-shot (helps with format, but may not solve the underlying logic gap without reasoning steps). Correct Reasoning: CoT is the specific remedy for logic/reasoning failures.

Prompting and Context Reflection Questions

  1. Compare a Monolithic Context approach to a Progressive Discovery approach for a customer support agent. In what specific business scenario would the monolithic approach actually be superior?
  2. Analyze the cost-latency-capability trade-off. If a project has a strict latency budget of 200ms but requires high-reasoning accuracy, how would you design a multi-model routing strategy to meet both goals?
  3. Evaluate the risks of Capability Bloat. Beyond token costs, how does giving an agent too many tools impact the security and “blast radius” of a production system?
  4. Reflect on Prompt Caching. How would you restructure a dynamic RAG pipeline (where retrieved chunks change per query) to still benefit from caching?
  5. Consider Claude Skills. How does modularizing prompts into Skills improve the long-term maintainability of an AI system compared to using a single, version-controlled system prompt file?

Essential Glossary of CCAR-P Context Engineering Terms

  1. Opus Class: The highest-tier Claude model class, optimized for complex reasoning and multi-step tasks.
  2. Sonnet Class: The balanced Claude model tier, serving as the enterprise default for capability and speed.
  3. Haiku Class: The fastest and least expensive Claude model tier, optimized for high-volume, simple tasks.
  4. Prompt Caching: An API feature that stores stable prompt prefixes to reduce latency and processing costs.
  5. Zero-shot: A prompting technique where no examples are provided to the model.
  6. Few-shot: A prompting technique using a small number of worked examples to guide model behavior.
  7. Chain-of-Thought (CoT): A prompting strategy that requires the model to output its reasoning process step-by-step.
  8. Correct Rejection: A few-shot example that demonstrates when the model should refuse to answer or perform a task.
  9. System Prompt: A high-level set of instructions that defines the model’s role, criteria, and boundaries.
  10. Testable Criteria: Specific, verifiable instructions in a prompt that can be objectively evaluated.
  11. Context Window: The total number of tokens a model can “see” and process in a single request.
  12. Attention Concentration: The pattern where Claude prioritizes information at the beginning and end of its context window.
  13. Claude Skills: Packaged, reusable instruction sets designed for specialized or recurring tasks.
  14. Capability Bloat: A defect where an agent is provided with more tools or permissions than necessary for its specific task.
  15. Progressive Discovery: A technique where tools and data are loaded into the context only when they become relevant to the agent’s current step.

Leaderboard

No scores saved yet. Be the first!

20 Questions — Domain 2 : Claude Models, Prompting & Context Engineering Quiz

Expand any question to reveal the correct answer and explanation.

  1. 1 A solution architect is optimizing a production system using Claude 3.5 Sonnet that processes a static 800-token system prompt and a 150-token tool definition schema before each user request. Despite enabling prompt caching, the logs indicate a $0\%$ cache hit rate. What is the most likely cause?

    Check the specific token requirements for the Sonnet tier's caching feature.

    The total stable prefix length is below the minimum cacheable threshold for the Sonnet tier.

    For the Sonnet and Haiku tiers, the minimum cacheable prefix length is $1024$ tokens; the combined $950$ tokens in this scenario fail to trigger the caching mechanism.

    • Prompt caching is only supported for the Claude 3 Opus model tier.

      Caching is supported across Opus, Sonnet, and Haiku tiers, though the minimum token requirements vary between them.

    • The default TTL of 5 minutes is likely expiring between infrequent user requests.

      While TTL can cause misses, the prompt size itself is below the architectural requirement for the specific model tier to begin caching.

    • Tool definitions cannot be cached and must be placed after the cache breakpoint.

      Tool definitions are highly recommended for caching and should be placed early in the stable prefix to maximize cost savings.

  2. 2 An enterprise is designing a high-volume triage system where latency is the primary success pillar. The current architecture uses a single Claude 3 Opus instance. Which architectural refinement would best optimize for both cost and speed without a quality cliff?

    Consider how different model tiers can be combined to handle varying task complexities.

    Implement a routing layer using Haiku to escalate only complex queries to a more capable tier.

    Routing high-volume, well-bounded tasks to a fast tier while reserving premium tiers for difficult slices maintains quality while significantly reducing latency and spend.

    • Switch the entire workload to Sonnet and disable streaming to reduce overhead.

      Disabling streaming actually increases perceived latency for users, and a single-model approach misses the optimization benefits of a tiered routing strategy.

    • Increase the retrieval count in the RAG pipeline to provide Opus with more context.

      Adding more context to a premium model increases token costs and processing time, which contradicts the goal of optimizing for speed and cost.

    • Use the Message Batches API to process user-facing triage requests in parallel.

      The Batch API has a $24$-hour processing window, making it unsuitable for real-time triage where immediate response is required.

  3. 3 When configuring prompt caching for a multi-turn agentic loop, which ordering of prompt components is considered an architectural best practice to ensure the highest cache hit rate?

    The most stable information must be processed before the data that changes with every turn.

    System Instructions $\rightarrow$ Tool Definitions $\rightarrow$ Static Knowledge $\rightarrow$ Dynamic History.

    Structuring the prompt with the most stable content first ensures that the prefix remains identical across calls, allowing the cache to persist even as dynamic history grows.

    • User Message $\rightarrow$ System Instructions $\rightarrow$ Tool Definitions $\rightarrow$ Static Knowledge.

      Placing the variable user message at the beginning of the prompt invalidates the cache for all subsequent static content due to the exact-prefix matching rule.

    • Tool Definitions $\rightarrow$ Dynamic History $\rightarrow$ System Instructions $\rightarrow$ User Message.

      Mixing dynamic content into the middle of the prefix prevents the caching of stable instructions that follow it.

    • Static Knowledge $\rightarrow$ User Message $\rightarrow$ Dynamic History $\rightarrow$ Tool Definitions.

      This structure fragments the stable content, meaning only the first block would be eligible for caching before the user message breaks the prefix.

  4. 4 A developer is using few-shot prompting to improve a Claude-based data extraction tool. To minimize hallucinations when specific information is missing from a source document, which type of example should be included in the few-shot block?

    Think about how to show the model what to do when it cannot find the requested information.

    A 'correct rejection' example where the model returns a null or empty value for absent data.

    Including examples that demonstrate what to leave alone or how to handle missing data teaches the model to generalize judgment and reduces the likelihood of fabrication.

    • An example using Chain-of-Thought to guess the most likely missing value based on context.

      Encouraging the model to guess missing information directly increases the risk of hallucination, which is the failure mode being addressed.

    • A summary of the document's main themes to provide a broader context window.

      Broad context does not address the specific behavior of how to handle a missing field during a structured extraction task.

    • Multiple examples of similar valid data to reinforce the expected data types.

      Reinforcing only successful extractions doesn't provide the model with a boundary for when it should refrain from generating an answer.

  5. 5 In a Claude 3 Opus-powered system, a stable $3000$-token prefix is cached. If a developer accidentally inserts a dynamic 'Current Timestamp' variable into the middle of the system prompt (at token $500$), what is the immediate impact on prompt caching performance?

    Recall the exact-prefix matching rule and how modifications affect subsequent tokens.

    The entire cache downstream from token $500$ is invalidated for every request.

    Any modification occurring before a cache breakpoint changes the exact prefix, which invalidates all subsequent cached content regardless of its length.

    • The system will automatically create a new cache sub-layer for the timestamp.

      Claude's caching system relies on strict prefix matching and does not support automatic sub-layering for dynamic variables inserted within a prefix.

    • Only the specific $500$-token block containing the timestamp will be billed at the full rate.

      Caching is not block-based in a way that allows subsequent identical tokens to remain cached if the preceding prefix has changed.

    • The cache hit rate will remain unaffected if the timestamp is less than $10$ tokens.

      The length of the change is irrelevant; any change to the prefix, even a single character, results in a cache miss.

  6. 6 Which prompting technique is specifically recommended when a task involves multi-step logic and the architect is willing to trade higher output token counts and latency for improved reasoning accuracy?

    This technique involves the model explaining its work before providing the final answer.

    Chain-of-thought prompting.

    Asking the model to reason step-by-step before answering improves performance on complex logic, though it increases the number of generated tokens and overall response time.

    • Zero-shot prompting with explicit criteria.

      Zero-shot is best for simple, unambiguous tasks and does not provide the model with a structured reasoning path for complex logic.

    • Few-shot prompting with formatted examples.

      Few-shot is primarily used for teaching format and edge-case judgment rather than guiding the model through a step-by-step reasoning process.

    • Modular system prompts using Claude Skills.

      Claude Skills are for packaging reusable instructions and do not inherently force the model to perform intermediate reasoning steps for a specific query.

  7. 7 An architect notices that a Claude-based system frequently fails to follow instructions located in the middle of a $150,000$-token context window. This phenomenon is known as the:

    The term describes where the model's attention is weakest in a long document.

    'Lost in the middle' effect.

    Models reliably process information at the beginning and end of long inputs but often exhibit degraded attention and omit findings from the middle sections.

    • Context window saturation.

      Saturation implies the window is full, whereas this specific issue describes the loss of focus on content regardless of remaining capacity.

    • Token dilution error.

      This is not a standard term used in Claude documentation to describe attention decay within a large context window.

    • Progressive summarization risk.

      While summarization can lose details, it is a manual process or strategy, not the inherent model behavior of missing information in large inputs.

  8. 8 When designing system prompts for high-stakes enterprise applications, which type of instruction is most effective for improving precision and developer trust?

    Avoid vague adjectives and focus on instructions that can be clearly verified.

    Explicit, categorical, and testable criteria.

    Defining specific boundaries and testable rules is superior to vague instructions, as it allows for verifiable and reliable model behavior.

    • General boundary statements like 'be conservative'.

      Vague instructions like 'be conservative' are subjective and fail to provide the model with actionable guidance to reduce false positives.

    • Implicit role-play definitions without constraints.

      Defining a role without setting explicit constraints leads to unpredictable behavior and lack of reliability in production environments.

    • High-level guidance to 'only report high-confidence findings'.

      Self-reported confidence is often poorly calibrated in models, making this an unreliable instruction for systemic precision.

  9. 9 To standardize recurring tasks and prevent 'prompt bloat' where thousands of tokens of instructions are copy-pasted into every request, which Claude feature should an architect utilize?

    This feature packages specialized rules into reusable, modular sets.

    Claude Skills.

    Skills provide modular, reusable instruction sets that help Claude perform specialized tasks consistently while keeping individual request prompts lean.

    • Few-shot examples with structured JSON.

      While few-shot improves consistency, copy-pasting them into every request actually contributes to prompt bloat rather than solving it.

    • The Message Batches API.

      The Batches API is for bulk asynchronous processing and does not provide a mechanism for modularizing or reusing prompt instructions.

    • Dynamic Context Truncation.

      Truncation is a method for managing long conversation histories, not for standardizing or modularizing system-level instructions.

  10. 10 A nightly job processes $100,000$ extractions using Claude 3 Sonnet. The job is not time-sensitive but must stay within a strict budget. Which API feature provides the highest cost reduction for this specific scenario?

    This API feature is specifically designed for high-volume, non-urgent tasks with a major price discount.

    Message Batches API.

    The Batch API offers a $50\%$ cost discount for non-real-time workloads that can be processed within a $24$-hour window.

    • Prompt Caching.

      While caching saves money on repeated prefixes, the $50\%$ flat discount from the Batch API is typically the highest impact for bulk, non-real-time extractions.

    • Haiku-to-Sonnet Routing.

      Routing to a smaller model saves money but the Batch API provides a significant discount for the Sonnet model itself.

    • Context Window Truncation.

      Truncation reduces token count but doesn't offer a direct per-token pricing discount like the specialized Batch API.

  11. 11 What is a major risk associated with 'progressive summarization' as a context management strategy in a complex customer support application?

    Consider what might happen to specific, factual details when a long conversation is turned into a short summary.

    Condensing critical values like order numbers and dates into vague prose references.

    Summarizing conversation history can strip out specific numerical data, causing the model to give confident but incorrect answers in later turns.

    • Exceeding the maximum token limit of the Claude 3.5 Sonnet tier.

      Summarization is intended to reduce token usage and prevent hitting the limit, so exceeding it is not the primary risk of the strategy itself.

    • Increasing the latency of the first-token response due to summary overhead.

      Summaries are generally shorter than raw history, which typically reduces rather than increases the processing time for the input prefix.

    • Violating the exact-prefix matching rule for prompt caching.

      Summarization happens at the dynamic end of the prompt; it doesn't inherently break the caching of the stable system prompt at the beginning.

  12. 12 An architect is selecting a model for an LLM-as-judge evaluation framework to score the helpfulness of a Claude 3 Sonnet agent. According to best practices, which tier should the judge model belong to?

    To catch mistakes made by a certain model, you typically need a model with superior reasoning abilities.

    A stronger model tier, such as Claude 3 Opus.

    A judge must be at least as capable as the model it is evaluating to reliably identify errors and nuanced failures.

    • The same tier (Claude 3 Sonnet) to ensure parity.

      Using the same model often leads to 'self-evaluation bias' where the judge misses the same types of errors the candidate makes.

    • A faster, lower-cost tier like Claude 3 Haiku.

      Lower-tier models may lack the reasoning depth required to grade the output of a more sophisticated model accurately.

    • The choice of tier does not matter if the rubric is clear.

      Model reasoning capability is a critical factor in the effectiveness of an LLM-as-judge, regardless of the quality of the prompt rubric.

  13. 13 Claude 3.5 Sonnet supports context windows up to $200,000$ tokens standard. If a use case requires processing a massive corpus of $800,000$ tokens, what is the primary architectural consideration regarding performance?

    Check the documentation regarding the $1$M token context window and its associated trade-offs.

    Pricing and attention dynamics may change on tiers supporting the $1$M context window.

    While $1$M windows are available on supported tiers, pricing can change above the standard $200$K threshold, and attention decay must be managed.

    • Claude cannot process more than $200,000$ tokens in any configuration.

      Claude supports up to $1$M tokens on specific tiers, so $200,000$ is not an absolute hardware limit for the model family.

    • Latency will decrease as the model uses parallel processing for large windows.

      Processing larger context windows significantly increases latency because the model must attend to more tokens simultaneously.

    • Prompt caching is disabled for any request exceeding $200,000$ tokens.

      Caching is an effective tool for large windows, allowing the reuse of massive prefixes and actually mitigating some of the cost of large requests.

  14. 14 A developer needs to measure the exact number of tokens in a complex prompt to ensure it meets the minimum caching requirement. Which method is most reliable for Claude?

    Look for the specific API tool provided by Anthropic for this purpose.

    Using the dedicated 'count_tokens' endpoint.

    Token counting should always use the official endpoint, as character-based heuristics are inaccurate for LLM tokenization.

    • A standard character-to-token ratio (e.g., $4$ chars per token).

      Heuristics like $4$ characters per token are estimates and cannot be used for precise architectural planning or caching threshold validation.

    • Checking the word count in a text editor.

      Word counts are not equivalent to token counts, as tokenization often splits words or combines punctuation in unique ways.

    • Dividing the payload size in bytes by $8$.

      Byte size is related to encoding (like UTF-8) and does not correlate accurately with model-specific tokenization patterns.

  15. 15 When implementing a retry strategy for a Claude-based production application, which HTTP error code should NOT trigger an automatic retry?

    This error category usually implies that there is a problem with the formatting or content of your request.

    $400$ - Bad Request.

    $4xx$ errors (excluding $429$) are client-side errors indicating the request itself is malformed; retrying without modification will result in the same failure.

    • $529$ - Overloaded.

      $529$ is a transient server error, and retrying with exponential backoff is a recommended strategy for handling it.

    • $429$ - Rate Limit.

      While it's a client error, a $429$ indicates a temporary threshold hit, making it a candidate for retrying after a jittered backoff period.

    • $500$ - Internal Server Error.

      Server errors are often transient and can be resolved by retrying the request after a short delay.

  16. 16 Which header should be utilized to ensure safe retries on streaming requests and to enable better observability across a multi-step Claude solution?

    This header helps identify and track individual requests throughout their lifecycle.

    'anthropic-request-id'.

    Using unique request IDs allows for tracing and safe retries, ensuring idempotency and better debugging in complex production pipelines.

    • 'x-api-key'.

      The API key is for authentication only and does not provide session tracing or idempotency for specific request retries.

    • 'Content-Type: application/json'.

      This header defines the data format and does not contribute to request tracing or idempotent retry logic.

    • 'Cache-Control: max-age=3600'.

      This is a standard web caching header and is not used to manage Claude's internal prompt caching or request idempotency.

  17. 17 In a RAG-based system, an architect finds that the model returns confident but incorrect answers following a document refresh. If the model version and latency are unchanged, what is the most likely root cause?

    Map the symptom (confident but wrong) to the component that was recently modified (the data).

    The retrieval/indexing step is returning irrelevant or stale chunks.

    Confidence combined with inaccuracy after a document update suggests the model is being fed poor context from the retrieval pipeline, likely due to a broken re-index.

    • The model weights have silently shifted during an update.

      Model weights are static for a specific version; unpinned aliases might cause drift, but 'document refresh' points directly to the data pipeline.

    • The temperature setting is suddenly too low for creative retrieval.

      Low temperature usually increases determinism and grounding; it wouldn't cause a sudden shift to 'confident but wrong' specifically after a data update.

    • The prompt caching TTL has expired.

      Expired TTL results in cache misses and higher costs/latency, but it does not affect the factual accuracy of the model's response.

  18. 18 To minimize risk during the deployment of a new prompt version, an architect wants to run a 'regression suite'. Which evaluation methodology is most suitable for detecting subtle quality drops at scale?

    This methodology uses a second, more powerful model to grade the candidate's responses.

    LLM-as-judge using a rubric on a golden dataset.

    Automated scoring by a more capable model against a stable rubric is the most scalable way to catch nuanced regressions across large test sets.

    • Manual human review of every output in the suite.

      While human review is the gold standard, it is not scalable for frequent regression testing of large datasets during a deployment cycle.

    • Simple string-matching (regex) for expected keywords.

      String-matching is too brittle and cannot evaluate the 'subtle quality' or helpfulness that is critical in sophisticated AI systems.

    • Checking if the model refusal rate has decreased.

      Refusal rates are a safety metric, not a general quality metric; a decrease in refusals doesn't necessarily mean the quality of helpful responses has improved.

  19. 19 A developer observes that their Claude-based chat application's refusal rate has climbed $30\%$ week-over-week without any changes to the system prompt. What should be their first investigative hypothesis?

    Check how the model is identified in the API request (e.g., is it using a generic name or a specific date?).

    An unpinned model alias (e.g., 'claude-3-sonnet-latest') was updated to a newer dated version.

    Using latest aliases can cause silent behavioral drift when Anthropic releases updates; pinning to a dated version ensures reproducible behavior.

    • The prompt cache TTL was accidentally reduced.

      TTL affects cost and performance, not the model's tendency to refuse requests based on safety or policy filters.

    • Users have collectively started submitting more abusive content.

      While possible, it is statistically less likely than a version update as the primary cause for a sudden, sharp, system-wide shift in behavior.

    • The context window has become too small to process the requests.

      Context window size is determined by the model and request, not a setting that would cause a $30\%$ increase in refusals without crashing the request.

  20. 20 Which of the following is a critical 'trap' when designing multi-agent systems for latency-sensitive applications?

    Avoid redundant steps that move data back and forth between agents unnecessarily.

    Spawning a subagent to process data that is already available in the coordinator's context.

    Unnecessary delegation creates a bottleneck through the spawning and token transfer process, adding significant latency for no architectural benefit.

    • Using Claude 3 Opus as the coordinator for all tasks.

      While expensive, using a capable coordinator is a valid design choice; the 'trap' specifically refers to redundant and inefficient task spawning.

    • Configuring the 'allowedTools' parameter to include 'Task'.

      Including 'Task' is the required technical mechanism to enable subagent delegation, not an architectural trap.

    • Assigning 'citation_id' tags to source documents at the earliest stage.

      This is a best practice for maintaining provenance and attribution in multi-agent pipelines, not a latency-increasing trap.