@@ -281,8 +281,16 @@ def operation():
281
281
return self ._safe_telemetry_operation (operation )
282
282
283
283
def task_ended (self , span : Span , task : Task , crew : Crew ):
284
- """Records task execution in a crew."""
284
+ """Records the completion of a task execution in a crew.
285
285
286
+ Args:
287
+ span (Span): The OpenTelemetry span tracking the task execution
288
+ task (Task): The task that was completed
289
+ crew (Crew): The crew context in which the task was executed
290
+
291
+ Note:
292
+ If share_crew is enabled, this will also record the task output
293
+ """
286
294
def operation ():
287
295
if crew .share_crew :
288
296
self ._add_attribute (
@@ -297,8 +305,13 @@ def operation():
297
305
self ._safe_telemetry_operation (operation )
298
306
299
307
def tool_repeated_usage (self , llm : Any , tool_name : str , attempts : int ):
300
- """Records the repeated usage 'error' of a tool by an agent."""
308
+ """Records when a tool is used repeatedly, which might indicate an issue.
301
309
310
+ Args:
311
+ llm (Any): The language model being used
312
+ tool_name (str): Name of the tool being repeatedly used
313
+ attempts (int): Number of attempts made with this tool
314
+ """
302
315
def operation ():
303
316
tracer = trace .get_tracer ("crewai.telemetry" )
304
317
span = tracer .start_span ("Tool Repeated Usage" )
@@ -317,8 +330,13 @@ def operation():
317
330
self ._safe_telemetry_operation (operation )
318
331
319
332
def tool_usage (self , llm : Any , tool_name : str , attempts : int ):
320
- """Records the usage of a tool by an agent."""
333
+ """Records the usage of a tool by an agent.
321
334
335
+ Args:
336
+ llm (Any): The language model being used
337
+ tool_name (str): Name of the tool being used
338
+ attempts (int): Number of attempts made with this tool
339
+ """
322
340
def operation ():
323
341
tracer = trace .get_tracer ("crewai.telemetry" )
324
342
span = tracer .start_span ("Tool Usage" )
@@ -337,8 +355,11 @@ def operation():
337
355
self ._safe_telemetry_operation (operation )
338
356
339
357
def tool_usage_error (self , llm : Any ):
340
- """Records the usage of a tool by an agent."""
358
+ """Records when a tool usage results in an error.
341
359
360
+ Args:
361
+ llm (Any): The language model being used when the error occurred
362
+ """
342
363
def operation ():
343
364
tracer = trace .get_tracer ("crewai.telemetry" )
344
365
span = tracer .start_span ("Tool Usage Error" )
@@ -357,6 +378,14 @@ def operation():
357
378
def individual_test_result_span (
358
379
self , crew : Crew , quality : float , exec_time : int , model_name : str
359
380
):
381
+ """Records individual test results for a crew execution.
382
+
383
+ Args:
384
+ crew (Crew): The crew being tested
385
+ quality (float): Quality score of the execution
386
+ exec_time (int): Execution time in seconds
387
+ model_name (str): Name of the model used
388
+ """
360
389
def operation ():
361
390
tracer = trace .get_tracer ("crewai.telemetry" )
362
391
span = tracer .start_span ("Crew Individual Test Result" )
@@ -383,6 +412,14 @@ def test_execution_span(
383
412
inputs : dict [str , Any ] | None ,
384
413
model_name : str ,
385
414
):
415
+ """Records the execution of a test suite for a crew.
416
+
417
+ Args:
418
+ crew (Crew): The crew being tested
419
+ iterations (int): Number of test iterations
420
+ inputs (dict[str, Any] | None): Input parameters for the test
421
+ model_name (str): Name of the model used in testing
422
+ """
386
423
def operation ():
387
424
tracer = trace .get_tracer ("crewai.telemetry" )
388
425
span = tracer .start_span ("Crew Test Execution" )
@@ -408,6 +445,7 @@ def operation():
408
445
self ._safe_telemetry_operation (operation )
409
446
410
447
def deploy_signup_error_span (self ):
448
+ """Records when an error occurs during the deployment signup process."""
411
449
def operation ():
412
450
tracer = trace .get_tracer ("crewai.telemetry" )
413
451
span = tracer .start_span ("Deploy Signup Error" )
@@ -417,6 +455,11 @@ def operation():
417
455
self ._safe_telemetry_operation (operation )
418
456
419
457
def start_deployment_span (self , uuid : Optional [str ] = None ):
458
+ """Records the start of a deployment process.
459
+
460
+ Args:
461
+ uuid (Optional[str]): Unique identifier for the deployment
462
+ """
420
463
def operation ():
421
464
tracer = trace .get_tracer ("crewai.telemetry" )
422
465
span = tracer .start_span ("Start Deployment" )
@@ -428,6 +471,7 @@ def operation():
428
471
self ._safe_telemetry_operation (operation )
429
472
430
473
def create_crew_deployment_span (self ):
474
+ """Records the creation of a new crew deployment."""
431
475
def operation ():
432
476
tracer = trace .get_tracer ("crewai.telemetry" )
433
477
span = tracer .start_span ("Create Crew Deployment" )
@@ -437,6 +481,12 @@ def operation():
437
481
self ._safe_telemetry_operation (operation )
438
482
439
483
def get_crew_logs_span (self , uuid : Optional [str ], log_type : str = "deployment" ):
484
+ """Records the retrieval of crew logs.
485
+
486
+ Args:
487
+ uuid (Optional[str]): Unique identifier for the crew
488
+ log_type (str, optional): Type of logs being retrieved. Defaults to "deployment".
489
+ """
440
490
def operation ():
441
491
tracer = trace .get_tracer ("crewai.telemetry" )
442
492
span = tracer .start_span ("Get Crew Logs" )
@@ -449,6 +499,11 @@ def operation():
449
499
self ._safe_telemetry_operation (operation )
450
500
451
501
def remove_crew_span (self , uuid : Optional [str ] = None ):
502
+ """Records the removal of a crew.
503
+
504
+ Args:
505
+ uuid (Optional[str]): Unique identifier for the crew being removed
506
+ """
452
507
def operation ():
453
508
tracer = trace .get_tracer ("crewai.telemetry" )
454
509
span = tracer .start_span ("Remove Crew" )
@@ -574,6 +629,11 @@ def operation():
574
629
self ._safe_telemetry_operation (operation )
575
630
576
631
def flow_creation_span (self , flow_name : str ):
632
+ """Records the creation of a new flow.
633
+
634
+ Args:
635
+ flow_name (str): Name of the flow being created
636
+ """
577
637
def operation ():
578
638
tracer = trace .get_tracer ("crewai.telemetry" )
579
639
span = tracer .start_span ("Flow Creation" )
@@ -584,6 +644,12 @@ def operation():
584
644
self ._safe_telemetry_operation (operation )
585
645
586
646
def flow_plotting_span (self , flow_name : str , node_names : list [str ]):
647
+ """Records flow visualization/plotting activity.
648
+
649
+ Args:
650
+ flow_name (str): Name of the flow being plotted
651
+ node_names (list[str]): List of node names in the flow
652
+ """
587
653
def operation ():
588
654
tracer = trace .get_tracer ("crewai.telemetry" )
589
655
span = tracer .start_span ("Flow Plotting" )
@@ -595,6 +661,12 @@ def operation():
595
661
self ._safe_telemetry_operation (operation )
596
662
597
663
def flow_execution_span (self , flow_name : str , node_names : list [str ]):
664
+ """Records the execution of a flow.
665
+
666
+ Args:
667
+ flow_name (str): Name of the flow being executed
668
+ node_names (list[str]): List of nodes being executed in the flow
669
+ """
598
670
def operation ():
599
671
tracer = trace .get_tracer ("crewai.telemetry" )
600
672
span = tracer .start_span ("Flow Execution" )
0 commit comments