Skip to content

[BUG] Stale BedrockModelOptions docs list cachePrompt/cacheTools, but v1.0.0 only honors cacheConfig #1027

@AvivonAbove

Description

@AvivonAbove

Steps to Reproduce

There appears to be a public docs/source mismatch for Bedrock prompt caching in the TypeScript SDK.

  1. Open this older/still-indexed TypeScript API page:

    https://strandsagents.com/latest/documentation/docs/api-reference/typescript/interfaces/BedrockModelOptions.html

    It lists cachePrompt?: string and cacheTools?: string on BedrockModelOptions.

  2. Compare with the current TypeScript docs:

    These show cacheConfig?: CacheConfig, where CacheConfig.strategy is 'auto' | 'anthropic'. The Bedrock guide also says TypeScript tool caching is enabled through cacheConfig, and that there is no separate cacheTools option.

  3. Install @strands-agents/sdk@1.0.0 and pass a config object shaped like the older docs suggest. This can happen without a TypeScript error if the object goes through an intermediate variable or as any:

    import { BedrockModel } from '@strands-agents/sdk'
    
    const modelConfig = {
      region: 'us-east-1',
      modelId: 'global.anthropic.claude-sonnet-4-6',
      stream: true,
      cachePrompt: 'default',
      cacheTools: 'default',
    }
    
    const model = new BedrockModel(modelConfig as any)
  4. Invoke the model through an agent with a system prompt and/or tools, then inspect the actual Bedrock Converse/ConverseStream request body or cache usage metadata.

Expected Behavior

One of these should happen:

  1. The stale latest/documentation/docs/api-reference/... page should redirect to the current docs or be updated to show cacheConfig, not cachePrompt / cacheTools.
  2. Or the SDK should keep backwards-compatible aliases for cachePrompt / cacheTools and map them to the current cache-point behavior.
  3. Or the SDK should warn/throw when unsupported cache-looking options are present, so users do not silently believe caching is enabled.

Actual Behavior

cachePrompt and cacheTools are silently ignored by @strands-agents/sdk@1.0.0's Bedrock provider. No cachePoint is emitted from those fields.

From the installed v1.0.0 source:

  • dist/src/models/bedrock.d.ts: BedrockModelConfig exposes cacheConfig?: CacheConfig; no cachePrompt / cacheTools fields.
  • dist/src/models/model.d.ts: CacheConfig is { strategy: 'auto' | 'anthropic' }.
  • dist/src/models/bedrock.js: _shouldEnableCaching() reads only this._config.cacheConfig.
  • The Bedrock request formatter adds tool/message cachePoint only when _shouldEnableCaching() is true.

The upstream source appears to match this:

https://github.com/strands-agents/sdk-typescript/blob/a12ea3e3c4680daacc8ca5937b6b8be41474c92b/strands-ts/src/models/bedrock.ts

Minimal Request-Shape Check

Using the unsupported fields from the stale docs:

const model = new BedrockModel({
  region: 'us-east-1',
  modelId: 'global.anthropic.claude-sonnet-4-6',
  stream: true,
  cachePrompt: 'default',
  cacheTools: 'default',
} as any)

const request = (model as any)._formatRequest(
  [{ role: 'user', content: [{ type: 'textBlock', text: 'hello' }] }],
  { systemPrompt: 'stable system prompt' },
)

console.log(JSON.stringify(request).includes('cachePoint')) // false

Using the current API:

const model = new BedrockModel({
  region: 'us-east-1',
  modelId: 'global.anthropic.claude-sonnet-4-6',
  stream: true,
  cacheConfig: { strategy: 'auto' },
})

const request = (model as any)._formatRequest(
  [{ role: 'user', content: [{ type: 'textBlock', text: 'hello' }] }],
  { systemPrompt: 'stable system prompt' },
)

console.log(JSON.stringify(request).includes('cachePoint')) // true

Additional Context

AWS Bedrock requires explicit cachePoint checkpoints in the Converse request messages, system, or tools fields for prompt caching:

https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html

We hit this in an integration where application-level configuration indicated prompt caching was enabled, but Bedrock model invocation logs showed no cachePoint in the actual ConverseStream requests and cache read/write token usage remained zero. The proximate cause was following the stale cachePrompt / cacheTools option shape instead of the current cacheConfig API.

This is not the same as #895, which appears to be about the direct Anthropic provider and cross-SDK parity. This issue is specifically about BedrockModel TypeScript docs/config behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions