Skip to content

A sample exploring ergonomic, lightweight multi-agent orchestration in Python using Azure Cosmos DB with OpenAI Swarm

License

Notifications You must be signed in to change notification settings

AzureCosmosDB/multi-agent-swarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-agent AI sample with Azure Cosmos DB

A sample personal shopping AI Chatbot that can help with product enquiries, making sales, and refunding orders by transferring to different agents for those tasks.

Features:

  • Multi-agent: OpenAI Swarm to orchestrate multi-agent interactions with Azure OpenAI API calls.
  • Transactional data management: planet scale Azure Cosmos DB database service to store transactional user and product operational data.
  • Retrieval Augmented Generation (RAG): vector search in Azure Cosmos DB with powerful DiskANN index to serve product enquiries from the same database.
  • Gradio UI: Gradio to provide a simple UI ChatBot for the end-user.

Backend agent activity

Run the CLI interactive session to see the agent handoffs in action...

Demo

Front-end AI chat bot

Run the AI chat bot for the end-user experience...

Demo

Overview

The personal shopper example includes four main agents to handle various customer service requests:

  1. Triage Agent: Determines the type of request and transfers to the appropriate agent.
  2. Product Agent: Answers customer queries from the products container using Retrieval Augmented Generation (RAG).
  3. Refund Agent: Manages customer refunds, requiring both user ID and item ID to initiate a refund.
  4. Sales Agent: Handles actions related to placing orders, requiring both user ID and product ID to complete a purchase.

Prerequisites

Setup

Clone the repository:

git clone https://github.com/AzureCosmosDB/multi-agent-swarm
cd multi-agent-swarm

Install dependencies:

pip install git+https://github.com/openai/swarm.git
pip install azure-cosmos==4.9.0
pip install gradio

Ensure you have the following environment variables set:

AZURE_COSMOSDB_ENDPOINT=your_cosmosdb_account_uri
AZURE_COSMOSDB_KEY=your_cosmosdb_account_key
AZURE_OPENAI_API_KEY=your_azure_openai_api_key
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint
AZURE_OPENAI_EMBEDDINGDEPLOYMENTID=your_azure_openai_embeddingdeploymentid

Once you have installed dependencies, run below and click on url provided in output:

python3 src/app/ai_chat_bot.py

To see the agent handoffs, you can also run as an interactive Swarm CLI session using:

python3 src/app/multi_agent_service.py

About

A sample exploring ergonomic, lightweight multi-agent orchestration in Python using Azure Cosmos DB with OpenAI Swarm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages