Skip to content

karim1007/Multi-Agent-Learning-Assistant-

Repository files navigation

πŸ€– Multi-Agent Learning Assistant

A powerful AI-driven multi-agent system that intelligently routes user requests to specialized agents for WhatsApp management, calendar scheduling, and personalized learning path generation.

πŸ“‹ Overview

This project implements an intelligent chatbot system that uses intent detection to automatically route user requests to the appropriate specialized agent. Built with LangChain, LangGraph, and Gradio, it provides a seamless conversational interface for managing multiple aspects of your digital life.

✨ Key Features

  • 🎯 Intelligent Intent Detection: Automatically classifies user requests and routes them to the appropriate agent
  • πŸ’¬ Conversational Memory: Maintains context across conversations with automatic message summarization
  • πŸ”„ Multi-Agent Architecture: Specialized agents work together to handle diverse tasks
  • 🎨 User-Friendly Interface: Clean Gradio web interface for easy interaction
  • πŸ“Š LangSmith Integration: Built-in tracing for monitoring and debugging

πŸ€– Agents & Use Cases

1. πŸ“± WhatsApp Agent

Purpose: Manage WhatsApp communications and contacts through natural language commands.

Capabilities:

  • List all WhatsApp chats with details (chat ID, last message, sender info)
  • Send messages to specific contacts or groups
  • Retrieve chat and contact details
  • Create and manage WhatsApp groups
  • Add, update, and remove contacts
  • Check contact online status and last seen time

Use Cases:

βœ… "Send a message to John saying I'll be late"
βœ… "List all my recent WhatsApp chats"
βœ… "Create a group called 'Project Team' with Alice and Bob"
βœ… "What was the last message in my chat with Sarah?"
βœ… "Check if Mike is online"

Technology: Built with Model Context Protocol (MCP) for WhatsApp integration, using LangGraph's ReAct agent pattern.


2. πŸ“… Calendar Agent

Purpose: Manage Google Calendar events and schedules through conversational commands.

Capabilities:

  • Create calendar events with automatic meeting links
  • List upcoming events and schedules
  • Update and delete calendar events
  • Manage multiple calendars
  • Check free/busy time slots
  • Search for specific events
  • Automatic 1-hour duration for unspecified meetings
  • Smart time handling (assumes 1 hour from now if not specified)

Use Cases:

βœ… "Schedule a meeting with the marketing team tomorrow at 2 PM"
βœ… "What are my meetings for this week?"
βœ… "Create a reminder for my dentist appointment next Monday"
βœ… "Am I free on Friday afternoon?"
βœ… "Cancel my 3 PM meeting today"
βœ… "What's the meeting link for tomorrow's standup?"

Technology: Integrates with Google Calendar API via MCP, provides automatic meeting link generation.


3. πŸŽ“ Learning Planner Agent

Purpose: Generate personalized, structured learning roadmaps for any topic.

Capabilities:

  • Create detailed learning plans from beginner to advanced level
  • Provide weekly structured progression
  • Recommend curated resources (courses, books, tutorials)
  • Suggest practice projects and exercises
  • Estimate time requirements for each learning stage
  • Search for educational resources using Tavily API

Use Cases:

βœ… "I want to learn Python programming"
βœ… "Create a learning path for machine learning"
βœ… "Help me learn web development from scratch"
βœ… "I need a roadmap to become a data scientist"
βœ… "What should I learn to get started with AI?"

Output Format:

  • Topic overview and prerequisites
  • Week-by-week structured plan
  • Curated learning resources
  • Practice projects
  • Realistic time estimates
  • Clear progression path

Technology: Uses LangGraph ReAct agent with Tavily search integration for finding up-to-date learning resources.


4. πŸ’¬ General Inquiry Agent

Purpose: Handle casual conversations and provide friendly assistance.

Capabilities:

  • Engage in friendly conversation
  • Answer general questions
  • Guide users on available features
  • Provide system information

Use Cases:

βœ… "Hello! What can you help me with?"
βœ… "What features do you have?"
βœ… "How do I use this system?"
βœ… General chitchat and assistance requests

πŸ—οΈ System Architecture

User Input
    ↓
Intent Detection (LLM-powered)
    ↓
    β”œβ”€β†’ WhatsApp Agent (Async)
    β”œβ”€β†’ Calendar Agent (Async)
    β”œβ”€β†’ Learning Planner Agent (Sync)
    └─→ General Inquiry Agent
    ↓
