Skip to content

feat(anthropic): Emit gen_ai.chat spans for asynchronous messages.stream() #1192

feat(anthropic): Emit gen_ai.chat spans for asynchronous messages.stream()

feat(anthropic): Emit gen_ai.chat spans for asynchronous messages.stream() #1192

Triggered via pull request March 2, 2026 08:22
Status Success
Total duration 19s
Artifacts

changelog-preview.yml

on: pull_request_target
changelog-preview  /  preview
15s
changelog-preview / preview
Fit to window
Zoom out
Zoom in

Annotations

4 errors
Async stream wrapper passes incorrect keyword argument causing TypeError: sentry_sdk/integrations/anthropic.py#L103
The `_wrap_async_message_stream_manager_aenter` function at line 878 passes `stream=stream` to `_sentry_patched_stream_common`, but that function's signature expects `stream_manager` as the first parameter (line 738). When `AsyncMessages.stream()` is used (enabled by lines 100-106), this will raise `TypeError: _sentry_patched_stream_common() got an unexpected keyword argument 'stream'`. The synchronous version at line 823 correctly uses `stream_manager=stream_manager`.
[LP7-S8M] Async stream wrapper passes incorrect keyword argument causing TypeError (additional location): sentry_sdk/integrations/anthropic.py#L877
The `_wrap_async_message_stream_manager_aenter` function at line 878 passes `stream=stream` to `_sentry_patched_stream_common`, but that function's signature expects `stream_manager` as the first parameter (line 738). When `AsyncMessages.stream()` is used (enabled by lines 100-106), this will raise `TypeError: _sentry_patched_stream_common() got an unexpected keyword argument 'stream'`. The synchronous version at line 823 correctly uses `stream_manager=stream_manager`.
_wrap_async_message_stream_manager_aenter passes wrong parameter name, causing TypeError at runtime: sentry_sdk/integrations/anthropic.py#L103
The `_wrap_async_message_stream_manager_aenter` function at line 877 calls `_sentry_patched_stream_common(stream=stream, ...)` but the target function expects a parameter named `stream_manager`, not `stream`. This will cause a `TypeError: _sentry_patched_stream_common() got an unexpected keyword argument 'stream'` when users try to use async streaming with `async with client.messages.stream(...)`.
[UZ7-MUE] _wrap_async_message_stream_manager_aenter passes wrong parameter name, causing TypeError at runtime (additional location): sentry_sdk/integrations/anthropic.py#L877
The `_wrap_async_message_stream_manager_aenter` function at line 877 calls `_sentry_patched_stream_common(stream=stream, ...)` but the target function expects a parameter named `stream_manager`, not `stream`. This will cause a `TypeError: _sentry_patched_stream_common() got an unexpected keyword argument 'stream'` when users try to use async streaming with `async with client.messages.stream(...)`.