diff --git a/lib/crewai/src/crewai/events/listeners/tracing/trace_listener.py b/lib/crewai/src/crewai/events/listeners/tracing/trace_listener.py index 25774b3e4..0e3b284c0 100644 --- a/lib/crewai/src/crewai/events/listeners/tracing/trace_listener.py +++ b/lib/crewai/src/crewai/events/listeners/tracing/trace_listener.py @@ -204,7 +204,11 @@ class TraceCollectionListener(BaseEventListener): # Skip registration entirely if tracing is disabled and not first-time user # This avoids overhead of 50+ handler registrations when tracing won't be used # Also check is_tracing_enabled_in_context() so per-run overrides (Crew(tracing=True)) still work - if not should_enable_tracing() and not is_tracing_enabled_in_context() and not should_auto_collect_first_time_traces(): + if ( + not should_enable_tracing() + and not is_tracing_enabled_in_context() + and not should_auto_collect_first_time_traces() + ): self._listeners_setup = True return diff --git a/lib/crewai/src/crewai/events/listeners/tracing/utils.py b/lib/crewai/src/crewai/events/listeners/tracing/utils.py index 545892d20..314922870 100644 --- a/lib/crewai/src/crewai/events/listeners/tracing/utils.py +++ b/lib/crewai/src/crewai/events/listeners/tracing/utils.py @@ -490,10 +490,10 @@ def _is_interactive_terminal() -> bool: import sys try: - stdin = getattr(sys, 'stdin', None) + stdin = getattr(sys, "stdin", None) if stdin is None: return False - isatty = getattr(stdin, 'isatty', None) + isatty = getattr(stdin, "isatty", None) if not callable(isatty): return False return bool(isatty())