feat(events): add span events and real-time streaming infrastructure#21
Merged
vilsonrodrigues merged 2 commits intomainfrom Jan 28, 2026
Merged
feat(events): add span events and real-time streaming infrastructure#21vilsonrodrigues merged 2 commits intomainfrom
vilsonrodrigues merged 2 commits intomainfrom
Conversation
Add new events.py module with: - EventType constants following OpenTelemetry GenAI conventions - StreamEvent dataclass for real-time event streaming - add_event() dual emission (span.add_event + streaming queue) - Convenience functions for agent, model, tool, and flow events - EventStream context manager for astream() consumers - Comprehensive test suite (34 tests) This enables real-time event streaming while persisting events to OTel backends (Jaeger, Zipkin, etc.) via span.add_event(). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1755b90 to
5b38aa4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add new
events.pymodule with span events and real-time streaming infrastructure.Changes
gen_ai.agent.start,gen_ai.tool.call, etc.)name,attributes,timestamp_ns,span_name,span_id,trace_idspan.add_event()(persistence) AND streaming queue (real-time)add_tool_call_event(),add_model_response_chunk_event(), etc.astream()consumersHow it works
Benefits
span.add_event()is calledgen_ai.*namespace (OpenTelemetry standard)trace_id/span_idin StreamEvent for correlationTest plan
🤖 Generated with Claude Code