CrewAI
Neatlogs offers seamless integration with CrewAI, a popular framework for building multi-agent applications.
Installation
To get started with CrewAI, you'll need to install the package:
pip install neatlogs crewai
Setting Up API Keys
Before using CrewAI with Neatlogs, you need to set up your API keys. You can obtain:
NEATLOGS_API_KEY
: From your Neatlogs Dashboard
Then to set them up, you can either export them as environment variables or set them in a .env
file:
NEATLOGS_API_KEY="your_neatlogs_api_key_here"
Then load the environment variables in your Python code:
from dotenv import load_dotenv
import os
# Load environment variables from .env file
load_dotenv()
os.getenv("NEATLOGS_API_KEY")
Usage
Once you've set up your CrewAI agents, integrating Neatlogs takes just two lines of code:
import neatlogs
neatlogs.init("<YOUR_API_KEY>")
Examples
Here's a simple example of how to use CrewAI with Neatlogs:
import neatlogs
from crewai import Agent, Task, Crew
from dotenv import load_dotenv
import os
# Load environment variables from .env file
load_dotenv()
# Initialize Neatlogs
neatlogs.init(os.getenv("NEATLOGS_API_KEY"))
# Create your agents
researcher = Agent(
role='Senior Research Analyst',
goal='Uncover cutting-edge developments in AI',
backstory='You work at a leading tech think tank...',
verbose=True,
memory=True
)
# Create tasks
research_task = Task(
description='Investigate the latest AI trends',
expected_output='A comprehensive report on AI trends',
agent=researcher
)
# Create and run the crew
crew = Crew(
agents=[researcher],
tasks=[research_task]
)
result = crew.kickoff()
print(result)
After that, every agent run is automatically traced and visualized in Neatlogs, perfect for debugging, evaluating and collaborating.
For more information on CrewAI, check out their comprehensive documentation and quickstart guide.