Skip to content

[FEATURE] Deprecate cache_tools option in BedrockModel #1577

@minorun365

Description

@minorun365

Problem Statement

Currently, BedrockModel has two cache-related options with inconsistent deprecation status:

  • cache_prompt - already deprecated (warns to use SystemContentBlock with cachePoint)
  • cache_tools - not yet deprecated (no warning)

With the introduction of CacheConfig(strategy="auto") in PR #1438, there's now a cleaner way to handle prompt caching. However, the cache_tools option remains without a clear migration path or deprecation warning.

This inconsistency may confuse users about which options are recommended.

Proposed Solution

Add a deprecation warning for cache_tools similar to cache_prompt:

if self.config.get("cache_tools"):
    warnings.warn(
        "cache_tools is deprecated. Use <recommended_alternative> instead.",
        UserWarning, stacklevel=3
    )

Questions before implementation:

  1. Should cache_tools be deprecated?
  2. What is the recommended alternative?
    • Does CacheConfig(strategy="auto") cover tool caching use cases?
    • Or should users use cachePoint in the tools list directly?

Use Case

When users configure BedrockModel with both cache_prompt and cache_tools, only cache_prompt shows a deprecation warning. This creates confusion about whether cache_tools is still a recommended option.

model = BedrockModel(
    model_id="us.anthropic.claude-sonnet-4-5-20250929-v1:0",
    cache_prompt="default",  # ⚠️ Warning shown
    cache_tools="default",   # No warning - is this still OK to use?
)

Consistent deprecation messaging would help users migrate to the recommended approach.

Alternatives Solutions

  1. Keep cache_tools as-is - If there's no suitable alternative yet, document that cache_tools is the only way to cache tool definitions.

  2. Extend CacheConfig to support tools - Add a cache_tools strategy option to CacheConfig for unified caching configuration.

Additional Context

I have a draft implementation ready and can submit a PR once the migration path is clarified.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions