CrewAI is an innovative, open-source framework that revolutionizes the way AI agents work together. By orchestrating role-playing, autonomous agents, CrewAI enables the creation of sophisticated multi-agent systems that can tackle complex tasks with ease.

Setup

Installation

  1. Install Langtrace’s SDK and initialize the SDK in your code.
  2. Install CrewAI’s SDK and initialize the SDK in your code.

Import and initialize Langtrace at the beginning of your script, before any CrewAI imports:

from langtrace_python_sdk import langtrace
langtrace.init(api_key='<LANGTRACE_API_KEY>')

# Now import CrewAI modules

from crewai import Agent, Task, Crew

Additional Setup for CrewAI CLI Projects

When using CrewAI’s CLI (e.g., when you create a project using crewai create crew <crewname>), you need to add Langtrace as a dependency in your project’s pyproject.toml file:

[project]
dependencies = [
  # ... other dependencies ...
  "langtrace_python_sdk>=3.3"
]

Usage

Use the langtrace SDK to capture traces from your CrewAI agents.

Example Implementation

For a complete example of how to integrate Langtrace with CrewAI, check out our example recipe in the langtrace-recipes repository. This example demonstrates best practices for instrumenting CrewAI agents with Langtrace for comprehensive observability.