Prompt caching drastically reduces costs on long conversations. The 4 memory types are a recurring exam question — each has a precise use case.
Objective: understand exactly how the cache works and how to structure a prompt to take advantage of it.
Explore the caching rules:
Build an optimal prompt for caching:
"The cache persists indefinitely if you don't change the content" → FALSE. The TTL is 5 minutes. If more than 5 minutes elapse between two calls with the same content, the cache expires and the next call pays full cost.
Objective: master the 4 memory types, their persistence, and the use cases for each. Frequently asked as a multi-select question.
Current context window. Temporary, disappears at the end of the conversation.
External database (vector DB, SQL). Persistent, queryable via tools.
Model fine-tuning. Permanent, embedded in model parameters.
Prompt caching. Temporary (TTL 5 min), reduces costs on repeated static content.
Deepen the 4 types with a practical angle:
Classification exercise: which memory type for each need?
Prompt caching is officially classified as an "in-cache" memory type. It is temporary memory (TTL 5 min) that persists in Anthropic's infrastructure, not in the model. Different from in-context (active window) and in-weights (model parameters).
Objective: understand the limits of in-context memory and know when to switch to an external solution (RAG, vector DB).
Analyze limits and transitions:
Practical case: memory architecture for a complex agent:
In-cache: system instructions (static, called frequently). In-context: active conversation + retrieved relevant context. External: product docs (vector search), user history (SQL). In-weights: domain specialization if extreme performance is needed.