Customer Service - AG2

Customer Service

Tip

This is from AG2's Build with AG2 repository, find the source files and more use cases there!

Here's a robust and flexible order management system using a Swarm-based decentralized agent orchestration that you can build upon for your needs.

The system addresses two primary user needs: order tracking and order returns. The workflow considers the user’s login status during the initial interaction. Users can quickly track an order using a tracking number without logging in, while returns require authentication.

This system leverages modular agents for triaging, tracking, login management, order management, and returns, ensuring a seamless user experience.

How it works

Agents and Workflow

We initialize the context variables with two fields: user_info to store user information (and order list when a user logs in) and order_info to store the retrieved order information. Since swarm is a decentralized orchestration, we will transfer logic in each agent:

Installation

To set up the environment, run the following command:

pip install -r requirements.txt

The primary dependency is the ag2 library.

Running the code

First, set up the config_list in the main.py file (line 10). Read more about configurations here.

python main.py

The system will start running, and you can interact with it through the command line.

Example Interaction 1: Cancel orders

  1. I want to cancel my order
  2. TR14234
  3. .. Continue to interact with the system ..

Example Interaction 2: Track orders

  1. I want to track my order
  2. TR13845
  3. 8453 (last 4 digits of phone number)
  4. .. Continue to interact with the system ..