anthropics / anthropics/claude-agent-sdk-python

[FEATURE] Prompt Caching Support in Claude Agent SDK

Abierto
#626 4 comentarios 17 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
8.1k
Forks
1.3k
Merge medio
2 d 31 min
PR fusionados (30 d)
1

Descripción

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

---

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.