anthropics / anthropics/claude-agent-sdk-python

[FEATURE] Prompt Caching Support in Claude Agent SDK

Open
#626 4 comments 17 reactions 0 assignees View on GitHub
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

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.