Skip to content

deswalcodes/multiagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Multi-Agent AI System – Support & Analytics Agents

This project implements a multi-agent system using LangChain , where two agents serve distinct but complementary business roles:

  • 🎧 Support Agent: Handles client support, course/class info, and order/payment queries.
  • πŸ“Š Dashboard Agent: Provides analytics and insights for business decision-making.

Backend is powered by Flask, MongoDB, and LangChain; while the frontend is hosted via Streamlit.

🌐 Hosted Frontend

πŸ‘‰ Live Demo on Streamlit


πŸ”§ Features

πŸ‘©β€πŸ’Ό Support Agent

  • Get course/class info (by instructor, status, date)
  • Order/payment status by ID or client
  • Client info by name/email/phone
  • Create new client enquiries and orders
  • Multilingual query support (e.g. Hindi)

πŸ“ˆ Dashboard Agent

  • Revenue & outstanding dues
  • Top courses by enrollment
  • Attendance %, drop-off rates
  • Active vs inactive clients

🧠 Memory & Multilingual Support

  • Retains conversation history for follow-up queries
  • Translates non-English input (e.g., Hindi β†’ English) before execution

πŸ“ Folder Structure

MULTIAGENT-ASSIGNMENT/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ agents/
β”‚   β”‚   β”œβ”€β”€ dashboard_agent.py          # Analytics Agent
β”‚   β”‚   └── support_agent.py            # Support & Service Agent
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ schemas.py                  # MongoDB Schemas & Connection
β”‚   β”‚   └── seed_data.py                # Initial data for testing
β”‚   β”œβ”€β”€ tools/
β”‚   β”‚   β”œβ”€β”€ external_api.py             # Simulated client/order creation API
β”‚   β”‚   └── mongodb_tool.py             # CRUD & Aggregation Helpers
β”‚   β”œβ”€β”€ app.py                          # Main Flask app with API routes
β”œβ”€β”€ frontend.py                         # Optional Streamlit interface (hosted)
β”œβ”€β”€ requirements.txt                    # Python dependencies
β”œβ”€β”€ .env                                # Environment variables (Mongo URI, API keys)
β”œβ”€β”€ screenshots/
β”‚   β”œβ”€β”€ 1.png, 1.1.png                  # Example 1: Query + Logs
β”‚   β”œβ”€β”€ 2.png, 2.2.png                  # Example 2: Query + Logs
β”‚   β”œβ”€β”€ 3.png, 3.3.png                  # Example 3: Query + Logs
β”‚   β”œβ”€β”€ 4.png, 4.4.png                  # Example 4: Multilingual + Memory

πŸ–ΌοΈ Example Screenshots

πŸ”Ή Example 1: Query for classes this week

Query Terminal Logs Server Terminal
Query 1 Log 1.1

πŸ”Ή Example 2: Creating an Order

Query Terminal Logs Server Terminal
Query 2 Log 2.2

πŸ”Ή Example 3: Extracting Total Revenue

Query Terminal Logs Server Terminal
Query 3 Log 3.3

πŸ”Ή Example 4: Multilingual Query + Memory Recall

Query Terminal Logs Server Terminals
Multilingual + Memory Log 4.4

In Screenshot 4, the query was made in Hindi and automatically translated. The next query, "what did I ask earlier?", demonstrates memory recall capability.


πŸ›  Setup & Run Instructions

Follow these steps to set up and run the Multi-Agent AI backend + frontend on your local system.


1️⃣ Clone the Repository

git clone https://github.com/your-username/multiagent-assignment.git
cd multiagent-assignment

2️⃣ Install Python Dependencies

pip install -r requirements.txt

3️⃣ Set Up Environment Variables

Create a .env file in the root directory:

OPENAI_API_KEY=your_openai_key
MONGODB_URI=your_mongo_connection_uri

4️⃣ Seed the MongoDB Database

This step populates the database with mock data (courses, clients, payments, etc.).

cd backend/models
python seed_data.py

5️⃣ Start the Flask Server

cd ../../backend
python app.py

πŸ“‘ Available Endpoints

Endpoint Method Description
/support POST Send queries to the Support Agent
/dashboard POST Send queries to the Dashboard Agent

πŸ” Sample Request Format (JSON)

{
  "query": "What classes are available this week?"
}

🧠 Notes:

-Input should be a natural language query in the query field.

-Non-English queries are automatically translated to English using Google Translate.

-Responses are always returned in English.

-Memory is preserved per agent instance (useful for contextual follow-ups).

πŸš€ Key Features Recap

  • πŸ” Natural Language Querying over MongoDB collections
  • 🧠 Memory-enabled Agents for contextual follow-up
  • 🌍 Multilingual Input Support (via Google Translate)
  • πŸ”— External API Integration for simulating orders and client creation
  • πŸ“Š Business Analytics like revenue, attendance, and course trends
  • πŸ–ΌοΈ Visual frontend using Streamlit for live demos

🧰 Tech Stack

Layer Tools Used
Agent Logic LangChain, OpenAI GPT-4o
Backend Python, Flask
Database MongoDB
Agent Memory ConversationBufferMemory (LangChain)
Frontend Streamlit
Hosting Render (Flask backend), Streamlit Cloud

πŸ™Œ Credits

This project was built as part of a multi-agent backend system following modular LangChain-based architecture, designed to simulate real-world agent collaboration between support and analytics roles.

Developed by: Priyanshu Deswal

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors