Skip to content

feat(cache): add TTL support to CachePoint for prompt caching#1660

Open
kpx-dev wants to merge 5 commits intostrands-agents:mainfrom
kpx-dev:feat-support-prompt-caching-ttl
Open

feat(cache): add TTL support to CachePoint for prompt caching#1660
kpx-dev wants to merge 5 commits intostrands-agents:mainfrom
kpx-dev:feat-support-prompt-caching-ttl

Conversation

@kpx-dev
Copy link

@kpx-dev kpx-dev commented Feb 10, 2026

Description

Add optional ttl field to CachePoint TypedDict to support AWS Bedrock's cache TTL configuration. The field accepts "5m" or "1h" values as specified in the Bedrock API. Updated BedrockModel to preserve ttl field when formatting cache point content blocks. Includes tests for TTL preservation and backward compatibility.

Doc shows API supports ttl option now:
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CachePointBlock.html

launch announcement:
https://aws.amazon.com/about-aws/whats-new/2026/01/amazon-bedrock-one-hour-duration-prompt-caching/

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

Related Issues

#1243

Documentation PR

Type of Change

New feature

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • [x ] I ran hatch run prepare

Checklist

  • [x ] I have read the CONTRIBUTING document
  • [ x] I have added any necessary tests that prove my fix is effective or my feature works
  • [x ] I have updated the documentation accordingly
  • [ x] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • [x ] My changes generate no new warnings
  • [ x] Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Add optional ttl field to CachePoint TypedDict to support AWS Bedrock's
cache TTL configuration. The field accepts "5m" or "1h" values as specified
in the Bedrock API. Updated BedrockModel to preserve ttl field when formatting
cache point content blocks. Includes tests for TTL preservation and backward
compatibility.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
mkmeral
mkmeral previously approved these changes Feb 17, 2026
@mkmeral mkmeral enabled auto-merge (squash) February 17, 2026 17:00
@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

zastrowm
zastrowm previously approved these changes Feb 17, 2026
auto-merge was automatically disabled February 17, 2026 18:09

Head branch was pushed to by a user without write access

@kpx-dev kpx-dev dismissed stale reviews from zastrowm and mkmeral via 230ed7c February 17, 2026 18:09
@github-actions github-actions bot added size/s and removed size/s labels Feb 17, 2026
@kpx-dev kpx-dev requested review from mkmeral and zastrowm February 17, 2026 18:43
@kpx-dev
Copy link
Author

kpx-dev commented Feb 17, 2026

FYI this PR fails label size: https://github.com/strands-agents/sdk-python/actions/runs/22110060966 . Not sure if CI needs update or label input needs update

@kpx-dev kpx-dev requested a review from mkmeral February 18, 2026 19:30
zastrowm
zastrowm previously approved these changes Feb 18, 2026
Copy link
Member

@zastrowm zastrowm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nit (imports) - looks good

mkmeral
mkmeral previously approved these changes Feb 18, 2026
Copy link
Contributor

@mkmeral mkmeral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll approve. I want to try following up with strands command for nits, let's see how that works. the only nit is the import in the test

@kpx-dev kpx-dev dismissed stale reviews from mkmeral and zastrowm via c255ea6 February 18, 2026 23:42
@github-actions github-actions bot added size/m and removed size/m labels Feb 18, 2026
@kpx-dev kpx-dev requested review from mkmeral and zastrowm February 18, 2026 23:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments