> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langtrace.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI

> Langtrace and CrewAI Integration Guide

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](/quickstart) the SDK in your code.
2. Install CrewAI's SDK and [initialize](https://docs.crewai.com/how-to/Installing-CrewAI/) the SDK in your code.

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

  ```python theme={null}
  from langtrace_python_sdk import langtrace
  langtrace.init(api_key='<LANGTRACE_API_KEY>')

  # Now import CrewAI modules

  from crewai import Agent, Task, Crew

  ```
</Note>

### 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:

```toml theme={null}
[project]
dependencies = [
  # ... other dependencies ...
  "langtrace_python_sdk>=3.3"
]
```

### Usage

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

<img src="https://mintcdn.com/langtraceai-2/hZpPXosaHdgAfpXF/images/crew_image.png?fit=max&auto=format&n=hZpPXosaHdgAfpXF&q=85&s=8af782062b3269dbff7d8f9075cb5652" alt="traces" width="3034" height="1348" data-path="images/crew_image.png" />

## Example Implementation

For a complete example of how to integrate Langtrace with CrewAI, check out our [example recipe](https://github.com/Scale3-Labs/langtrace-recipes/tree/main/integrations/llm-framework/crewai) in the langtrace-recipes repository. This example demonstrates best practices for instrumenting CrewAI agents with Langtrace for comprehensive observability.
