You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
anthropic 1.9.0 made cache diagnostics GA: a diagnostics= request parameter and Message.diagnostics.cache_miss_reason, a union of reason types (model, system, tools or messages changed; previous message not found; unavailable), each carrying cache_missed_input_tokens. Beta BetaMessage.diagnostics already existed in 1.8.0 and isn't captured either.
Proposal
In py/src/braintrust/integrations/anthropic/tracing.py:
Add "diagnostics" to METADATA_PARAMS so the request option is logged.
In _log_message_to_span / _message_output, log message.diagnostics.cache_miss_reason.type as metadata.
Record cache_missed_input_tokens as a numeric metric (e.g. prompt_cache_missed_tokens).
Read the fields with getattr so older SDK versions (0.48.0) need no gating. Streaming should get this from the message_start snapshot.
Tests
New cassette-backed test: two calls, the second passing diagnostics={"previous_message_id": ...}.
Parent: #858 (found while reviewing the 2026-10-05 weekly dependency update, #849).
Activity
AbhiPrasad commentedon Oct 7, 2026
fixed with https://github.com/braintrustdata/braintrust-sdk-python/releases/tag/py-sdk-v0.45.0