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. We will define two tools: -buy_airplane_ticket
: Suggested by
sales_agent
and executed by user_proxy
after user verification. -
cancel_airplane_ticket
: Suggested by cancellation_agent
and executed
by user_proxy
after user verification.
Creating and Initiating the Group Chat
Now, let’s create and start theGroupChat
with the three agents.