CertSafari
    Anthropic Claude Certified Architect – Professional (CCAR-P)· Lessons

    Domain 2 · Lesson 11/38

    Prompt Caching and Modular Prompt Layout

    Implement prompt reuse strategies

    11 min read
    2.6% of exam
    3 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    What you will be able to do

    • Explain how prompt caching reuses a stable prompt prefix and when it pays off
    • Choose between automatic caching and explicit cache breakpoints, and combine them
    • Reason about TTLs and cache pricing, including the model-specific read multipliers
    • Lay out a prompt as stable modules followed by variable content so that edits don't invalidate the cache

    Key concept

    Cached prompt prefix — Prompt caching does not reuse whole requests. It reuses the longest unchanged opening stretch of a request, up to a cache breakpoint. Anything you want to reuse cheaply has to sit at the front of the prompt and stay byte-for-byte the same from one request to the next.

    1.Reuse starts with a stable prefix

    Many prompts share most of their text across calls: the same system instructions, the same examples, the same reference material, with only the user's question changing at the end. Prompt caching lets the API skip reprocessing that shared part. When a request arrives with caching enabled, the system checks whether the prompt prefix up to a cache breakpoint is already cached from a recent query. If it is, the cached version is used, which cuts both processing time and cost. If it isn't, the full prompt is processed and the prefix is written to the cache once the response begins, ready for the next call.

    The documentation lists where this pays off most: prompts with many examples, large amounts of context or background information, repetitive tasks with consistent instructions, and long multi-turn conversations. In each case a large block stays the same while a small part varies. Caching is available on every active Claude model, so the deciding question is how much of your prompt is genuinely stable, not which model you use.

    Checkpoint 1 of 6· Check yourself

    A request with caching enabled finds no cached entry for its prefix. What happens?

    Checkpoint 2 of 6· Exam question

    An agentic workflow sends requests with a large tools array (15 tool definitions, cached), a cached system prompt, and growing conversation history. For one request, the developer adds tool_choice: {"type": "tool", "name": "search"} to force a specific tool call, while leaving the tools array, system prompt, and message content unchanged. What happens to prompt caching for this request?

    Sources1

    2.Automatic caching and explicit breakpoints

    You can turn caching on in two ways. With automatic caching, you add one cache_control field at the top level of the request. The system puts the breakpoint on the last cacheable block and moves it forward as the conversation grows. On each turn, everything up to the previous turn is read from cache and only the new turn is written. You never edit markers by hand, which is why automatic caching suits multi-turn chat. With explicit breakpoints, you put cache_control on individual content blocks, so you decide exactly where a cached segment ends.

    Checkpoint 3 of 6· Fill the gap

    Which top-level parameter turns on automatic caching in this request?

    response = client.messages.create(
        model="claude-opus-5-5",
        max_tokens=1024,
         ? ={"type": "ephemeral"},
        system="You are a helpful assistant that remembers our conversation.",

    The two approaches can be combined. A common pattern is to put an explicit breakpoint on the system prompt, which is the reusable module, and let automatic caching follow the growing conversation. Two rules come with this. First, a request has 4 breakpoint slots, and the automatic breakpoint takes one of them. Second, if the last block already carries an explicit cache_control with the same TTL, automatic caching adds nothing. Pricing, minimum token thresholds, ordering requirements and the 20-block lookback window are identical for both approaches, because they run on the same infrastructure.

    Explicit breakpoint on the system prompt plus top-level automatic caching for the conversationjson
    {
      "model": "claude-opus-5-5",
      "max_tokens": 1024,
      "cache_control": { "type": "ephemeral" },
      "system": [
        {
          "type": "text",
          "text": "You are a helpful assistant.",
          "cache_control": { "type": "ephemeral" }
        }
      ],
      "messages": [{ "role": "user", "content": "What are the key terms?" }]
    }

    Sources1

    3.TTLs and what caching costs

    By default a cache entry lives for 5 minutes, and every hit refreshes it at no extra cost. That lifetime starts when the request begins, not when its response ends, so a long generation eats into the window before your follow-up can arrive. If requests come in less often, you can set a 1-hour TTL with "ttl": "1h". Writes at that TTL cost 2x the base input price.

    Requesting the 1-hour TTLjson
    { "cache_control": { "type": "ephemeral", "ttl": "1h" } }

    Cache writes cost more than base input and cache hits cost much less, so caching saves money only when a prefix is read more often than it is written. The discount on reads also varies by model. Most models charge 0.1x base input for a hit, but Claude Opus 5.5 charges 0.05x, and Claude Fable 5.1 and Claude Mythos 5.1 charge 0.025x.

    Per-million-token prices for current models (base input vs cache writes and hits)
    ModelBase input5m cache write1h cache writeCache hits and refreshes
    Claude Fable 5.1$10 / MTok$12.50 / MTok$20 / MTok$0.25 / MTok
    Claude Opus 5.5$4 / MTok$5 / MTok$8 / MTok$0.20 / MTok
    Claude Sonnet 5.5$2 / MTok$2.50 / MTok$4 / MTok$0.20 / MTok
    Claude Haiku 4.5$1 / MTok$1.25 / MTok$2 / MTok$0.10 / MTok

    Checkpoint 4 of 6· Check yourself

    What do cache hits on Claude Opus 5.5 cost relative to its base input price?

    Sources1

    4.Modular prompts: stable modules first, variables last

    These sources do not describe a dedicated prompt-template syntax. They treat a modular prompt as a matter of structure: split the prompt into self-contained blocks that stay the same across calls, and keep them separate from the content that changes. Anthropic's customer-support guide works this way. It defines each body of product knowledge once as a named constant wrapped in a <static_context> tag, then repeats the pattern for each product line, and assembles the prompt from those modules.

    A reusable static-context module defined once and assembled into promptspython
    STATIC_CAR_INSURANCE = """
    <static_context>
    Car Insurance Coverage:
    Acme's car insurance policies typically cover:
    1. Liability coverage: Pays for bodily injury and property damage you cause to others.
    2. Collision coverage: Pays for damage to your car in an accident.
    3. Comprehensive coverage: Pays for damage to your car from non-collision incidents.
    4. Medical payments coverage: Pays for medical expenses after an accident.
    5. Uninsured/underinsured motorist coverage: Protects you if you're hit by a driver with insufficient insurance.
    
    Optional coverages include:
    - Rental car reimbursement
    - Roadside assistance
    - New car replacement
    </static_context>
    """

    Caching determines where those modules should go. The cache follows a fixed prefix hierarchy, tools → system → messages, and a change at any level invalidates that level and everything after it. Put the most stable modules (tool definitions, then system instructions and static context) at the front, and let per-request content come last in messages. That way the variable part changes on every call without disturbing the cached prefix. Some request settings can also break the cache even when your text is unchanged.

    What a change invalidates under the tools → system → messages hierarchy
    ChangeInvalidates
    Modifying tool definitionsEntire cache (tools, system, messages)
    Toggling web search or citationsSystem and messages caches
    Changing tool_choiceMessages cache
    Toggling images present/absentMessages cache

    Checkpoint 5 of 6· Match them up

    Match each mid-session change to the cache it invalidates

    Tap a term, then the definition that fits it.

    Checkpoint 6 of 6· Exam question

    A long agent session accumulates conversation turns using only automatic request-level caching. By turn 15, a cache entry exists at content block 12. By turn 25, the conversation has grown to 35 content blocks, and the current breakpoint sits on the last block. Cache reads stop matching even though the early conversation content hasn't changed. What is the best explanation and fix?

    Sources23

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.The 5-minute cache TTL starts counting when the response finishes.Why is that wrong?

      The lifetime runs from the start of the request that wrote or read the entry, so time spent streaming a long response uses up the window.

      Covered in TTLs and what caching costs

    2. 2.Cache hits always cost 10% of base input on every model.Why is that wrong?

      0.1x is the standard multiplier, but Opus 5.5 hits cost 0.05x, and Fable 5.1 and Mythos 5.1 hits cost 0.025x.

      Covered in TTLs and what caching costs

    3. 3.Top-level automatic caching is free, on top of the four explicit breakpoints.Why is that wrong?

      When it is combined with explicit breakpoints, the automatic breakpoint takes one of the 4 available slots.

      Covered in Automatic caching and explicit breakpoints

    4. 4.Editing a tool definition only invalidates the tools part of the cache; the cached system prompt and messages survive.Why is that wrong?

      Tools sit first in the prefix hierarchy, so modifying them invalidates the entire cache.

      Covered in Modular prompts: stable modules first, variables last

    Sources

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Otherwise, it processes the full prompt and caches the prefix once the response begins.”
      ↩︎ Reuse starts with a stable prefix
      “Prompt caching (both automatic and explicit) is supported on all active Claude models.”
      ↩︎ Reuse starts with a stable prefix
      “Automatic caching: Add a single cache_control field at the top level of your request.”
      ↩︎ Automatic caching and explicit breakpoints
      “Explicit cache breakpoints: Place cache_control directly on individual content blocks for fine-grained control over exactly what gets cached.”
      ↩︎ Automatic caching and explicit breakpoints
      “If the last block already has an explicit cache_control with the same TTL, automatic caching is a no-op.”
      ↩︎ Automatic caching and explicit breakpoints
      “By default, the cache has a 5-minute lifetime. The cache is refreshed for no additional cost each time the cached content is used.”
      ↩︎ TTLs and what caching costs
      “You can specify a 1-hour TTL at 2x the base input token price:”
      ↩︎ TTLs and what caching costs
      “All other models use the standard 0.1x multiplier.”
      ↩︎ TTLs and what caching costs
      “Prompt caching optimizes your API usage by allowing resuming from specific prefixes in your prompts.”
      ↩︎ Key concept
      “The lifetime is measured from the start of the request that writes or reads the cache entry, not from the end of its response.”
      ↩︎ Exam trap 1
      “Cache hits and refreshes on Claude Opus 5.5 are priced at 0.05x the base input price.”
      ↩︎ Exam trap 2
      “When used together, the automatic cache breakpoint uses one of the 4 available breakpoint slots.”
      ↩︎ Exam trap 3
      “The lifetime is measured from the start of the request that writes or reads the cache entry, not from the end of its response.”
      ↩︎ Prediction
      “Cache hits and refreshes on Claude Opus 5.5 are priced at 0.05x the base input price.”
      ↩︎ Checkpoint
    2. 2.
      “Then do the same for your car insurance and electric car insurance information.”
      ↩︎ Modular prompts: stable modules first, variables last
    3. 3.
      “a change at one level invalidates that level and everything after it”
      ↩︎ Modular prompts: stable modules first, variables last
      “The cache follows a prefix hierarchy (tools → system → messages)”
      ↩︎ Exam trap 4

    Continue to page 2 of 2

    Agent Skills: Reusable, On-Demand Prompt Modules

    Spotted a mistake, or was something unclear? Tell us.