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
{{ message }}
Repository navigation
Anthropic integration: streamed tool_use input is appended to gen_ai.response.text and tool_calls are not recorded #8050
gen_ai.response.text: Checking the weather.{"city": "Paris"} (the tool input JSON is appended to the answer)
gen_ai.response.tool_calls: not set
_collect_ai_data appends both text_delta.text and input_json_delta.partial_json to the same content_blocks list (L339-341), and _set_streaming_output_data joins that list into a single text block (L977-1007). The block structure (which deltas belong to the text block and which to the tool_use block) is lost, so tool calls are never recorded for streams and the text attribute is corrupted.
This was reproduced with the real anthropic 1.15.0 client against a local endpoint that replays a Messages API event stream, comparing the non-streamed and streamed spans.
A possible fix: track blocks by content_block_start / index, keep text and tool_use input separate (parsing the accumulated JSON at content_block_stop), and set tool_calls the way the non-streamed path does. The OpenAI integration's streaming handlers have a related gap: they only collect delta.content, so streamed tool calls are missing there too (without corrupting the text).
Found with an automated check of streaming paths in tracing integrations and confirmed with the reproduction described above; this report was drafted with Claude Code.
Activity
linear-code commentedon Oct 16, 2026
PY-3004