Cross-Framework LLM Tool Integration with AG2
Note: If you have been usingAdditionally, this notebook uses LangChain’s Wikipedia Tool, which requires theautogen
orag2
, all you need to do is upgrade it using:orasautogen
, andag2
are aliases for the same PyPI package.
wikipedia
package. Install it with:
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.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.Interoperability
: 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.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.
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.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.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.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.
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.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.Player
model using
BaseModel to
structure the input data.Player
instance) into
the tool function without exposing them to the LLM.get_player
to define the tool’s functionality, accessing
ctx.deps
for injected data.Interoperability
and register it for execution and LLM communication.convert_tool
.user_proxy
and chatbot
.UserProxyAgent
and the
AssistantAgent
.
initiate_chat
method to send a message from the
user_proxy
to the chatbot
.Player
instance is securely injected into the tool using
RunContext,
ensuring the chatbot can retrieve and use this data during the
interaction.