feat(weave): Add Initial Claude Agents SDK OTEL integration#7002
feat(weave): Add Initial Claude Agents SDK OTEL integration#7002andrewtruong wants to merge 5 commits into
Conversation
HiveMind Sessions3 sessions · 1h 33m · $4.55
View all sessions in HiveMind → Run |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
| assert chat_attrs["gen_ai.usage.input_tokens"] == 25 | ||
| assert chat_attrs["gen_ai.usage.output_tokens"] == 10 |
There was a problem hiding this comment.
Looks like the pi-coding-agent integration sets gen_ai.usage.total_tokens -- though I don't see that attribute in our semconv.py mapping. Should I remove it from there?
Assume some of the other additional attributes set there (https://github.com/wandb/weave/blob/master/sdks/node/src/__tests__/integrations/piCodingAgent.test.ts#L270-L287) aren't relevant or possible to set in this integration's case?
| assert chat_attrs["gen_ai.request.model"] == "claude-sonnet-4-6" | ||
| assert chat_attrs["gen_ai.conversation.id"] == "s-abc123" | ||
| assert chat_attrs["gen_ai.usage.input_tokens"] == 25 | ||
| assert chat_attrs["gen_ai.usage.output_tokens"] == 10 |
There was a problem hiding this comment.
Separate comment: this might not be very Pythonic, but on the TS side, I'm hoping to lean into more exhaustive assertions as we maintain more integrations. YMMV, but when confirming to a spec, kinda like being able to see the full data picture rather than parsing individual assertions and trying to understand if they cover everything. eg...
assert chat_attrs == {
'gen_ai.conversation.id': 's-abc123',
'gen_ai.operation.name': 'chat',
'gen_ai.provider.name': 'anthropic',
'gen_ai.request.model': 'claude-sonnet-4-6',
'gen_ai.output.messages': '[{"role": "assistant", "parts": [{"type": "text", ''"content": "The answer is 4."}]}]',
'gen_ai.usage.input_tokens': 25,
'gen_ai.usage.output_tokens': 10
}There was a problem hiding this comment.
Agreed, we can do it this way. It can get a little noisy for nested dicts, but for plain dicts this is ok
Initial Claude Agents SDK integration in OTEL