Agent Wealth HubFree public resources
中文 EN العربية

Back to catalog / Agent workflows

Cache stable instructions across repeated requests

Reduce repeated prompt cost by placing stable instructions and reference material in a cacheable prefix.

Goal

Reduce repeated prompt cost by placing stable instructions and reference material in a cacheable prefix.

Steps

  1. Separate the stable system prompt and shared reference blocks from per-user messages; put cache control at the documented boundary. [source12]
  2. Send two equivalent requests and inspect usage fields for cache creation and cache reads. [source12]
  3. Invalidate or version the prefix when policy or source material changes; do not cache secrets or user-specific data in shared prefixes. [source12]

How to verify

Send two requests with the same stable prefix; compare usage fields for cache creation/read, then change the policy version and confirm the old prefix is no longer reused.

Troubleshooting

If cache reads stay at zero, inspect the cache-control boundary and prefix stability; remove user-specific data and secrets before sharing a cacheable prefix.

Permissions

Prerequisites

Permissions

Limitations

Model output may be incomplete or wrong; API and beta behavior can change, so verify against the pinned source and current service behavior.

Pinned upstream source

https://github.com/anthropics/anthropic-cookbook/blob/9c1e493ddd2b82df399d2a61b9c806c539e18be6/misc/prompt_caching.ipynb

Repository
anthropics/anthropic-cookbook
File path
misc/prompt_caching.ipynb
Pinned commit
9c1e493ddd2b82df399d2a61b9c806c539e18be6
Source checked
2026-10-14 · Reviewed against the pinned upstream source

Repository metrics

These values describe the upstream repository, not popularity or likes for an individual skill or playbook.

Stars
Not collected
Forks
Not collected
Observed at
Not collected

No metrics snapshot is available yet.

License: MIT

Main topic

Take a coding Agent change from context to verification

Related resources