Anthropic quietly shipped something this week that solves a problem I’ve been working around with duct tape for months: mid-conversation tool changes, now in beta on Claude Fable 5, Claude Mythos 5, Claude Opus 4.8, and Claude Opus 5. The pitch is simple — add or remove tools between turns of a conversation without invalidating the prompt cache for everything that came before. If you’ve ever built a long-running agent session, you already know why that “without invalidating the cache” clause is the whole feature.

The problem this actually fixes

Prompt caching works by hashing a prefix of your request — system prompt, tools array, then messages — and reusing the KV cache for anything that hasn’t changed. The catch, which I learned the expensive way running a multi-hour agent session against a codebase last quarter, is that the tools array sits earlier in that hashed prefix than the system field. Change one tool definition, add a new MCP server mid-session, drop a tool you no longer need — and you invalidate the cache for the entire conversation, not just the turn where the change happened. On a session with 40+ turns of accumulated context, that’s not a rounding error; it’s a full cache-write bill on every subsequent turn until the session ends.

My workaround up to now was crude: front-load every tool the agent might conceivably need at session start, even ones it would only touch in 5% of runs, just to avoid a mid-session tool list mutation. That’s the wrong trade — you pay a small ongoing cost (extra tokens in every cached prefix, more tool-selection ambiguity for the model) to avoid a much larger one-time cost (full cache invalidation). Mid-conversation tool changes let you actually do the right thing: start lean, expand or contract the toolset as the task’s shape becomes clear, without the cache penalty.

What the mechanism looks like

This requires the mid-conversation-tool-changes-2026-07-01 beta header. Structurally it’s the tools counterpart to mid-conversation system messages, which Anthropic shipped earlier — you’re inserting a scoped change that applies going forward without rewriting history:

import anthropic

client = anthropic.Anthropic()

# Turn 1: agent starts with a minimal toolset
response = client.messages.create(
    model="claude-opus-5",
    max_tokens=4096,
    tools=[read_file_tool, grep_tool],
    messages=[{"role": "user", "content": "Find where the auth middleware lives"}],
    extra_headers={"anthropic-beta": "mid-conversation-tool-changes-2026-07-01"},
)

# Turn N: task now needs deploy access — add the tool without
# invalidating the cache built up over the prior turns
response = client.messages.create(
    model="claude-opus-5",
    max_tokens=4096,
    tools=[read_file_tool, grep_tool, deploy_tool],  # deploy_tool appended
    messages=conversation_history + [
        {"role": "user", "content": "Now deploy the fix to staging"}
    ],
    extra_headers={"anthropic-beta": "mid-conversation-tool-changes-2026-07-01"},
)

The important operational detail: this is additive/subtractive tooling within the same cached lineage, not a fresh prefix. You’re not tricking the cache — you’re telling the API explicitly “the tools changed here, keep everything before this turn.”

Where this matters for real agent architectures

I run a handful of long-lived agent sessions — a research agent that accumulates context over days, a build agent that starts with read-only tools and only gets write/deploy access once a plan is approved. Both of those are exactly the shape this feature targets: capability escalation mid-task, not a static toolset decided up front.

The build-agent case is the more interesting one from a safety-engineering angle, and it composes well with the “no standing privileges” pattern I wrote about for CrowdStrike’s Agentic Identity Provider this week: start the session with read_file, grep, run_tests only. Once the agent proposes a plan and a human approves it, then add write_file and deploy to the tools array for the next turn. Previously, doing this meant either eating a full cache invalidation at the exact moment the task got expensive (right before deploy, naturally — Murphy’s law of caching), or granting write access up front and relying on prompt instructions alone to gate it, which is a much weaker control than the tool simply not being callable.

# Pattern: privilege escalation gated on approval, cache-preserving
BASE_TOOLS = [read_file_tool, grep_tool, run_tests_tool]
ESCALATED_TOOLS = BASE_TOOLS + [write_file_tool, deploy_tool]

def get_tools_for_turn(plan_approved: bool) -> list:
    return ESCALATED_TOOLS if plan_approved else BASE_TOOLS

That’s a trivial function, but the point is it’s now a free trivial function — no cache tax for calling it differently turn to turn.

The rollout gotcha

Two things to watch for if you adopt this now, both because it’s beta:

  1. Model support is narrow. Fable 5, Mythos 5, Opus 4.8, and Opus 5 only. If you’re running anything else in production — including older Sonnet lines — this silently doesn’t apply, and you need to check the beta header is actually doing something rather than being ignored.
  2. This doesn’t cover every kind of tool change equally well. Removing a tool the model just called in the previous turn is a different risk profile than adding a new one — make sure your test suite includes a turn where the model reaches for a tool that’s mid-removal, so you can verify the model’s error-handling path (it should gracefully report the tool as unavailable, not hallucinate a call to it).

The takeaway

Prompt caching turned “keep your system prompt and tools stable” into an unstated architectural constraint for anyone doing long-running agent work — a constraint most people worked around by over-provisioning tools at session start, same as I did. Mid-conversation tool changes removes that constraint directly instead of asking you to design around it, which is the more interesting signal here: Anthropic is treating the tools array as something that should evolve with the conversation, not a static contract fixed at session boot. If you’re running agents with more than a couple hours of accumulated context, this is worth wiring in now, beta header and all — the cache savings alone likely pay for the migration effort within the first long session.

Export for reading

Comments