ITADN

[bug][claude-agent-sdk] _get_output_message_attributes ignores ThinkingBlock content blocks

#3137Opendaniel-barda-cobwebs 创建于 2026-05-19
bugtriage
`_get_output_message_attributes` (the helper that turns assistant messages into `llm.output_messages.{N}.*` flat attributes) only branches on `_is_tool_use_block` and `_is_text_block`. The Anthropic API's `ThinkingBlock` (extended thinking) falls into neither, so its `.thinking` content is dropped and never appears on the AGENT span. ### Reproduction Run any `claude_agent_sdk.query()` against a model with extended thinking enabled (e.g. `claude-sonnet-4-6`) and inspect the AGENT span's `llm.output_messages.{N}.*` attributes - the thinking transcript is absent even when the assistant message clearly contained one. ### Expected behavior Extended-thinking content is a first-class part of the assistant message and should be exported on the span alongside text and tool_use blocks. There is no OpenInference semconv key for thinking blocks yet, so the spec discussion is part of the fix. ### Code reference `python/instrumentation/openinference-instrumentation-claude-agent-sdk/openinference/instrumentation/claude_agent_sdk/_wrappers.py` - the `_get_output_message_attributes` function.
1 条评论