Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

fix: ensure nonetypes are not passed to otel (#4052)

Greyson LaLonde177294f588de
diff --git a/lib/crewai/src/crewai/telemetry/telemetry.py b/lib/crewai/src/crewai/telemetry/telemetry.py
index 848ba1133..84e089a09 100644
--- a/lib/crewai/src/crewai/telemetry/telemetry.py
+++ b/lib/crewai/src/crewai/telemetry/telemetry.py
@@ -392,9 +392,7 @@ class Telemetry:
self._add_attribute(span, "platform_system", platform.system())
self._add_attribute(span, "platform_version", platform.version())
self._add_attribute(span, "cpus", os.cpu_count())
- self._add_attribute(
- span, "crew_inputs", json.dumps(inputs) if inputs else None
- )
+ self._add_attribute(span, "crew_inputs", json.dumps(inputs or {}))
else:
self._add_attribute(
span,
@@ -707,9 +705,7 @@ class Telemetry:
self._add_attribute(span, "model_name", model_name)
if crew.share_crew:
- self._add_attribute(
- span, "inputs", json.dumps(inputs) if inputs else None
- )
+ self._add_attribute(span, "inputs", json.dumps(inputs or {}))
close_span(span)
@@ -814,9 +810,7 @@ class Telemetry:
add_crew_attributes(
span, crew, self._add_attribute, include_fingerprint=False
)
- self._add_attribute(
- span, "crew_inputs", json.dumps(inputs) if inputs else None
- )
+ self._add_attribute(span, "crew_inputs", json.dumps(inputs or {}))
self._add_attribute(
span,
"crew_agents",