mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-22 14:48:13 +00:00
feat(tracing): enhance first-time trace display and auto-open browser
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
from rich.panel import Panel
|
from rich.panel import Panel
|
||||||
@@ -108,9 +109,14 @@ class FirstTimeTraceHandler:
|
|||||||
self._gracefully_fail(f"Backend initialization failed: {e}")
|
self._gracefully_fail(f"Backend initialization failed: {e}")
|
||||||
|
|
||||||
def _display_ephemeral_trace_link(self):
|
def _display_ephemeral_trace_link(self):
|
||||||
"""Display the ephemeral trace link to the user."""
|
"""Display the ephemeral trace link to the user and automatically open browser."""
|
||||||
console = Console()
|
console = Console()
|
||||||
|
|
||||||
|
try:
|
||||||
|
webbrowser.open(self.ephemeral_url)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
panel_content = f"""
|
panel_content = f"""
|
||||||
🎉 Your First CrewAI Execution Trace is Ready!
|
🎉 Your First CrewAI Execution Trace is Ready!
|
||||||
|
|
||||||
|
|||||||
@@ -138,13 +138,6 @@ class TraceBatchManager:
|
|||||||
if not use_ephemeral
|
if not use_ephemeral
|
||||||
else response_data["ephemeral_trace_id"]
|
else response_data["ephemeral_trace_id"]
|
||||||
)
|
)
|
||||||
console = Console()
|
|
||||||
panel = Panel(
|
|
||||||
f"✅ Trace batch initialized with session ID: {self.trace_batch_id}",
|
|
||||||
title="Trace Batch Initialization",
|
|
||||||
border_style="green",
|
|
||||||
)
|
|
||||||
console.print(panel)
|
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Trace batch initialization returned status {response.status_code}. Continuing without tracing."
|
f"Trace batch initialization returned status {response.status_code}. Continuing without tracing."
|
||||||
@@ -263,7 +256,8 @@ class TraceBatchManager:
|
|||||||
title="Trace Batch Finalization",
|
title="Trace Batch Finalization",
|
||||||
border_style="green",
|
border_style="green",
|
||||||
)
|
)
|
||||||
console.print(panel)
|
if not should_auto_collect_first_time_traces():
|
||||||
|
console.print(panel)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|||||||
Reference in New Issue
Block a user