--- title: PersonaTrip Agent emoji: ✈️ colorFrom: indigo colorTo: purple sdk: gradio sdk_version: 5.33.0 python_version: '3.11' app_file: app.py app_port: 7860 pinned: false license: mit --- --- ### 🏆 **Hackathon Submission: Track 3 - Agentic Demo** This Gradio application is a submission for the **Agentic Demo Track**. It showcases a creative and powerful use of AI agents for personalized travel planning. **🎬 Video Overview:** **[➡️ Watch the Demo Video Here](https://youtu.be/1uNYlaqA9_A)** --- # ✈️🌍 PersonaTrip Agent - My Personalized Travel Planning & Community Insights AI Assistant! 🚀 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Hackathon](https://img.shields.io/badge/Hackathon-MCP%20Agent%20Challenge-blueviolet)](https://github.com/YOUR_HACKATHON_LINK) [![LLM](https://img.shields.io/badge/LLM-Claude%203.5%20Sonnet-orange)](https://www.anthropic.com/news/claude-3-5-sonnet) [![RAG Framework](https://img.shields.io/badge/RAG%20Framework-LlamaIndex-brightgreen)](https://www.llamaindex.ai/) [![UI Framework](https://img.shields.io/badge/UI%20Framework-Gradio-ff69b4)](https://www.gradio.app/) [![Image Service](https://img.shields.io/badge/Image%20Service-Cloudinary-blue)](https://cloudinary.com/) [![Powered by Hugging Face](https://img.shields.io/badge/Powered%20by-Hugging%20Face%20🤗-yellow)](https://huggingface.co/) [![Embedding Model](https://img.shields.io/badge/Embedding%20Model-BAAI/bge--small--en--v1.5-lightgrey)](https://huggingface.co/BAAI/bge-small-en-v1.5) > "The world is a book, and those who do not travel read only one page." — Augustine 📖 I have always believed in the meaning of travel and am committed to making every journey full of personality and surprises. In the cold and lonely Finland, travel sharing in the community makes people feel companionship and warmth, connecting people's memories and explorations. Last week, I launched my **[Travel Map Community Website](https://www.tripersona.online/)**, where community members can share their travel footprints. And now, I bring you **PersonaTrip Agent** — an intelligent travel assistant that not only plans personalized itineraries but also gains insights into travel trends from community data, injecting unprecedented intelligence and personalized experience into my Travel Map community! ✨ By integrating the powerful large language model (**Anthropic Claude 3.5 Sonnet**), **LlamaIndex** retrieval-augmented generation (**RAG**) framework, **Gradio** interactive interface, **Cloudinary** image service, and **Hugging Face**'s **BAAI/bge-small-en-v1.5** embedding model, combined with Model Context Protocol (**MCP**) driven toolset, I have created this system that can deeply understand user intent through multimodal text and visual methods, and generate intelligent travel suggestions and insights using Travel Map database. ## 🌟 Project Highlights - **Community Data Empowerment** 🔗: PersonaTrip Agent seamlessly connects with my Travel Map website database (MongoDB), all travel suggestions and insights come from real user travel records, ensuring high credibility and relevance. - **Data Value Reactivation** 💎: Transform static travel records into interactive intelligent services and knowledge graphs, injecting new vitality into community data. - **Personalized Itinerary Planning (Based on LlamaIndex RAG)** 💖: `personalized_travel_planner` uses **LlamaIndex RAG** to retrieve user historical travel content and preferences, combined with LLM to generate truly "made for you" customized itineraries. - **Community Trend Insights (Based on LlamaIndex RAG)** 📊: `travel_data_analyzer` can analyze entire community data, answering statistical questions like "Who is the most active traveler?" or "What are the most popular destinations?", providing data support for content recommendations and community interaction. - **Multimodal Intelligent Interactive Experience** 📸🖼️🧠: - **Image Recognition Landmarks**: After users upload travel photos, Agent uses **Claude 3.5 Sonnet**'s visual understanding capability to determine geographical locations in photos. - **Image-Driven Travel Record Retrieval**: Based on visual recognition results, automatically calls `fetch_trips_by_location` to retrieve corresponding location travel records from Travel Map community. - **Historical Visual Preferences Integration into Personalized Itineraries**: `enhanced_personalized_travel_planner` analyzes descriptions and scenes of user-uploaded images, extracts visual preferences, and integrates them into future itinerary recommendations for deeper "understanding". - **Model Context Protocol (MCP) Driven** 🛠️: - `enhanced_personalized_travel_planner`: Core RAG planning tool that can deeply analyze historical travel data and preferences of single or multiple users in Travel Map. Combined with current requests and optional real-time web intelligence, generates highly customized complete travel plans for individuals or teams. - `fetch_trips_by_location`: Quickly retrieve community travel records by location name. - `summarize_trip`: Summarize user's historical travel content to help with memory and sharing. - `travel_data_analyzer`: Build community-level index and conduct statistical analysis, supporting cross-user data queries. - `web_search`: Call Tavily API to get real-time information (weather, strikes, ticket availability, etc.) to assist dynamic planning. - **Future Integration into Travel Map Official Website** 🧩: This Hackathon's Gradio prototype will be directly integrated into my Travel Map website in the future, serving as a native chat assistant to continuously serve community users. ## 🗺️ Travel Map Collaborative Experience All data used by PersonaTrip Agent comes from my online Travel Map website. ![My Travel Map Website Screenshot](./assets/travel_map_screenshot.jpg) _Note: This shows my Travel Map website screenshot, displaying pin points or itinerary cards on the map._ ## 🚀 Main Feature Demonstrations ### 1. Plan Personalized New Journey (RAG + Optional Web Intelligence) 🗺️ Whether for in-depth customization for individuals or careful planning for multi-person teams, PersonaTrip Agent can handle it! **Scenario 1: Planning for Individual** User input: "Hi, I'm Tracy Shen, planning a 4-day trip to Rome in early September, flying Finnair. I'm passionate about ancient history and authentic local food and prefer a moderately paced itinerary with some free time." Agent will first call `web_search` to get real-time information about Rome in early September and Finnair, then pass this information along with user request to `enhanced_personalized_travel_planner`. This tool internally uses **LlamaIndex RAG** to analyze Tracy Shen's historical preferences and generate customized itinerary combining all information. ![Example of user requesting new itinerary planning](./assets/Planner_Output1.jpg) ![Agent-generated user profile summary section](./assets/Planner_Output2.jpg) ![Agent-generated daily itinerary plan section](./assets/Planner_Output3.jpg) **Scenario 2: Planning for Multi-person Team** User input: "Hello, please plan a 5-day trip to Iceland in September for Tracy Shen, Liu Shuhui, and Jialong Xu." Agent will also first call `web_search` to get real-time information about Iceland in September (weather, film festivals, safety advice, etc.). Then, it passes this information along with the team's joint request to `enhanced_personalized_travel_planner`. This tool will try to separately obtain (if available in database) historical preferences of Tracy Shen, Liu Shuhui, and Jialong Xu through **LlamaIndex RAG**, and strive to generate an Iceland itinerary that can balance diverse team interests and incorporate real-time intelligence. ![Iceland itinerary example for team planning 1](./assets/Planner_Output_Group_Iceland1.jpg) ![Iceland itinerary example for team planning 2](./assets/Planner_Output_Group_Iceland2.jpg) ### 2. Image Recognition ➡️ Travel Records 🖼️➡️📍 User uploads a Helsinki photo. Agent (Claude Vision) recognizes it, then prompts and can call `fetch_trips_by_location` to find relevant community records from Travel Map database. ![Agent recognizing Helsinki image and retrieving related itinerary records](./assets/ImageFetch_Output.jpg) ### 3. Community Travel Trend Insights (RAG) 📈❓ User: "Who is the most active global traveler in our community?" or "What are the most popular attractions everyone visits in Paris?" Agent calls `travel_data_analyzer`, which uses **LlamaIndex** indexed complete community data, combined with LLM analysis to provide answers. ![Agent analyzing community travel data and answering statistical questions](./assets/Analyzer_Output.jpg) ### 4. Review Specific Travel Memories 🔍 User: "Summarize my last trip to Helsinki." Agent calls `summarize_trip` (based on LLM) to provide summary. ![Agent summarizing user's past Japan itinerary example](./assets/Summarize_Output.jpg) ## 🛠️ Tech Stack - **Data Source**: **MongoDB** (My Travel Map website database) - **Large Language Model (LLM)**: **Anthropic Claude 3.5 Sonnet** (for core conversation logic, text content generation, powerful multimodal visual analysis and image understanding) - **Retrieval Augmented Generation (RAG)**: **LlamaIndex** - **Embedding Model**: Hugging Face **BAAI/bge-small-en-v1.5** (used through LlamaIndex) - **Tool Execution**: **MCP** (Model Context Protocol) - **Core Tools**: - `enhanced_personalized_travel_planner` (Python, LlamaIndex RAG, MongoDB, Claude) - `fetch_trips_by_location` (Python, MongoDB query) - `summarize_trip` (Python, Claude for summarization) - `travel_data_analyzer` (Python, LlamaIndex RAG, MongoDB, Claude) - `web_search` (Python, **Tavily Search API**) - **Image Processing and Storage**: **Cloudinary** (image upload and URL management), Base64 (API transmission) - **Backend**: **Python**, Anthropic SDK, MCP SDK, **Pymongo** - **Frontend and Interaction**: **Gradio** ## ⚙️ Local Setup Guide 1. **Clone my repository**: ```bash git clone [My repository HTTPS or SSH link] cd [My project directory name] ``` 2. **Create and activate virtual environment**: ```bash python -m venv .venv source .venv/bin/activate # Linux/macOS # .venv\Scripts\activate # Windows ``` 3. **Install dependencies**: This project uses `pyproject.toml` to define dependencies and recommends using `uv`, a fast Python package installer. If you haven't installed `uv` yet, please install it first (usually through `pip install uv` or refer to its official documentation). After activating the virtual environment, use the following command to install dependencies: ```bash uv pip sync ``` This command will read the `pyproject.toml` file and use `uv.lock` to quickly and consistently install all required packages to your virtual environment. 4. **Configure `.env` file**: Copy `.env.example` (if I provided one) to `.env` and fill in all necessary API keys and connection strings: ```env ANTHROPIC_API_KEY="sk-ant-..." TAVILY_API_KEY="tvly-..." # If using web_search CLOUDINARY_CLOUD_NAME="..." CLOUDINARY_API_KEY="..." CLOUDINARY_API_SECRET="..." MONGODB_URI="mongodb+srv://..." # My Travel Map database connection string ``` 5. **Build LlamaIndex index (first run or after data updates)**: `travel_data_analyzer_tool.py` and `enhanced_planner_tool.py` contain `initialize_analyzer_tool()` / RAG initialization logic that will try to build index on first use and persist it to `./travel_data_index` directory. Ensure this directory is writable. 6. **Start Gradio app + Connect MCP server**: ```bash python app.py ``` Open the provided local URL in browser. Click Connect in the user interface to connect to MCP server and start experiencing! ## 🔮 Future Plans: Building a Vibrant and Intelligent Travel Sharing and Planning Ecosystem! 🚀 My goal is not just to create an intelligent assistant, but to deeply integrate PersonaTrip Agent into my **Travel Map community website**, ultimately building a unique interactive platform focused on travel sharing and intelligent planning, making every journey more exciting and every share more valuable! - [x] **Agent Client Seamless Integration into Travel Map Website (Core Goal in Progress)** 🖼️➡️💻: Integrate PersonaTrip Agent as an intelligent chat assistant directly into Travel Map website, allowing users to get personalized suggestions, information queries, and new itinerary planning services anytime while browsing maps or others' itineraries. - [ ] **Intelligent Travel Inspiration Engine (Based on Map and Community Popularity)** 🧭✨: - When users explore different areas on Travel Map, Agent can proactively analyze popular itineraries, highly-rated food, hidden attractions shared by community members in that area, and combine with user's personalized preferences to intelligently recommend related travel inspiration and itinerary segments. - For example: "Hey, I noticed you're looking at Kyoto's Gion district. Several friends in our community who, like you, enjoy deep cultural experiences have shared great tea ceremony experiences and kimono walking routes. Want to see them?" - [ ] **One-click Generate and Share Beautiful Travel Journal/Travelogue (PDF/Web)** 📔✍️: - After users generate itineraries using `enhanced_personalized_travel_planner` or review past itineraries from `fetch_trips_by_location` / `summarize_trip`, they can **export this information (including itineraries, image descriptions, personal notes, etc.) with one click into beautifully designed travel journals or shareable web travelogues**. - Agent can assist in organizing and beautifying this content, making sharing easier and more attractive. - [ ] **Travel Map Community Interaction Upgrade (Instagram-like focused on travel)** ❤️💬🔖: - **Like, Save, Comment**: Users can like, save (for future travel inspiration), and comment on "travel record pins" or Agent-generated and shared "itinerary plans" shared by themselves or other community members on Travel Map, creating active community interaction. - **Follow and Updates**: Users can follow travelers they like and view their latest travel shares and itinerary plans. - **"Travel Personality" Badges and Display**: Based on Agent's analysis of user travel preferences, users can display unique "travel personality" badges or tags on their Travel Map personal homepage, adding social fun. - [ ] **Agent Intelligence Evolution Based on Community Feedback** 👍👎🧠: - Allow users to rate Agent-generated plans and provided insights (for example, through simple like/dislike or providing brief feedback). - This feedback will be used to continuously optimize **LlamaIndex RAG system's retrieval strategy, LLM's prompt engineering**, and the effectiveness of core tools like `enhanced_personalized_travel_planner` and `travel_data_analyzer`, making Agent increasingly understand community users' needs. - [ ] **Deepen Community Data Insights and Personalized Recommendations** 📊🎯: - The `travel_data_analyzer` tool will be further enhanced to answer more complex community trend questions, such as: "What are the most popular hidden European destinations for families with children in our community?" or "What types of restaurants are users who like visiting museums usually interested in?" - Based on these insights, Agent can provide users with more precise personalized content recommendations, such as proactively recommending relevant community popular itineraries or practical suggestions when users plan specific types of trips. - [ ] **Collaborative Travel Planning** 🤝🗺️: - Allow multiple Travel Map community users to jointly edit and refine a travel plan through PersonaTrip Agent, facilitating friends, family, or teams traveling together. My vision is to create a vertical travel community that can inspire travel, efficiently plan itineraries, and allow every precious experience to be wonderfully shared and connected through the deep integration of PersonaTrip Agent and Travel Map website. Here there is not only intelligence, but also warmth and real connections!