Skip to main content

Defining Cache Breakpoints — Prompt Caching Framework

[ ABORT TO HUD ]
SEQ. 1
SEQ. 2

Defining Cache Breakpoints

⚡ Prompt Caching Framework⏱ 20 min⭐ 350 BASE XP⌨ HANDS-ON LAB

Strategic Context Storage

Anthropic's Prompt Caching allows developers to persist large prefixes (like system instructions, tool definitions, or codebase files) in high-speed inference memory. You append a cache_control object set to {"type": "ephemeral"} (5-minute default TTL, or {"type": "ephemeral", "ttl": "1h"} for 1-hour extended retention) at specific breakpoints in your request.

The 4-Breakpoint Constraint

A single API request can contain a maximum of 4 explicit cache breakpoints. Typically, you cache your system prompt at breakpoint 1, tool definitions at breakpoint 2, and reference documents at breakpoint 3—keeping the heavy prefix warm while the final user turn stays dynamic.

Architecture Note: Hashing is performed on the entire prefix (including model ID, tools, system, and effort level) up to the breakpoint. Changing even a single character or swapping models invalidates downstream blocks.
⌨ HANDS-ON LABMark Ephemeral Cache Breakpoints
⭐ +200 XP

Persist repeated system instructions in cache. Add a cache_control object with type 'ephemeral' to your system prompt content array.

1POST to /v1/messages with system structured as an array of content blocks and cache_control: {"type": "ephemeral"}.
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 1 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 3
How is a cache boundary physically marked in the Anthropic schema?
By checking a box in the Console
By appending a cache_control object set to 'ephemeral' inside specific content arrays
By putting the context in XML tags
Using an external Redis database