CrewAI Tools Integration
Introduction
CrewAI provides a variety of powerful tools designed for tasks such as web scraping, search, code interpretation, and more. These tools are easy to integrate into the AG2 framework, allowing you to enhance your agents with advanced capabilities. You can explore the full list of available tools in the CrewAI Tools repository.
Installation
Install the required packages for integrating CrewAI tools into the AG2 framework. This ensures all dependencies for both frameworks are installed.
Imports
Import necessary modules and tools.
- ScrapeWebsiteTool: A CrewAI tool for web scraping.
AssistantAgent
andUserProxyAgent
: Core AG2 classes.Interoperability
: This module acts as a bridge, making it easier to integrate CrewAI tools with AG2’s architecture.
Agent Configuration
Configure the agents for the interaction.
config_list
defines the LLM configurations, including the model and API key.UserProxyAgent
simulates user inputs without requiring actual human interaction (set toNEVER
).AssistantAgent
represents the AI agent, configured with the LLM settings.
Tool Integration
Integrate the CrewAI tool with AG2.
Interoperability
converts the CrewAI tool to a format compatible with AG2.- ScrapeWebsiteTool is used for web scraping tasks.
- Register the tool for both execution and interaction with LLMs.
Initiating the chat
Initiate the conversation between the UserProxyAgent
and the AssistantAgent
to utilize the CrewAI tool.
Output
The chatbot
provides results based on the web scraping operation:
You can also access a detailed summary of the interaction: