CrewAI
This guide explains how to integrate HoneyHive with CrewAI for tracing and monitoring your AI agent workflows.
Introduction
CrewAI is a framework for orchestrating role-playing autonomous AI agents. By integrating CrewAI with HoneyHive, you can trace and monitor your agent interactions, enabling better visibility, evaluation, and improvement of your agent workflows.
Prerequisites
- A HoneyHive account
- A CrewAI project
- A HoneyHive API key
Initializing HoneyHive Tracer
Use the following code to initialize HoneyHive tracing in your CrewAI project:
This initializes auto-tracing for your CrewAI application. You can customize the session name to organize your traces logically.
Using the @trace
Decorator
HoneyHive provides a @trace
decorator that you can use to trace specific functions in your CrewAI workflow:
By decorating key functions with @trace
, you can create a hierarchical trace structure that reflects your CrewAI workflow.
Required Environment Variables
Make sure to set the following environment variables before running your application:
HONEYHIVE_API_KEY
: Your HoneyHive API keyHONEYHIVE_PROJECT_NAME
: The name of your HoneyHive project (defaults to “crewai-demo” in the example)HONEYHIVE_SOURCE
: The source of your traces (defaults to “dev” in the example)
You can use a .env
file and the python-dotenv
package to manage these environment variables.
For the most up-to-date compatibility information, please refer to the HoneyHive documentation.
Enriching Properties
For information on how to enrich your traces and spans with additional context, see our enrichment documentation.
Adding Evaluators
Once traces have been logged in the HoneyHive platform, you can then run evaluations with Python or TypeScript.
Complete Example
Below is a complete example demonstrating how to integrate HoneyHive tracing with a CrewAI workflow:
What Gets Traced
When you use HoneyHive with CrewAI, the following information is traced:
- Agent Creation: Details about the agents’ roles, goals, and backstories
- Task Creation: Task descriptions, expected outputs, and agent assignments
- Crew Execution: The entire workflow of the crew, including all agent interactions
- Function Calls: Any function decorated with
@trace
will have its inputs and outputs traced
This tracing allows you to:
- Visualize your CrewAI workflow in the HoneyHive dashboard
- Analyze agent performance and interactions
- Debug issues in your agent workflows
- Evaluate the quality of agent outputs
- Monitor the execution time of different components
Conclusion
By integrating HoneyHive with CrewAI, you gain powerful tracing and monitoring capabilities for your AI agent workflows. This enables you to build more robust, reliable, and effective multi-agent systems.
For more information on HoneyHive tracing, please refer to our tracing documentation.