CrewAI
CrewAI is a lean, lightning-fast Python framework for creating autonomous AI agents tailored to any scenario.
Quickstart
Confident AI provides a instrumentator
that can trace CrewAI’s execution with just a single line of code.
Install the following package:
pip install -U deepeval
With your Confident API key, initialize DeepEval’s instrumentator
in your agent’s main.py
script:
from deepeval.integrations.crewai import instrumentator
instrumentator(api_key="<your-confident-api-key>")
That’s it! You can now see the traces on Confident AI’s Observability.
Basic CrewAI Agent
Here’s a basic example of a CrewAI agent with Confident AI’s instrumentator
:
pip install crewai
main.py
from crewai import Agent, Task, Crew
import os
from deepeval.integrations.crewai import instrumentator
import time
os.environ["OPENAI_API_KEY"] = "<your-openai-api-key>"
instrumentator(api_key="<your-confident-api-key>")
# Define your agents with roles and goals
coder = Agent(
role='Consultant',
goal='Write clear, concise explanation.',
backstory='An expert consultant with a keen eye for software trends.',
)
# Create tasks for your agents
task1 = Task(
description="Explain the latest trends in AI.",
expected_output="A clear and concise explanation.",
agent=coder
)
# Instantiate your crew
crew = Crew(
agents=[coder],
tasks=[task1],
)
# Kickoff your crew
result = crew.kickoff()
print(result)
time.sleep(7) # Wait for traces to be posted to observatory
Run your agent:
python main.py
After execution, you can see the traces on Confident AI’s Observability.
Last updated on