-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Summary
Anthropic's extended thinking is a stable, prominently documented feature that adds thinking content blocks (non-streaming) and thinking_delta stream events (streaming) to responses. This repo's Anthropic instrumentation does not capture thinking content in either the wrapper or the auto-instrumentation plugin, and the vendor SDK types do not model thinking blocks or deltas at all.
What is missing
Vendor types (js/src/vendor-sdk-types/anthropic.ts)
AnthropicOutputContentBlock(line 85–93) does not include{ type: "thinking"; thinking: string }.AnthropicStreamEvent'scontent_block_deltaunion (lines 112–114) does not include{ type: "thinking_delta"; thinking: string }.AnthropicUsage(lines 95–100) does not include thinking-related token fields (input_tokensfor thinking cache, etc.).
Wrapper streaming (js/src/wrappers/anthropic.ts)
streamNextProxyhandlestext_deltaandinput_json_deltaincontent_block_deltaevents (lines 343–353) but has no case forthinking_delta.- When a
thinkingblock streams,content_block_startsaves the block, but no delta text is accumulated. Atcontent_block_stop, text is empty so nothing is logged (line 359:if (!text) break). - Thinking content is silently dropped from the span output.
Auto-instrumentation plugin (js/src/instrumentation/plugins/anthropic-plugin.ts)
aggregateAnthropicStreamChunks(lines 138–198) only handlestext_deltain thecontent_block_deltacase (line 161).thinking_deltaevents are ignored.
Non-streaming
parseEventFromMessagereturns{ role: message.role, content: message.content }, so thinking blocks would be passed through if the actual SDK returns them. However, the vendor types don't model them, so TypeScript consumers lose type safety.
Upstream reference
- Anthropic Extended Thinking docs: https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking
@anthropic-ai/sdkstreaming format includesthinking_deltaevents: https://github.com/anthropics/anthropic-sdk-typescript/blob/main/helpers.md- Extended thinking is stable (not beta) and works with
thinking: { type: "enabled", budget_tokens: N }. - Streaming events:
content_block_startwithtype: "thinking", followed bycontent_block_deltawithdelta.type: "thinking_delta"anddelta.thinkingfield.
Braintrust docs status
Braintrust Anthropic integration docs mention streaming and metric collection but do not mention extended thinking (not_found).
Local files inspected
js/src/vendor-sdk-types/anthropic.tsjs/src/wrappers/anthropic.tsjs/src/instrumentation/plugins/anthropic-plugin.tsjs/src/instrumentation/plugins/anthropic-channels.tse2e/scenarios/anthropic-auto-instrumentation-node-hook/(no thinking test cases)e2e/scenarios/wrap-anthropic-message-traces/(no thinking test cases)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels