Langchain Tool Integration
Langchain readily provides a number of tools at hand. These tools can be integrated into AG2 framework through interoperability.Installation
To integrate LangChain tools into the AG2 framework, install the required dependencies:Note: If you have been usingAdditionally, this notebook uses LangChain’s DuckDuckGo Search Tool, which requires theautogen
orag2
, all you need to do is upgrade it using:orasautogen
, andag2
are aliases for the same PyPI package.
duckduckgo-search
package. Install it with:
Preparation
Import necessary modules and tools. - DuckDuckGoSearchRun and DuckDuckGoSearchAPIWrapper: Tools for querying DuckDuckGo. -Interoperability
: This module acts as
a bridge, making it easier to integrate LangChain tools with AG2’s
architecture.
Configure the agents
Load the config for LLM, which include API key and model.Tool Integration
We useInteroperability
to convert the LangChain tool into a format
compatible with the AG2 framework.
tool_lib
argument. This will let the agents within the nested chat
created by CaptainAgent all equipped with the tools. THey can write
python code to call the tools and observe the results.
CrewAI Tool Integration
CrewAI also provides a variety of powerful tools designed for tasks such as web scraping, search, code interpretation, and more. The full list of available tools in CrewAI can be observed here.Installation
Install the required packages for integrating CrewAI tools into the AG2 framework. This ensures all dependencies for both frameworks are installed.Note: If you have been usingautogen
orag2
, all you need to do is upgrade it using:orasautogen
, andag2
are aliases for the same PyPI package.
Tool Integration
Integrating CrewAI tools into AG2 framework follows a similar pipeline as shown below.Adding tools to CaptainAgent
The process is identical to the above, pass the converted tool totool_lib
argument, and all the agents created by CaptainAgent gets
access to the tools.