Skip to content

[FEATURE] Support granular caching (cache points) in system prompts #807

@AlexanderRichey

Description

@AlexanderRichey

Problem Statement

Strands currently supports "default" caching of system prompts, but it does not allow users to control which parts of the system prompt should and should not be cached. When using dynamic system prompts, where some of the prompt is static, but a portion is dynamic, the ability to control which portion of the prompt gets cached is essential to be able to leverage prompt caching.

Proposed Solution

Bedrock supports granular caching today by accepting an array of content blocks in its system prompt parameter. For example:

[
  {"text": "static portion of my prompt"},
  {"cachePoint": {"type": "default"}},
  {"text": "dynamic portion of my prompt"},
]

Strands should consider accepting such an array for its own system prompt param. Here's how this could look:

a = Agent(
  model=BedrockModel(
    model_id="anthropic.claude-sonnet-4-20250514-v1:0",
  ),
  system_prompt=[
    {"text": "static portion of my prompt"},
    {"cachePoint": {"type": "default"}},
    {"text": f"dynamic portion of my prompt: {something_random()}"},
  ],
)

Use Case

See above.

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions