Working with CrewAI

Add end-to-end tracing to Agno agent workflows with LangDB—monitor model calls, tool usage, and step flows using a single init() call.

LangDB makes it effortless to trace CrewAI workflows end-to-end. With a single init() call, all agent interactions, task executions, and LLM calls are captured.

Installation

Install the LangDB client with LangChain feature flag:

Quick Start

Export Environment Variables

Set your LangDB credentials:

Initialize Tracing

Import and run the initialize before configuring your CrewAI Code:

Configure your CrewAI code

All CrewAI calls—agent initialization, task execution, and model responses—are automatically linked.

Complete CrewAI example

Here is a full example based on CrewAI report writing agent.

Example code

Check out the full sample on GitHub: https://github.com/langdb/langdb-samples/tree/main/examples/crewai/crewai-tracingarrow-up-right

Setup Evironment

Export Environment Variables

You also need to get API Key from Serper.devarrow-up-right

main.py

Running your Agent

Navigate to the parent directory of your agent project and use one of the following commands:

Traces on LangDB:

When you run queries against your agent, LangDB automatically captures detailed traces of all agent interactions:

Simple CrewAI Example Trace

Next Steps: Advanced CrewAI Integration

This guide covered the basics of integrating LangDB with CrewAI using a Research and Planning agent example. For more complex scenarios and advanced use cases, check out our comprehensive resources in Guides Section.

Last updated

Was this helpful?