LangSmith can capture traces generated by CrewAI using OpenTelemetry instrumentation. This guide shows you how to automatically capture traces from your CrewAI multi-agent workflows and send them to LangSmith for monitoring and analysis.
You can add custom metadata to your traces by setting span attributes:
Copy
from opentelemetry import tracetracer = trace.get_tracer(__name__)def run_crew_with_metadata(): with tracer.start_as_current_span("crewai_workflow") as span: span.set_attribute("langsmith.metadata.crew_type", "code_generation") span.set_attribute("langsmith.metadata.agent_count", "1") span.set_attribute("langsmith.span.tags", "crewai,code-generation") result = crew.kickoff() return result