anthropics / anthropics/claude-agent-sdk-python
[FEATURE] Prompt Caching Support in Claude Agent SDK
- Dominant language
- Python
- Stars
- 8.1k
- Forks
- 1.3k
- Avg merge
- 2d 31m
- Merged PRs (30d)
- 1
Description
# [Feature Request] Support Bedrock Prompt Caching in Claude Agent SDK
## Description
I am currently using the **Claude Agent SDK** with **Amazon Bedrock** as the model provider. I am unable to enable **Prompt Caching** via the SDK because the current `ClaudeAgentOptions` (and the underlying Bedrock provider) do not support the injection of cache control metadata into the message payload.
To leverage Bedrock's prompt caching, the payload must allow for `cache_control` or `cachePoint` blocks within the messages or system prompts.
## Proposed Change
Update the `ClaudeAgentOptions` and the Bedrock model provider logic to support the following structures in the request payload:
**For Ephemeral Caching:**
```json
"cache_control": {
"type": "ephemeral"
}
```
**For Cache Points:**
```json
"cachePoint": {
"type": "default"
}
```
---
## 1. Documentation Links
* **Main Guide**: [Amazon Bedrock Prompt Caching User Guide](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-caching.html)
* **API Reference**: [Amazon Bedrock Runtime - InvokeModel](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InvokeModel.html)
* **Model Specifics**: [Anthropic Claude Models on Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-anthropic-claude-messages.html)
---
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating ClaudeAgentOptions and the underlying Bedrock provider logic, then compare their request-building path with the linked Bedrock prompt-caching documentation. Done means the SDK can pass cache_control and cachePoint blocks in message or system-prompt payloads for ephemeral caching and cache points, with coverage in the relevant existing tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api, backend, cloud
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100