Checks
Strands Version
1.35
Python Version
3.12
Operating System
linux
Installation Method
pip
Steps to Reproduce
- Create a BedrockModel with cache_tools="default" and a system prompt containing a cachePoint with ttl="1h"
- Create an Agent with ConversationCacheHook that sets CACHE_POINT_BLOCK = {"cachePoint": {"type": "default", "ttl": "1h"}}
- Invoke the agent with a multi-turn conversation
- Observe: (a) ValidationException due to TTL ordering, or (b) cache falls back to 5m TTL silently
Expected Behavior
cachePoint blocks with "ttl": "1h" should be forwarded to Bedrock as-is
cache_tools="default" should allow configuring its TTL to match other cache points
Bedrock should honor 1-hour TTL on all configured cache checkpoints
Actual Behavior
Bug 1: _format_request_message_content in bedrock.py silently drops the ttl field from cachePoint blocks — all cache silently falls back to 5m TTL regardless of what is set
Bug 2: cache_tools="default" hardcodes a 5m TTL on the toolConfig cache point. Since toolConfig is processed before system and messages, a 1h TTL on a subsequent cache point violates Bedrock's decreasing TTL ordering rule → ValidationException
Additional Context
The Bedrock CachePointBlock API supports an optional ttl field with values "5m" or "1h": https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CachePointBlock.html
Bedrock processes cache checkpoints in order: toolConfig → system → messages, and requires TTLs to be in non-increasing order
Users leveraging ConversationCacheHook (manually injected cache points via hooks) cannot access 1h TTL because the SDK strips the field before the API call
Possible Solution
# Bug 1 fix — bedrock.py _format_request_message_content
if "cachePoint" in content:
cp = {"type": content["cachePoint"]["type"]}
if "ttl" in content["cachePoint"]:
cp["ttl"] = content["cachePoint"]["ttl"]
return {"cachePoint": cp}
# Bug 2 fix — add cache_tools_ttl param to BedrockModel
# e.g. BedrockModel(cache_tools="default", cache_tools_ttl="1h")
# so toolConfig cache point TTL can be aligned with system/conversation cache points
Related Issues
No response
Checks
Strands Version
1.35
Python Version
3.12
Operating System
linux
Installation Method
pip
Steps to Reproduce
Expected Behavior
cachePoint blocks with "ttl": "1h" should be forwarded to Bedrock as-is
cache_tools="default" should allow configuring its TTL to match other cache points
Bedrock should honor 1-hour TTL on all configured cache checkpoints
Actual Behavior
Bug 1: _format_request_message_content in bedrock.py silently drops the ttl field from cachePoint blocks — all cache silently falls back to 5m TTL regardless of what is set
Bug 2: cache_tools="default" hardcodes a 5m TTL on the toolConfig cache point. Since toolConfig is processed before system and messages, a 1h TTL on a subsequent cache point violates Bedrock's decreasing TTL ordering rule → ValidationException
Additional Context
The Bedrock CachePointBlock API supports an optional ttl field with values "5m" or "1h": https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_CachePointBlock.html
Bedrock processes cache checkpoints in order: toolConfig → system → messages, and requires TTLs to be in non-increasing order
Users leveraging ConversationCacheHook (manually injected cache points via hooks) cannot access 1h TTL because the SDK strips the field before the API call
Possible Solution
Related Issues
No response