Installation
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.
Imports
Agent Configuration
TheGroupChat
will contain three agents:
sales_agent
- Responsible for selling tickets.cancellation_agent
- Handles ticket cancellations.user_proxy
- Acts as an intermediary between the user and other agents.
Tools Registration
In AG2, tool usage follows two steps:- An agent suggests a tool to use (via its LLM).
- Another agent executes the tool.
buy_airplane_ticket
: Suggested bysales_agent
and executed byuser_proxy
after user verification.cancel_airplane_ticket
: Suggested bycancellation_agent
and executed byuser_proxy
after user verification.
Creating and Initiating the Group Chat
Now, let’s create and start theGroupChat
with the three agents.