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

[FEATURE] Accept a `client` in Python `AnthropicModel`

Open jimbrub opened this issue 1 month ago • 1 comments

Human Overview

We need to accept a client on Python, so that Native compaction works without needing to pass AsyncAnthropic client.

SDK Language

Python

Problem Statement

Native compaction works on Bedrock through AsyncAnthropicBedrock (36 of 36 eval runs in design 0022), but Python AnthropicModel only builds an AsyncAnthropic client from client_args. Users have to assign model.client after construction. TypeScript already accepts client.

Proposed Solution

Add a client argument to AnthropicModel.__init__, matching TypeScript, and document the Bedrock setup. Note that Anthropic doesn't list Bedrock for on-demand compaction.

Use Case

A Bedrock customer without an Anthropic API key uses native compaction on Opus 5.5.

Additional Context

  • Design: team/designs/0022-server-side-compaction-support.md (#5242)

jimbrub avatar Oct 22 '26 14:10 jimbrub

Not needed for epic #5410: assigning model.client after construction is enough for native compaction on Bedrock (this is how the design 0022 evals ran). Removing from the epic; can be revisited as a general Python devx/parity item.

jimbrub avatar Oct 23 '26 14:10 jimbrub