diff --git a/notebook/tools_interoperability.ipynb b/notebook/tools_interoperability.ipynb
index 28a7ddde97..0018d99de3 100644
--- a/notebook/tools_interoperability.ipynb
+++ b/notebook/tools_interoperability.ipynb
@@ -38,7 +38,8 @@
"### Imports\n",
"\n",
"Import necessary modules and tools.\n",
- "- `WikipediaQueryRun` and `WikipediaAPIWrapper`: Tools for querying Wikipedia.\n",
+ "\n",
+ "- [WikipediaQueryRun](https://api.python.langchain.com/en/latest/tools/langchain_community.tools.wikipedia.tool.WikipediaQueryRun.html) and [WikipediaAPIWrapper](https://python.langchain.com/api_reference/community/utilities/langchain_community.utilities.wikipedia.WikipediaAPIWrapper.html): Tools for querying Wikipedia.\n",
"- `AssistantAgent` and `UserProxyAgent`: Agents that facilitate communication in the AG2 framework.\n",
"- `Interoperability`: This module acts as a bridge, making it easier to integrate LangChain tools with AG2’s architecture."
]
@@ -76,6 +77,7 @@
"### Agent Configuration\n",
"\n",
"Configure the agents for the interaction.\n",
+ "\n",
"- `config_list` defines the LLM configurations, including the model and API key.\n",
"- `UserProxyAgent` simulates user inputs without requiring actual human interaction (set to `NEVER`).\n",
"- `AssistantAgent` represents the AI agent, configured with the LLM settings."
@@ -106,9 +108,9 @@
"### Tool Integration\n",
"\n",
"- Initialize and register the LangChain tool with AG2.\n",
- "- `WikipediaAPIWrapper`: Configured to fetch the top 1 result from Wikipedia with a maximum of 1000 characters per document.\n",
- "- `WikipediaQueryRun`: A LangChain tool that executes Wikipedia queries.\n",
- "- `LangchainInteroperability`: Converts the LangChain tool into a format compatible with the AG2 framework.\n",
+ "- [WikipediaAPIWrapper](https://python.langchain.com/api_reference/community/utilities/langchain_community.utilities.wikipedia.WikipediaAPIWrapper.html): Configured to fetch the top 1 result from Wikipedia with a maximum of 1000 characters per document.\n",
+ "- [WikipediaQueryRun](https://api.python.langchain.com/en/latest/tools/langchain_community.tools.wikipedia.tool.WikipediaQueryRun.html): A LangChain tool that executes Wikipedia queries.\n",
+ "- `Interoperability`: Converts the LangChain tool into a format compatible with the AG2 framework.\n",
"- `ag2_tool.register_for_execution(user_proxy)`: Registers the tool for use by the user_proxy agent.\n",
"- `ag2_tool.register_for_llm(chatbot)`: Registers the tool for integration with the chatbot agent.\n"
]
@@ -215,7 +217,8 @@
"### Imports\n",
"\n",
"Import necessary modules and tools.\n",
- "- `ScrapeWebsiteTool` are the CrewAI tools for web scraping\n",
+ "\n",
+ "- [ScrapeWebsiteTool](https://docs.crewai.com/tools/scrapewebsitetool) are the CrewAI tools for web scraping\n",
"- `AssistantAgent` and `UserProxyAgent` are core AG2 classes.\n",
"- `Interoperability`: This module acts as a bridge, making it easier to integrate CrewAI tools with AG2’s architecture."
]
@@ -241,6 +244,7 @@
"### Agent Configuration\n",
"\n",
"Configure the agents for the interaction.\n",
+ "\n",
"- `config_list` defines the LLM configurations, including the model and API key.\n",
"- `UserProxyAgent` simulates user inputs without requiring actual human interaction (set to `NEVER`).\n",
"- `AssistantAgent` represents the AI agent, configured with the LLM settings."
@@ -271,7 +275,8 @@
"### Tool Integration\n",
"\n",
"Initialize and register the CrewAI tool with AG2.\n",
- "- `crewai_tool` is an instance of the `ScrapeWebsiteTool` from CrewAI.\n",
+ "\n",
+ "- `crewai_tool` is an instance of the [ScrapeWebsiteTool](https://docs.crewai.com/tools/scrapewebsitetool) from CrewAI.\n",
"- `Interoperability` converts the CrewAI tool to make it usable in AG2.\n",
"- `register_for_execution` and `register_for_llm` allow the tool to work with the UserProxyAgent and AssistantAgent."
]
@@ -413,12 +418,13 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Imports\n",
+ "### Imports\n",
"\n",
"Import necessary modules and tools.\n",
- "- `BaseModel`: Used to define data structures for tool inputs and outputs.\n",
- "- `RunContext`: Provides context during the execution of tools.\n",
- "- `PydanticAITool`: Represents a tool in the PydanticAI framework.\n",
+ "\n",
+ "- [BaseModel](https://docs.pydantic.dev/latest/api/base_model/): Used to define data structures for tool inputs and outputs.\n",
+ "- [RunContext](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.RunContext): Provides context during the execution of tools.\n",
+ "- [PydanticAITool](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.Tool): Represents a tool in the PydanticAI framework.\n",
"- `AssistantAgent` and `UserProxyAgent`: Agents that facilitate communication in the AG2 framework.\n",
"- `Interoperability`: This module acts as a bridge, making it easier to integrate PydanticAI tools with AG2’s architecture."
]
@@ -447,6 +453,7 @@
"### Agent Configuration\n",
"\n",
"Configure the agents for the interaction.\n",
+ "\n",
"- `config_list` defines the LLM configurations, including the model and API key.\n",
"- `UserProxyAgent` simulates user inputs without requiring actual human interaction (set to `NEVER`).\n",
"- `AssistantAgent` represents the AI agent, configured with the LLM settings."
@@ -478,8 +485,8 @@
"\n",
"Integrate the PydanticAI tool with AG2.\n",
"\n",
- "- Define a `Player` model using `BaseModel` to structure the input data.\n",
- "- Use `RunContext` to securely inject dependencies (like the `Player` instance) into the tool function without exposing them to the LLM.\n",
+ "- Define a `Player` model using [BaseModel](https://docs.pydantic.dev/latest/api/base_model/) to structure the input data.\n",
+ "- Use [RunContext](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.RunContext) to securely inject dependencies (like the `Player` instance) into the tool function without exposing them to the LLM.\n",
"- Implement `get_player` to define the tool's functionality, accessing `ctx.deps` for injected data.\n",
"- Convert the tool to an AG2-compatible format with `Interoperability` and register it for execution and LLM communication.\n",
"- Convert the PydanticAI tool into an AG2-compatible format using `convert_tool`.\n",
@@ -525,7 +532,7 @@
"\n",
"- Use the `initiate_chat` method to send a message from the `user_proxy` to the `chatbot`.\n",
"- In this example, the user requests the chatbot to retrieve player information, providing \"goal keeper\" as additional context.\n",
- "- The `Player` instance is securely injected into the tool using `RunContext`, ensuring the chatbot can retrieve and use this data during the interaction."
+ "- The `Player` instance is securely injected into the tool using [RunContext](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.RunContext), ensuring the chatbot can retrieve and use this data during the interaction."
]
},
{
@@ -595,6 +602,15 @@
}
],
"metadata": {
+ "front_matter": {
+ "description": "Cross-Framework LLM Tool Integration with AG2",
+ "tags": [
+ "tools",
+ "langchain",
+ "crewai",
+ "pydanticai"
+ ]
+ },
"kernelspec": {
"display_name": "Python 3",
"language": "python",
diff --git a/website/blog/2024-12-20-Tools-interoperability/index.mdx b/website/blog/2024-12-20-Tools-interoperability/index.mdx
index 3f6ae0962d..c57d6869f4 100644
--- a/website/blog/2024-12-20-Tools-interoperability/index.mdx
+++ b/website/blog/2024-12-20-Tools-interoperability/index.mdx
@@ -5,31 +5,44 @@ authors:
tags: [LLM, tools, langchain, crewai, pydanticai]
---
+
+ This content will be hidden.
+ MOVE THE iframe BLOCK OUTSIDE OF div BLOCK ONCE THE VIDEO IS READY
+ ALSO DELETE THIS div BLOCK
+
+
+
**TL;DR**
-AG2 lets you bring in tools from different frameworks like **LangChain**, **CrewAI**, and **PydanticAI**.
+AG2 lets you bring in **Tools** from different frameworks like **LangChain**, **CrewAI**, and **PydanticAI**.
+
+- [LangChain Tools](https://python.langchain.com/v0.1/docs/modules/tools): Useful for tasks like API querying and web scraping.
+- [CrewAI Tools](https://github.com/crewAIInc/crewAI-tools/tree/main): Offers a variety of tools for web scraping, search, and more.
+- [PydanticAI Tools](https://ai.pydantic.dev/tools/): Adds context-driven tools and structured data processing.
-- **LangChain**: Useful for tasks like API querying and web scraping.
-- **CrewAI**: Offers a variety of tools for web scraping, search, and more.
-- **PydanticAI**: Adds context-driven tools and structured data processing.
+**With AG2, you can combine these tools and enhance your agents' capabilities.**
-With AG2, you can combine these tools and enhance your agents' capabilities.
In this post, we’ll walk through how to integrate tools from various frameworks—like [LangChain Tools](https://python.langchain.com/v0.1/docs/modules/tools),
[CrewAI Tools](https://github.com/crewAIInc/crewAI-tools/tree/main), and [PydanticAI Tools](https://ai.pydantic.dev/tools/)—into AG2.
-This allows you to use tools from different frameworks within AG2, giving your agents more power and flexibility. You’ll see how to set up agents, adapt the tools, and validate the integration through examples.his post, you will understand how to configure agents, adapt these tools for use in AG2, and validate the integration through practical examples.
+
+Because, really, the magic happens when you combine them all. This allows you to use tools from different frameworks within AG2, giving your agents more power and flexibility.
+This blog builds upon the concepts covered in the [Tool Integration notebook](/notebooks/tools_interoperability).
+
+In this post, you will understand how to configure agents, adapt these tools for use in AG2, and validate the integration through practical examples.
+
## LangChain Tools Integration
-LangChain is a popular framework that offers a wide range of tools to work with LLMs. LangChain has already implemented a variety of tools that can be easily integrated into AG2. You can explore the available tools in the [LangChain Community Tools](https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/tools) folder. These tools, such as those for querying APIs, web scraping, and text generation, can be quickly incorporated into AG2, providing powerful functionality for your agents.
+LangChain is a popular framework with lots of tools for working with LLMs. It's got a range of tools that can be easily integrated into AG2. If you want to see the full list, check out the [LangChain Community Tools](https://github.com/langchain-ai/langchain/tree/master/libs/community/langchain_community/tools). You can quickly add things like API queries, web scraping, and text generation to your AG2 setup.
### Installation
-To integrate LangChain tools into the AG2 framework, install the required dependencies:
+To get LangChain tools working with AG2, you’ll need to install a couple of dependencies:
```bash
pip install ag2[interop-langchain]
```
-Additionally, this notebook uses LangChain's [Wikipedia Tool](https://api.python.langchain.com/en/latest/tools/langchain_community.tools.wikipedia.tool.WikipediaQueryRun.html), which requires the `wikipedia` package. Install it with:
+Also, we’ll use LangChain’s [Wikipedia Tool](https://python.langchain.com/docs/integrations/tools/wikipedia/), which needs the wikipedia package. Install it like this:
```bash
pip install wikipedia
@@ -37,10 +50,11 @@ pip install wikipedia
### Imports
-Import necessary modules and tools.
-- `WikipediaQueryRun` and `WikipediaAPIWrapper`: Tools for querying Wikipedia.
-- `AssistantAgent` and `UserProxyAgent`: Agents that facilitate communication in the AG2 framework.
-- `Interoperability`: This module acts as a bridge, making it easier to integrate LangChain tools with AG2’s architecture.
+Now, let’s import the necessary modules and tools.
+
+- [WikipediaQueryRun](https://api.python.langchain.com/en/latest/tools/langchain_community.tools.wikipedia.tool.WikipediaQueryRun.html) and [WikipediaAPIWrapper](https://python.langchain.com/api_reference/community/utilities/langchain_community.utilities.wikipedia.WikipediaAPIWrapper.html) are the tools for querying Wikipedia.
+- [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) and [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent) are the agents for interaction within AG2.
+- [`Interoperability`](/docs/reference/interop/interoperability) is what helps connect LangChain tools with AG2.
```python
import os
@@ -54,10 +68,10 @@ from autogen.interop import Interoperability
### 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 to `NEVER`).
-- `AssistantAgent` represents the AI agent, configured with the LLM settings.
+Let’s set up the agents for interaction.
+- `config_list` is where you define the LLM configuration, like the model and API key.
+- [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent) simulates user inputs without requiring actual human interaction (set to `NEVER`).
+- [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) represents the AI agent, configured with the LLM settings.
```python
config_list = [{"model": "gpt-4o", "api_key": os.environ["OPENAI_API_KEY"]}]
@@ -73,13 +87,11 @@ chatbot = AssistantAgent(
```
### Tool Integration
-
-- Initialize and register the LangChain tool with AG2.
-- `WikipediaAPIWrapper`: Configured to fetch the top 1 result from Wikipedia with a maximum of 1000 characters per document.
-- `WikipediaQueryRun`: A LangChain tool that executes Wikipedia queries.
-- `LangchainInteroperability`: Converts the LangChain tool into a format compatible with the AG2 framework.
-- `ag2_tool.register_for_execution(user_proxy)`: Registers the tool for use by the user_proxy agent.
-- `ag2_tool.register_for_llm(chatbot)`: Registers the tool for integration with the chatbot agent.
+Here’s where we connect everything.
+- First, we set up [WikipediaAPIWrapper](https://python.langchain.com/api_reference/community/utilities/langchain_community.utilities.wikipedia.WikipediaAPIWrapper.html), which fetches the top Wikipedia result (with a character limit).
+- Then, we use [WikipediaQueryRun](https://api.python.langchain.com/en/latest/tools/langchain_community.tools.wikipedia.tool.WikipediaQueryRun.html) to perform Wikipedia queries.
+- [`Interoperability`](/docs/reference/interop/interoperability) helps convert the LangChain tool to AG2’s format.
+- Finally, we register the tool for use with both the `user_proxy` and `chatbot`.
```python
api_wrapper = WikipediaAPIWrapper(top_k_results=1, doc_content_chars_max=1000)
@@ -92,13 +104,18 @@ ag2_tool.register_for_execution(user_proxy)
ag2_tool.register_for_llm(chatbot)
```
-### Initiate Chat
+### Initiating the Chat
+
+Once everything’s set up, we can send a message to the chatbot, and it’ll use the Wikipedia tool to fetch the relevant information.
+
```python
message = "Tell me about the history of the United States"
user_proxy.initiate_chat(recipient=chatbot, message=message, max_turns=2)
```
-Output:
+### Output
+
+When the chat is initiated, here’s the output you’ll see:
```console
User (to chatbot):
@@ -153,9 +170,9 @@ pip install ag2[interop-crewai]
### Imports
Import necessary modules and tools.
-- `ScrapeWebsiteTool` are the CrewAI tools for web scraping
-- `AssistantAgent` and `UserProxyAgent` are core AG2 classes.
-- `Interoperability`: This module acts as a bridge, making it easier to integrate CrewAI tools with AG2’s architecture.
+- [ScrapeWebsiteTool](https://docs.crewai.com/tools/scrapewebsitetool): A CrewAI tool for web scraping.
+- [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) and [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent): Core AG2 classes.
+- [`Interoperability`](/docs/reference/interop/interoperability): This module acts as a bridge, making it easier to integrate CrewAI tools with AG2’s architecture.
```python
import os
@@ -170,8 +187,8 @@ from autogen.interop import Interoperability
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 to `NEVER`).
-- `AssistantAgent` represents the AI agent, configured with the LLM settings.
+- [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent) simulates user inputs without requiring actual human interaction (set to `NEVER`).
+- [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) represents the AI agent, configured with the LLM settings.
```python
config_list = [{"model": "gpt-4o", "api_key": os.environ["OPENAI_API_KEY"]}]
@@ -188,10 +205,10 @@ chatbot = AssistantAgent(
### Tool Integration
-Initialize and register the CrewAI tool with AG2.
-- `crewai_tool` is an instance of the `ScrapeWebsiteTool` from CrewAI.
-- `Interoperability` converts the CrewAI tool to make it usable in AG2.
-- `register_for_execution` and `register_for_llm` allow the tool to work with the UserProxyAgent and AssistantAgent.
+Integrate the CrewAI tool with AG2.
+- [`Interoperability`](/docs/reference/interop/interoperability) converts the CrewAI tool to a format compatible with AG2.
+- [ScrapeWebsiteTool](https://docs.crewai.com/tools/scrapewebsitetool) is used for web scraping tasks.
+- Register the tool for both execution and interaction with LLMs.
```python
interop = Interoperability()
@@ -200,13 +217,17 @@ ag2_tool = interop.convert_tool(tool=crewai_tool, type="crewai")
ag2_tool.register_for_execution(user_proxy)
ag2_tool.register_for_llm(chatbot)
+```
+### Initiating the chat
+Initiate the conversation between the [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent) and the [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) to utilize the CrewAI tool.
+```python
message = "Scrape the website https://ag2.ai/"
-
chat_result = user_proxy.initiate_chat(recipient=chatbot, message=message, max_turns=2)
```
-Output:
+### Output
+The `chatbot` provides results based on the web scraping operation:
```console
User (to chatbot):
@@ -262,12 +283,12 @@ This comprehensive platform seems to aim at both individual developers and enter
--------------------------------------------------------------------------------
```
+You can also access a detailed summary of the interaction:
+
```python
print(chat_result.summary)
```
-Output:
-
```console
The website "https://ag2.ai/" promotes a platform named AgentOS, which is designed for building multi-agent systems efficiently. Key highlights from the website are:
@@ -294,10 +315,10 @@ This comprehensive platform seems to aim at both individual developers and enter
## PydanticAI Tools Integration
-[PydanticAI](https://ai.pydantic.dev/) is a newer framework that offers powerful capabilities for working with LLMs. Although it currently does not have a repository with pre-built tools, it provides features like **dependency injection**, allowing you to inject a "Context" into a tool for better execution without relying on LLMs. This context can be used for passing parameters or managing state during the execution of a tool. While the framework is still growing, you can integrate its tools into AG2 to enhance agent capabilities, especially for tasks that involve structured data and context-driven logic.
+[PydanticAI](https://ai.pydantic.dev/) is a newer framework that brings powerful features for working with LLMs. Although it doesn't yet have a collection of pre-built tools like other frameworks, it offers useful capabilities such as **dependency injection**. This feature allows you to inject a "Context" into tools, which can help pass parameters or manage state without relying on LLMs. Though it's still evolving, you can easily integrate PydanticAI tools into AG2 to boost agent capabilities, particularly for tasks that involve structured data and context-driven logic.
### Installation
-To integrate LangChain tools into the AG2 framework, install the required dependencies:
+To get PydanticAI tools working with AG2, install the necessary dependencies:
```bash
pip install ag2[interop-pydantic-ai]
@@ -307,11 +328,11 @@ pip install ag2[interop-pydantic-ai]
### Imports
Import necessary modules and tools.
-- `BaseModel`: Used to define data structures for tool inputs and outputs.
-- `RunContext`: Provides context during the execution of tools.
-- `PydanticAITool`: Represents a tool in the PydanticAI framework.
-- `AssistantAgent` and `UserProxyAgent`: Agents that facilitate communication in the AG2 framework.
-- `Interoperability`: This module acts as a bridge, making it easier to integrate PydanticAI tools with AG2’s architecture.
+- [BaseModel](https://docs.pydantic.dev/latest/api/base_model/): Used to define data structures for tool inputs and outputs.
+- [RunContext](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.RunContext): Provides context during the execution of tools.
+- [PydanticAITool](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.Tool): Represents a tool in the PydanticAI framework.
+- [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) and [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent): Agents that facilitate communication in the AG2 framework.
+- [`Interoperability`](/docs/reference/interop/interoperability): This module acts as a bridge, making it easier to integrate PydanticAI tools with AG2’s architecture.
```python
import os
@@ -329,8 +350,8 @@ from autogen.interop import Interoperability
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 to `NEVER`).
-- `AssistantAgent` represents the AI agent, configured with the LLM settings.
+- [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent) simulates user inputs without requiring actual human interaction (set to `NEVER`).
+- [`AssistantAgent`](/docs/reference/agentchat/assistant_agent) represents the AI agent, configured with the LLM settings.
```python
config_list = [{"model": "gpt-4o", "api_key": os.environ["OPENAI_API_KEY"]}]
@@ -347,14 +368,13 @@ chatbot = AssistantAgent(
### Tool Integration
-Integrate the PydanticAI tool with AG2.
+To integrate a PydanticAI tool into AG2:
-- Define a `Player` model using `BaseModel` to structure the input data.
-- Use `RunContext` to securely inject dependencies (like the `Player` instance) into the tool function without exposing them to the LLM.
-- Implement `get_player` to define the tool's functionality, accessing `ctx.deps` for injected data.
-- Convert the tool to an AG2-compatible format with `Interoperability` and register it for execution and LLM communication.
-- Convert the PydanticAI tool into an AG2-compatible format using `convert_tool`.
-- Register the tool for both execution and communication with the LLM by associating it with the `user_proxy` and `chatbot`.
+- First, define a `Player` model using [BaseModel](https://docs.pydantic.dev/latest/api/base_model/) to structure the input data.
+- Use [RunContext](https://ai.pydantic.dev/api/tools/#pydantic_ai.tools.RunContext) to inject dependencies (like the `Player` instance) securely into the tool.
+- The `get_player` function defines the tool’s functionality, retrieving injected data through `ctx.deps`.
+- Then, convert the tool into an AG2-compatible format with [`Interoperability`](/docs/reference/interop/interoperability).
+- Register the tool for execution and interaction with both the `user_proxy` and `chatbot`.
```python
class Player(BaseModel):
@@ -382,11 +402,12 @@ ag2_tool.register_for_execution(user_proxy)
ag2_tool.register_for_llm(chatbot)
```
-Initiate a conversation between the `UserProxyAgent` and the `AssistantAgent`.
+### Initiating the chat
+Now that everything is set up, you can initiate a chat between the [`UserProxyAgent`](/docs/reference/agentchat/user_proxy_agent) and the [`AssistantAgent`](/docs/reference/agentchat/assistant_agent):
-- Use the `initiate_chat` method to send a message from the `user_proxy` to the `chatbot`.
-- In this example, the user requests the chatbot to retrieve player information, providing "goal keeper" as additional context.
-- The `Player` instance is securely injected into the tool using `RunContext`, ensuring the chatbot can retrieve and use this data during the interaction.
+- The `user_proxy` sends a message to the `chatbot`.
+- The user requests player information, and includes "goal keeper" as additional context.
+- The `Player` data is securely injected into the tool, and the chatbot can access and use it during the chat.
```python
user_proxy.initiate_chat(
@@ -394,7 +415,7 @@ user_proxy.initiate_chat(
)
```
-Output:
+### Output
```console
User (to chatbot):
@@ -423,3 +444,15 @@ chatbot (to User):
The player's name is Luka, who is a 25-year-old goalkeeper. TERMINATE
```
+
+## Summary
+
+In this post, we've explored how to integrate tools from multiple frameworks (LangChain, CrewAI, and PydanticAI) into the AG2 framework, enabling cross-framework interoperability. By integrating these tools, you can enhance your agents with a variety of capabilities, such as API querying, web scraping, and structured data processing.
+
+- **LangChain** offers a wide range of pre-built tools for working with APIs and web scraping, making it easy to extend AG2's functionality.
+- **CrewAI** brings diverse tools for search, web scraping, and more, allowing for robust agent interactions.
+- **PydanticAI** introduces dependency injection and context-driven logic, enabling efficient data handling without relying on LLMs.
+
+With AG2's flexible architecture and the power of these frameworks, developers can create agents that are more capable and adaptable. By following the integration steps for each framework, you can enhance your agents' performance, expand their capabilities, and create more dynamic interactions.
+
+Now you should have a better understanding of how to integrate tools from different frameworks into AG2, and how to use these tools effectively within your own projects.
diff --git a/website/mint.json b/website/mint.json
index f1ff688628..39b665c2cb 100644
--- a/website/mint.json
+++ b/website/mint.json
@@ -418,6 +418,7 @@
{
"group": "tools",
"pages": [
+ "docs/reference/tools/pydantic_ai_tool",
"docs/reference/tools/tool"
]
},
@@ -497,6 +498,7 @@
"blog/2024-12-20-RealtimeAgent/index",
"blog/2024-12-20-Tools-interoperability/index",
"blog/2024-12-20-Reasoning-Update/index",
+ "blog/2024-12-18-Tools-interoperability/index",
"blog/2024-12-06-FalkorDB-Structured/index",
"blog/2024-12-02-ReasoningAgent2/index",
"blog/2024-11-27-Prompt-Leakage-Probing/index",
@@ -619,6 +621,7 @@
"notebooks/agentchat_RetrieveChat",
"notebooks/agentchat_graph_rag_neo4j",
"notebooks/agentchat_swarm_enhanced",
+ "notebooks/tools_interoperability",
"notebooks/agentchat_realtime_swarm",
"notebooks/agentchat_reasoning_agent"
]
diff --git a/website/snippets/data/NotebooksMetadata.mdx b/website/snippets/data/NotebooksMetadata.mdx
index 51783730a4..ed1a504298 100644
--- a/website/snippets/data/NotebooksMetadata.mdx
+++ b/website/snippets/data/NotebooksMetadata.mdx
@@ -1004,6 +1004,14 @@ export const notebooksMetadata = [
"tags": [],
"source": "/website/docs/topics/non-openai-models/cloud-cerebras.ipynb"
},
+ {
+ "title": "Cross-Framework LLM Tool Integration with AG2",
+ "link": "/notebooks/tools_interoperability",
+ "description": "",
+ "image": null,
+ "tags": [],
+ "source": "/notebook/tools_interoperability.ipynb"
+ },
{
"title": "RealtimeAgent in a Swarm Orchestration",
"link": "/notebooks/agentchat_realtime_swarm",