Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
ensure panel for viewing traces is visible (#7803)
Lorenze Jayd183aedbd8e4
diff --git a/lib/crewai/src/crewai/telemetry/tracing/grants.py b/lib/crewai/src/crewai/telemetry/tracing/grants.pyindex a9dcc3071..353f633ba 100644--- a/lib/crewai/src/crewai/telemetry/tracing/grants.py+++ b/lib/crewai/src/crewai/telemetry/tracing/grants.py@@ -17,6 +17,7 @@ from opentelemetry.exporter.otlp.proto.common.trace_encoder import encode_spansfrom opentelemetry.sdk.trace import ReadableSpanfrom opentelemetry.sdk.trace.export import SpanExportResult, SpanExporterfrom rich.console import Console+from rich.panel import Panelfrom rich.style import Stylefrom rich.text import Text@@ -304,7 +305,7 @@ class GrantSpanExporter(SpanExporter):self._show_trace_link()def _show_trace_link(self) -> None:- """One line, once: where to see the run that was just exported.+ """Show where to see the run that was just exported, once.The execution id stays out of it — `crewai eval` reads that from therecord — but whoever wants to open the trace gets AMP's viewer link.@@ -318,7 +319,12 @@ class GrantSpanExporter(SpanExporter):self._trace_url,style=Style(color="cyan", underline=True, link=self._trace_url),)- Console().print(line)+ title = (+ "🔗 Ephemeral Execution Traces"+ if self._client._tier == "ephemeral"+ else "🔗 Execution Traces"+ )+ Console().print(Panel(line, title=title, border_style="green", padding=(1, 2)))def shutdown(self) -> None:with self._lock:diff --git a/lib/crewai/tests/telemetry/test_session_trace_export.py b/lib/crewai/tests/telemetry/test_session_trace_export.pyindex ee39e61a0..426a99d25 100644--- a/lib/crewai/tests/telemetry/test_session_trace_export.py+++ b/lib/crewai/tests/telemetry/test_session_trace_export.py@@ -212,6 +212,8 @@ def test_the_viewer_link_is_shown_the_id_is_not_and_a_successful_export_is_recor# a run that was exported whole, and not where tracing messages are suppressed.shown = recorded and suppression is Noneassert ("View traces:" in output) == shown+ assert ("Execution Traces" in output and "╭" in output) == shown+ assert ("Ephemeral Execution Traces" in output) == (shown and not authenticated)assert (url in output.replace("\n", "")) == shownassert len(collector.batches) == int(authenticated or approved)# A run whose spans reached Wharf is recorded for `crewai eval`, silently,