Response to User

How It Works

  1. User Input: User submits a message through the Gradio interface
  2. Intent Classification: LLM analyzes the message and conversation history to determine intent
  3. Agent Routing: Request is routed to the appropriate specialized agent
  4. Agent Processing: The agent uses its tools and capabilities to fulfill the request
  5. Response Generation: Agent returns a comprehensive response to the user
  6. Memory Management: Conversation history is maintained and summarized when needed

πŸ› οΈ Technology Stack

  • LangChain: Framework for building LLM applications
  • LangGraph: For creating multi-agent workflows
  • Gradio: Web interface for user interaction
  • ChatTogether (Llama 3.3): Primary LLM for general tasks
  • ChatGroq: LLM for agent-specific tasks
  • Model Context Protocol (MCP): For WhatsApp and Calendar integrations
  • Tavily API: For searching educational resources
  • LangSmith: For tracing and monitoring
  • Python asyncio: For handling concurrent operations

πŸ“¦ Installation

Prerequisites

  • Python 3.8+
  • Node.js (for Google Calendar MCP server)
  • Google Calendar API credentials
  • WhatsApp MCP server setup
  • API keys for: Together AI, Groq, Tavily

Setup Steps

  1. Clone the repository:
git clone https://github.com/karim1007/Multi-Agent-Learning-Assistant-.git
cd Multi-Agent-Learning-Assistant-
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables: Create a .env file in the root directory:
TOGETHER_API_KEY=your_together_api_key
GROQ=your_groq_api_key
TAVILY_API_KEY=your_tavily_api_key
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REDIRECT_URI=your_redirect_uri
GOOGLE_REFRESH_TOKEN=your_refresh_token
  1. Set up MCP servers:
    • Configure WhatsApp MCP server path in whatsapp.py
    • Configure Google Calendar MCP server path in calendar_1.py

πŸš€ Usage

Running the Gradio Interface

python gradio_app.py

This launches a web interface at http://localhost:7860 where you can:

  • Chat with the assistant
  • Add contacts information (appended to first message)
  • Start new conversations

Running the CLI Interface

python app.py

This starts an interactive command-line chat session.

Example Interactions

WhatsApp Management:

User: Send a message to my team saying "Meeting at 3 PM"
Assistant: I've sent the message to your team group successfully!

Calendar Scheduling:

User: Schedule a meeting with John tomorrow at 10 AM
Assistant: I've created a 1-hour meeting with John for tomorrow at 10:00 AM. 
Here's the meeting link: [Google Meet link]

Learning Path Generation:

User: I want to learn machine learning
Assistant: I've created a comprehensive 12-week learning plan for machine learning...
[Detailed roadmap with resources and time estimates]

πŸ“ Project Structure

Multi-Agent-Learning-Assistant-/
β”œβ”€β”€ app.py                    # Main application with intent detection
β”œβ”€β”€ gradio_app.py            # Gradio web interface
β”œβ”€β”€ whatsapp.py              # WhatsApp agent implementation
β”œβ”€β”€ calendar_1.py            # Calendar agent implementation
β”œβ”€β”€ learning_planner.py      # Learning planner agent
β”œβ”€β”€ requirements.txt         # Python dependencies
β”œβ”€β”€ README.md               # This file
└── rag for interview/      # RAG system for interviews
    └── src/
        β”œβ”€β”€ rag_manager.py
        └── pdf_example.py

πŸ”§ Configuration

Message Memory Management

The system automatically manages conversation memory:

  • Maintains last 10 messages for active context
  • Summarizes older messages when history exceeds 25 messages
  • Ensures efficient token usage while preserving context

Agent Customization

Each agent can be customized by modifying their respective files:

  • whatsapp.py: WhatsApp agent prompts and tools
  • calendar_1.py: Calendar agent time handling and prompts
  • learning_planner.py: Learning plan structure and search queries

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

πŸ“„ License

This project is open-source and available under the MIT License.

πŸ™ Acknowledgments

  • Built with LangChain and LangGraph frameworks
  • Powered by Llama 3.3 (Together AI and Groq)
  • Uses Model Context Protocol for seamless integrations
  • Educational resources powered by Tavily search

πŸ“ž Support

For issues, questions, or suggestions, please open an issue on GitHub or contact the maintainer.


Made with ❀️ by karim1007

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published