feat: Add instrumentation for anthropic.beta.sessions - #2333
Conversation
Abhijeet Prasad (AbhiPrasad)
left a comment
There was a problem hiding this comment.
Ah interesting. I decided to auto-instrument this in python iirc. Maybe I should revert that there too. If we decide this is how we want the sdks to work, I'd add a spec doc change for this.
Abhijeet Prasad (@AbhiPrasad) yeah the main reason I decided to do it like this is that you may have braintrust tracing be "unwanted collateral damage" if we auto-instrument such APIs. I don't think there is a clear right or wrong here, but since getting the stream is mostly a manual decision someone has to make, I thought it would also be fine to only trace manually. Like I would be kinda surprised if I had something like analytics on the sessions, and suddenly braintrust traces my analytics service. Or maybe even emits duplicates traces if I retrieve the session events from multiple places. Makes sense? |
|
I think you're right here. I'm going to update the python SDK accordingly. |
Adds instrumentation for
anthropic.beta.sessions.The anthropic API is either
sessions.event.stream()orsessions.threads.events.stream(). You are reading events from something that is happening on anthropic infra - that's why I didn't want to make these apis auto instrumented, instead, the user should be manually collecting the streams withcollectAnthropicSession():