Context Caching & Latency Optimization•20% of Exam Score
Conversational AI Architecture Patterns
Architecting low-latency, stateful conversational systems with Claude requires smart token economics, efficient cache reuse, and reliable session persistence.
Exam Syllabus Deep Dive
Core Architectural Principles Tested
Topic 1
Anthropic Prompt Caching Breakpoints
Re-sending large system prompts and tool schemas on every turn wastes money and increases Time to First Token (TTFT).
Architectural Best Practice:Place `cache_control: {'type': 'ephemeral'}` breakpoints on static system prompts and persistent reference documentation for 90% cost savings and 80% lower latency.
Topic 2
Sliding Window & Context Compaction
As conversation history expands, older turns dilute the model's attention and hit context limits.
Architectural Best Practice:Compact older turns into a rolling summary while preserving recent user and assistant exchanges verbatim.
Topic 3
Routing Classifiers & Latency Tiering
Sending trivial queries to Claude 3.7 Sonnet creates unnecessary latency and expense.
Architectural Best Practice:Route routine queries to Claude 3.5 Haiku, reserving flagship Sonnet models for complex reasoning, tool planning, and code generation.
High-Yield Exam Rules to Remember:
- Structure prompts so static content appears first to maximize cache hits.
- Never re-send full tool definitions if the conversation domain can be pre-classified.
- Use model tiering (Haiku for triage, Sonnet for deep execution) for optimal price-performance.
Interactive Practice
Sample Questions from this Domain (16 Total)
Sample Question #1 (Q#73)Conversational AI Architecture Patterns
Situation Context:Your `remove_team_member` tool uses a `dry_run: boolean` parameter for previewing impacts before execution. Production monitoring shows the agent bypasses the preview step by calling with `dry_run=false` directly. You need to ensure every removal is preceded by a preview that the user explicitly confirms.
What is the most reliable approach?
AAdd server-side validation that permits `dry_run=false` only when a `dry_run=true` call with identical parameters occurred within the past 60 seconds.
BAnnotate the tool as requiring confirmation and configure the orchestration layer to prompt the user for approval before forwarding any calls to annotated tools.
CAdd detailed instructions and few-shot examples to the tool description requiring the agent to always call with `dry_run=true` first and wait for user confirmation before calling again.
DReplace with two tools: `preview_remove_member` returns impact details and a single-use confirmation token; `execute_remove_member` requires that token, binding execution to the preview.
Explanation & Architectural Rationale:The two-tool token-binding approach makes it architecturally impossible to execute without a prior preview—the execute tool literally requires a token that only the preview tool can generate. This is the only approach that enforces the constraint at the code level rather than relying on LLM compliance with instructions (C), timing heuristics (A), or orchestration infrastructure (B).
Sample Question #2 (Q#74)Conversational AI Architecture Patterns
Situation Context:Production monitoring shows your `search_catalog` tool fails 12% of the time: 8% are network timeouts that succeed when retried, and 4% are query syntax errors that never succeed regardless of retries. Currently both error types are returned identically, causing wasted retries.
How should you modify the tool's error handling?
AAdd few-shot examples to your system prompt demonstrating how to distinguish network errors from syntax errors.
BApply exponential backoff retry logic to all errors uniformly.
CImplement automatic retry with backoff for network timeouts inside the tool; return syntax errors immediately with parameter validation details.
DReturn all errors with a `retryable` boolean flag and error type details.
Explanation & Architectural Rationale:Handling retries at the tool level for transient errors is the correct abstraction boundary—the tool has definitive knowledge of the error type and can implement deterministic retry logic without relying on the agent to interpret a flag (D) or follow prompt-level instructions (A). Uniform backoff (B) wastes time on syntax errors that will never succeed.
Sample Question #3 (Q#75)Conversational AI Architecture Patterns
Situation Context:Over several turns discussing investment strategy, a user stated "I have a very low risk tolerance" and later "I want to maximize my returns." They now ask: "What should I invest in?"
Which approach best ensures the recommendation aligns with the user's actual priority?
ASurface the contradiction and ask the user to clarify which matters more.
BProvide separate recommendations for both scenarios.
CProceed with the most recently stated preference.
DRecommend a balanced portfolio without addressing the conflict.
Explanation & Architectural Rationale:When user preferences directly contradict each other, surfacing the conflict and asking for clarification is the only way to guarantee the recommendation aligns with the user's true intent. Any other approach involves making an assumption that may be wrong—maximizing returns and low risk tolerance are fundamentally incompatible goals that require a human decision.