Back to catalog / Agent workflows
Prewarm research context while the user types
When a user begins composing a query, send a one-token request with the same large context to hide cache-creation latency.
Goal
Reduce time to first token when large research context is reused.
Steps
- When the user focuses the input or starts typing, issue a background one-token cache-warming request using the same context that will be submitted. [source13]
- After submission, send the real request and inspect
cache_read_input_tokens; keep the warm-up and final context identical and scoped to the same session. [source13] - Compare TTFT and cost with ordinary caching; stop warming after an idle timeout and never share private context across users. [source13]
How to verify
The real request records a cache read for the same large context, reduces TTFT against the cold baseline, and shows no cross-user data reuse.
Troubleshooting
If there is no cache hit, compare the warm-up and final context byte-for-byte and check TTL; small contexts may not benefit, so avoid warming abandoned queries.
Permissions
Prerequisites
- Anthropic API key and a repeatable fixture; do not infer savings from headers without usage measurements.
Permissions
- Use approved test or anonymized data only; scope credentials to each workflow, and require explicit approval for external writes.
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
- Repository
- anthropics/anthropic-cookbook
- File path
- misc/speculative_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