sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Clear tool results server-side on preserved-thinking models

Open jimbrub opened this issue 1 month ago • 0 comments

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

  1. 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.
  2. On supporting models, add a clear_tool_uses_20250919 edit to the request instead of editing messages. The mapping and gaps are in 0022, "Clearing Tool Uses".
  3. Move stale_tool_cleanup and overflow_protection onto 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)

jimbrub avatar Oct 22 '26 14:10 jimbrub