anthropics / anthropics/claude-agent-sdk-python

[FEATURE] Prompt Caching Support in Claude Agent SDK

Đang mở
#626 4 bình luận 17 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
8.1k
Fork
1.3k
Merge trung bình
2 ngày 31 phút
Pull request đã merge (30 ngày)
1

Mô tả

# [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)

---

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.