Back to library
AI
tutorial

Modify Claude's Tools Mid-Conversation Without Breaking Cache

Dynamically update Claude's toolset mid-chat without breaking your prompt cache.

Modify the list of tools available to Claude during an active session by using the new mid-conversation beta header.

Claude

The Scenario

You are building a multi-step AI agent that first needs web search tools to gather data, but then needs to switch to file-writing tools for the final report. You want to change these capabilities without re-uploading and re-paying for the processing of the entire chat history.

Before & after

The old way

Changing tools required editing the initial system message, which broke the prompt cache and forced a full re-processing of the conversation history. This could take 5–10 minutes for long contexts.

With AI

Developers can now swap specific tools in or out via the API mid-session using the beta header. This reduces latency and resource usage to under 1 minute.

The Prompt

// Use this header in your API request to enable mid-conversation tool changes
// Header: anthropic-beta: mid-conversation-tool-changes-2026-07-01

{
  "model": "claude-opus-5",
  "messages": [
    {"role": "user", "content": "Analyze this data."},
    {"role": "assistant", "content": "...", "tool_use": "..."},
    {"role": "user", "content": "Now generate a PDF report."},
    {"role": "system", "content": "New instruction: Use the PDF_Generator tool now."}
  ],
  "tools": [/* UPDATED TOOL LIST HERE */]
}

By using the `mid-conversation-tool-changes-2026-07-01` beta header, you can dynamically adjust the capabilities available to Claude without losing the performance benefits of prompt caching. This is critical for complex agentic workflows where different tools are needed at different stages.

Source

Claude Platform release notes - Claude Platform Docs
"Add or remove tools between turns of a conversation while preserving the prompt cache."