MCPInstall
Multi-Agents-With-MCP-and-A2A logo

Multi-Agents-With-MCP-and-A2A

by vuniem131104 1 stars vuniem131104/Multi-Agents-With-MCP-and-A2A

A travel planning system using A2A and MCP for flight and hotel recommendations.

READMEmaster

Flight Recommendation System

A comprehensive travel planning system that combines A2A (Agent-to-Agent) communication with MCP (Model Context Protocol) to provide intelligent flight search, hotel recommendations, and itinerary generation services.

Demo Architecture

🎥 Demo Video

https://github.com/user-attachments/assets/d2d0b306-f414-4190-9044-b0609ab95c96

🌟 Features

  • 🛫 Flight Search Agent: Powered by Google ADK (Agent Development Kit)
  • 🏨 Hotel Search Agent: Built with LangGraph for intelligent hotel recommendations
  • 📋 Itinerary Generation Agent: Uses CrewAI for comprehensive travel planning
  • 🔄 Agent-to-Agent Communication: Seamless multi-agent collaboration
  • 🌐 Web Interface: Modern UI for easy interaction
  • 🔌 MCP Integration: Model Context Protocol for enhanced agent communication

🏗️ Architecture

This project demonstrates the integration of multiple AI frameworks:

  • A2A (Agent-to-Agent): Enables seamless communication between different specialized agents
  • MCP (Model Context Protocol): Provides standardized communication protocol for AI agents
  • Multi-Agent System: Three specialized agents working together to create comprehensive travel solutions

Agent Overview

AgentFrameworkPurpose
Flight SearchGoogle ADKFind and compare flight options
Hotel SearchLangGraphDiscover and recommend hotels
Itinerary GenerationCrewAICreate detailed travel itineraries

🚀 Quick Start

Prerequisites

  • Python 3.11+
  • uv (Python package manager)
  • Required API keys (see Configuration section)

Installation

  1. Clone the repository

    git clone https://github.com/YOUR_USERNAME/Flight-Recommendation.git
    cd Flight-Recommendation
    
  2. Install dependencies

    uv sync
    
  3. Set up environment variables

    cp .env.example .env
    # Edit .env with your API keys
    
  4. Run the demo UI

    cd demo/ui
    uv run python main.py
    

🔧 Configuration

Create a .env file in the project root with the following variables:

# Google ADK Configuration (for Flight Search Agent)
GOOGLE_ADK_API_KEY=your_google_adk_api_key

# SerpAPI Configuration (for Hotel Search Agent)
SERP_API_KEY=your_serpapi_key

# Groq Configuration (for LangGraph)
GROQ_API_KEY=your_groq_api_key

# CrewAI Configuration (for Itinerary Agent)
OPENAI_API_KEY=your_openai_api_key

# MCP Server Configuration
MCP_SERVER_HOST=localhost
MCP_SERVER_PORT=8000

📁 Project Structure

Flight-Recommendation/
├── demo/                           # Demo application and UI
│   ├── ui/                        # Web interface
│   └── a2a_demo_arch.png         # Architecture diagram
├── mcp_server/                    # MCP server implementation
│   └── server.py                  # Main MCP server
├── samples/python/                # Agent implementations
│   ├── agents/
│   │   ├── flight_search_agent/   # Google ADK-based flight search
│   │   ├── hotel_search_agent/    # LangGraph-based hotel search
│   │   └── itinerary_generation_agent/ # CrewAI-based itinerary
│   ├── common/                    # Shared utilities and types
│   └── hosts/                     # Agent hosting infrastructure
└── README.md                      # This file

🎯 Usage Examples

Flight Search

from samples.python.agents.flight_search_agent import FlightSearchAgent

agent = FlightSearchAgent()
flights = agent.search_flights(
    origin="NYC",
    destination="LAX",
    departure_date="2024-06-15",
    return_date="2024-06-22"
)

Hotel Search

from samples.python.agents.hotel_search_agent import HotelSearchAgent

agent = HotelSearchAgent()
hotels = agent.search_hotels(
    location="Los Angeles",
    check_in_date="2024-06-15",
    check_out_date="2024-06-22"
)

Itinerary Generation

from samples.python.agents.itinerary_generation_agent import ItineraryAgent

agent = ItineraryAgent()
itinerary = agent.generate_itinerary(
    destination="Los Angeles",
    duration=7,
    interests=["beaches", "entertainment", "dining"]
)

🔗 Agent Communication

The system uses A2A communication to enable agents to work together:

  1. Flight Search Agent finds available flights
  2. Hotel Search Agent recommends accommodations based on flight details
  3. Itinerary Generation Agent creates a comprehensive travel plan using both flight and hotel information

🛠️ Development

Running Individual Agents

# Flight Search Agent
cd samples/python/agents/flight_search_agent
uv run python agent.py

# Hotel Search Agent
cd samples/python/agents/hotel_search_agent
uv run python agent.py

# Itinerary Generation Agent
cd samples/python/agents/itinerary_generation_agent
uv run python agent.py

Running the MCP Server

cd mcp_server
uv run python server.py

Testing

# Run all tests
uv run pytest

# Run specific test suite
uv run pytest demo/ui/tests/

📚 Documentation

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔮 Future Enhancements

  • Real-time price monitoring
  • Weather integration for travel planning
  • Multi-language support
  • Mobile application
  • Advanced analytics and reporting
  • Integration with more travel APIs

🙏 Acknowledgments

  • Google ADK team for the flight search capabilities
  • LangGraph community for the hotel search framework
  • CrewAI developers for the itinerary generation tools
  • MCP protocol contributors for standardized agent communication

📞 Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Join our community discussions

Made with ❤️ by [Your Name]