9
9
10
10
11
11
class SpanData (abc .ABC ):
12
+ """
13
+ Represents span data in the trace.
14
+ """
15
+
12
16
@abc .abstractmethod
13
17
def export (self ) -> dict [str , Any ]:
18
+ """Export the span data as a dictionary."""
14
19
pass
15
20
16
21
@property
17
22
@abc .abstractmethod
18
23
def type (self ) -> str :
24
+ """Return the type of the span."""
19
25
pass
20
26
21
27
22
28
class AgentSpanData (SpanData ):
29
+ """
30
+ Represents an Agent Span in the trace.
31
+ Includes name, handoffs, tools, and output type.
32
+ """
33
+
23
34
__slots__ = ("name" , "handoffs" , "tools" , "output_type" )
24
35
25
36
def __init__ (
@@ -49,6 +60,11 @@ def export(self) -> dict[str, Any]:
49
60
50
61
51
62
class FunctionSpanData (SpanData ):
63
+ """
64
+ Represents a Function Span in the trace.
65
+ Includes input, output and MCP data (if applicable).
66
+ """
67
+
52
68
__slots__ = ("name" , "input" , "output" , "mcp_data" )
53
69
54
70
def __init__ (
@@ -78,6 +94,11 @@ def export(self) -> dict[str, Any]:
78
94
79
95
80
96
class GenerationSpanData (SpanData ):
97
+ """
98
+ Represents a Generation Span in the trace.
99
+ Includes input, output, model, model configuration, and usage.
100
+ """
101
+
81
102
__slots__ = (
82
103
"input" ,
83
104
"output" ,
@@ -116,6 +137,11 @@ def export(self) -> dict[str, Any]:
116
137
117
138
118
139
class ResponseSpanData (SpanData ):
140
+ """
141
+ Represents a Response Span in the trace.
142
+ Includes response and input.
143
+ """
144
+
119
145
__slots__ = ("response" , "input" )
120
146
121
147
def __init__ (
@@ -140,6 +166,11 @@ def export(self) -> dict[str, Any]:
140
166
141
167
142
168
class HandoffSpanData (SpanData ):
169
+ """
170
+ Represents a Handoff Span in the trace.
171
+ Includes source and desitnation agents.
172
+ """
173
+
143
174
__slots__ = ("from_agent" , "to_agent" )
144
175
145
176
def __init__ (self , from_agent : str | None , to_agent : str | None ):
@@ -159,6 +190,11 @@ def export(self) -> dict[str, Any]:
159
190
160
191
161
192
class CustomSpanData (SpanData ):
193
+ """
194
+ Represents a Custom Span in the trace.
195
+ Includes name and data property bag.
196
+ """
197
+
162
198
__slots__ = ("name" , "data" )
163
199
164
200
def __init__ (self , name : str , data : dict [str , Any ]):
@@ -178,6 +214,11 @@ def export(self) -> dict[str, Any]:
178
214
179
215
180
216
class GuardrailSpanData (SpanData ):
217
+ """
218
+ Represents a Guardrail Span in the trace.
219
+ Includes name and triggered status.
220
+ """
221
+
181
222
__slots__ = ("name" , "triggered" )
182
223
183
224
def __init__ (self , name : str , triggered : bool = False ):
@@ -197,6 +238,11 @@ def export(self) -> dict[str, Any]:
197
238
198
239
199
240
class TranscriptionSpanData (SpanData ):
241
+ """
242
+ Represents a Transcription Span in the trace.
243
+ Includes input, output, model, and model configuration.
244
+ """
245
+
200
246
__slots__ = (
201
247
"input" ,
202
248
"output" ,
@@ -236,6 +282,11 @@ def export(self) -> dict[str, Any]:
236
282
237
283
238
284
class SpeechSpanData (SpanData ):
285
+ """
286
+ Represents a Speech Span in the trace.
287
+ Includes input, output, model, model configuration, and first content timestamp.
288
+ """
289
+
239
290
__slots__ = ("input" , "output" , "model" , "model_config" , "first_content_at" )
240
291
241
292
def __init__ (
@@ -273,6 +324,10 @@ def export(self) -> dict[str, Any]:
273
324
274
325
275
326
class SpeechGroupSpanData (SpanData ):
327
+ """
328
+ Represents a Speech Group Span in the trace.
329
+ """
330
+
276
331
__slots__ = "input"
277
332
278
333
def __init__ (
@@ -293,6 +348,11 @@ def export(self) -> dict[str, Any]:
293
348
294
349
295
350
class MCPListToolsSpanData (SpanData ):
351
+ """
352
+ Represents an MCP List Tools Span in the trace.
353
+ Includes server and result.
354
+ """
355
+
296
356
__slots__ = (
297
357
"server" ,
298
358
"result" ,
0 commit comments