examples/integration-crewai/README.md
This example shows how to use CrewAI agents with promptfoo to evaluate AI agent performance.
CrewAI is a framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
You can run this example with:
npx promptfoo@latest init --example integration-crewai
cd integration-crewai
This example requires the following:
You need to set the OpenAI API key. Choose one of these methods:
export OPENAI_API_KEY=your-api-key-here
Create a .env file in this directory:
OPENAI_API_KEY=your-api-key-here
If using a .env file, uncomment python-dotenv in requirements.txt and reinstall dependencies.
Install Python packages:
pip install -r requirements.txt
Note: The openai package and other dependencies (langchain, pydantic, etc.) will be automatically installed as dependencies of crewai.
Install promptfoo CLI:
npm install -g promptfoo
agent.py: Contains the CrewAI agent setup and promptfoo provider interfacepromptfooconfig.yaml: Configures prompts, providers, and tests for evaluationWhen using a real LLM, you may notice that the agent's output is not always reliable, especially for more complex queries. For example, the agent may fail to return valid JSON or may not return a response at all. This is a common challenge when working with LLMs.
Run the evaluation:
promptfoo eval
Explore results in browser:
promptfoo view
If you see authentication errors: