Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Felix-Ayush 61b7c246ba
docs: Guide for Evaluating LangGraph Agents with Promptfoo (#4926)
3 weeks ago
..
1092f0e2cb
docs: improve crewai eval example (#5035)
1 month ago
61b7c246ba
docs: Guide for Evaluating LangGraph Agents with Promptfoo (#4926)
3 weeks ago
1092f0e2cb
docs: improve crewai eval example (#5035)
1 month ago
1092f0e2cb
docs: improve crewai eval example (#5035)
1 month ago

README.md

You have to be logged in to leave a comment. Sign In

crewai

This example shows how to use CrewAI agents with promptfoo to evaluate AI agent performance.

What is CrewAI?

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.

Quick Start

You can run this example with:

npx promptfoo@latest init --example crewai

Prerequisites

This example requires the following:

  1. Python 3.10+
  2. Node.js 14+
  3. OpenAI API Key - You MUST have a valid OpenAI API key to run this example

Environment Setup

You need to set the OpenAI API key. Choose one of these methods:

export OPENAI_API_KEY=your-api-key-here

Option 2: .env File

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.

Installation

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

Files

  • agent.py: Contains the CrewAI agent setup and promptfoo provider interface
  • promptfooconfig.yaml: Configures prompts, providers, and tests for evaluation

Note on Reliability

When 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.

Running the Evaluation

Run the evaluation:

promptfoo eval

Explore results in browser:

promptfoo view

Troubleshooting

If you see authentication errors:

  • Ensure your OpenAI API key is set correctly
  • Verify the key is valid and has sufficient quota
  • Check that the environment variable is accessible to the Python process
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...