Summary
Under node --import braintrust/hook.mjs, Anthropic client.messages.stream(...) breaks even though the equivalent messages.create({ stream: true }) flow still works.
What is broken
In auto-instrumented mode, messages.stream(...) fails because the helper path goes through an internal create(...).withResponse() flow that no longer behaves correctly once instrumented.
Why this matters
This is an API-compatibility bug in the auto-instrumented path. Valid Anthropic SDK code works normally, but breaks when Braintrust auto-instrumentation is enabled.
Repro
The aligned e2e coverage in e2e/scenarios/anthropic-auto-instrumentation-node-hook reproduces this. The failure we hit was:
messages.create(...).withResponse is not a function
The current e2e workaround is to avoid messages.stream(...) in auto mode and use messages.create({ stream: true }) instead.
Expected
client.messages.stream(...) should continue to work under the node-hook auto-instrumented path without requiring a scenario-specific fallback.
Summary
Under
node --import braintrust/hook.mjs, Anthropicclient.messages.stream(...)breaks even though the equivalentmessages.create({ stream: true })flow still works.What is broken
In auto-instrumented mode,
messages.stream(...)fails because the helper path goes through an internalcreate(...).withResponse()flow that no longer behaves correctly once instrumented.Why this matters
This is an API-compatibility bug in the auto-instrumented path. Valid Anthropic SDK code works normally, but breaks when Braintrust auto-instrumentation is enabled.
Repro
The aligned e2e coverage in
e2e/scenarios/anthropic-auto-instrumentation-node-hookreproduces this. The failure we hit was:messages.create(...).withResponse is not a functionThe current e2e workaround is to avoid
messages.stream(...)in auto mode and usemessages.create({ stream: true })instead.Expected
client.messages.stream(...)should continue to work under the node-hook auto-instrumented path without requiring a scenario-specific fallback.