Commit 14ab89a
feat(events): add span events and real-time streaming infrastructure (#21)
* feat(events): add span events and real-time streaming infrastructure
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>
* fix(lint): format test_events.py with ruff
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 247ed56 commit 14ab89a
3 files changed
+816
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
8 | 27 | | |
9 | 28 | | |
10 | 29 | | |
11 | 30 | | |
| 31 | + | |
12 | 32 | | |
13 | 33 | | |
14 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
15 | 54 | | |
0 commit comments