sdk-python
sdk-python copied to clipboard
[FEATURE] Clear tool results server-side on preserved-thinking models
Human Overview
Add a path for clearing tool results server side on preserved thinking models. Anthropic's API allows for editing tool results that have already been seen by the model. This is how tool results need to be edited with these models, if we do not want the model to return a 400 error.
SDK Language
Both / Not language-specific
Problem Statement
Retroactive Offload.truncate and Offload.drop on tool results, the stale_tool_cleanup and overflow_protection presets, and the agentic truncate_context tool all edit messages the model has already seen. On preserved-thinking models this is the most common way to hit the 400.
Proposed Solution
- Add a short addendum to design 0022 that answers its open question "One capability switch for Part 2": how a strategy asks the model what it supports, and how it passes per-request edits to the model.
- On supporting models, add a
clear_tool_uses_20250919edit to the request instead of editingmessages. The mapping and gaps are in 0022, "Clearing Tool Uses". - Move
stale_tool_cleanupandoverflow_protectiononto it.
Use Case
An agent on Opus 5.5 using auto clears old tool results without invalidating its thinking.
Additional Context
- Depends on: #5401
- Design:
team/designs/0022-server-side-compaction-support.md(#5242)