Assessment on Cache Invalidations and Tool Masks
Explore how tool order, system prompts, messages, and tool choice affect KV-cache reuse. Predict cache hits across incident calls, select modes with a tool-state machine, validate seven answers, and compare simulator results with cached token counts from a real model.
We'll cover the following...
In this chapter, we gave the on-call assistant a sectioned system prompt, a clean tool set, a stable cached prefix, and a small state machine that picks a tool mode for each turn. Each lesson changed one thing at a time. Lesson 3.3 changed only the prefix, and Lesson 3.4 changed only tool_choice and the number of turns.
A real incident doesn’t work that way. Several things change at once, and we have to work out which change matters. In this assessment, we’ll predict what happens on four calls where different parts of the request move, then pick a tool mode for three new turns. At the end, a script checks all seven answers.
What breaks the cache?
Before we look at the calls, let’s recall the rule from Lesson 3.3. A request renders in a fixed order: tools first, then the system prompt, then the messages. In this assessment, there’s one breakpoint at the end of the system prompt, so the cached part is the tools and the system prompt together. That’s the 807-token prefix from the last two lessons.
So a change in the messages or in tool_choice leaves the cached prefix as it is. A change of even one character in the tools or the system prompt makes it a new prefix. ...