fix : code updated
This commit is contained in:
parent
842b1740de
commit
293c35629f
3 changed files with 106 additions and 0 deletions
43
mcp_ai_agents/ai_travel_planner_mcp_agent_team/README.md
Normal file
43
mcp_ai_agents/ai_travel_planner_mcp_agent_team/README.md
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
# 🌍 AI Travel Planner — MCP Agent Team (Airbnb, Google Maps, Weather)
|
||||||
|
|
||||||
|
This project is a *multi-agent travel planning assistant* built using [Agno](https://github.com/agnodice/agno), powered by multiple [Model Context Protocol (MCP)](https://modelcontextprotocol.org/) tools. It integrates:
|
||||||
|
|
||||||
|
• 🏠 *Airbnb Listings*
|
||||||
|
• 🗺️ *Google Maps for routing and places*
|
||||||
|
• 🌦️ *Weather information via AccuWeather*
|
||||||
|
• 📅 (Optional) *Google Calendar integration via Gumloop MCP*
|
||||||
|
|
||||||
|
All handled through a simple terminal interface powered by Python + asyncio.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚙️ Requirements
|
||||||
|
|
||||||
|
• Python 3.10+
|
||||||
|
• Node.js + npx
|
||||||
|
• [uvx](https://github.com/uvx/cli) for running MCP servers from Git
|
||||||
|
• Internet access for MCP calls
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Installation
|
||||||
|
|
||||||
|
1. *Clone the repo*
|
||||||
|
|
||||||
|
bash
|
||||||
|
git clone https://github.com/yourusername/ai-travel-planner.git
|
||||||
|
cd ai-travel-planner
|
||||||
|
|
||||||
|
|
||||||
|
1. *Create Virtual Env*
|
||||||
|
|
||||||
|
conda create -n env_name python=3.10 -y
|
||||||
|
conda activate env_name
|
||||||
|
pip install -r requirements.txt
|
||||||
|
|
||||||
|
|
||||||
|
1. *Create env file*
|
||||||
|
|
||||||
|
GOOGLE_MAPS_API_KEY=your_google_maps_api_key
|
||||||
|
ACCUWEATHER_API_KEY=your_accuweather_api_key
|
||||||
|
OPENAI_API_KEY=your_openai_api_key
|
||||||
60
mcp_ai_agents/ai_travel_planner_mcp_agent_team/app.py
Normal file
60
mcp_ai_agents/ai_travel_planner_mcp_agent_team/app.py
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
import asyncio
|
||||||
|
import os
|
||||||
|
|
||||||
|
from agno.agent import Agent
|
||||||
|
from agno.tools.mcp import MultiMCPTools
|
||||||
|
import streamlit as st
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
async def run_agent(message: str) -> None:
|
||||||
|
"""Run the Airbnb, Google Maps, Weather agent with the given message."""
|
||||||
|
|
||||||
|
google_maps_key = os.getenv("GOOGLE_MAPS_API_KEY")
|
||||||
|
accuweather_key = os.getenv("ACCUWEATHER_API_KEY")
|
||||||
|
openai_key = os.getenv("OPENAI_API_KEY")
|
||||||
|
if not google_maps_key:
|
||||||
|
raise ValueError("🚨 Missing GOOGLE_MAPS_API_KEY in environment variables.")
|
||||||
|
elif not accuweather_key:
|
||||||
|
raise ValueError("🚨 Missing ACCUWEATHER_API_KEY in environment variables.")
|
||||||
|
elif not openai_key:
|
||||||
|
raise ValueError("🚨 Missing OPENAI_API_KEY in environment variables.")
|
||||||
|
env = {
|
||||||
|
**os.environ,
|
||||||
|
"GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY"),
|
||||||
|
"ACCUWEATHER_API_KEY": os.getenv("ACCUWEATHER_API_KEY"),
|
||||||
|
"OPENAI_API_KEY": os.getenv("OPENAI_API_KEY")
|
||||||
|
}
|
||||||
|
|
||||||
|
async with MultiMCPTools(
|
||||||
|
[
|
||||||
|
"npx -y @openbnb/mcp-server-airbnb --ignore-robots-txt", # ✅ Airbnb mcp added
|
||||||
|
"npx -y @modelcontextprotocol/server-google-maps", # ✅ Google Maps mcp added
|
||||||
|
"uvx --from git+https://github.com/adhikasp/mcp-weather.git mcp-weather", # ✅ Weather mcp added
|
||||||
|
# "https://www.gumloop.com/mcp/gcalendar",
|
||||||
|
|
||||||
|
],
|
||||||
|
env=env,
|
||||||
|
) as mcp_tools:
|
||||||
|
agent = Agent(
|
||||||
|
tools=[mcp_tools],
|
||||||
|
markdown=True,
|
||||||
|
show_tool_calls=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
await agent.aprint_response(message, stream=True)
|
||||||
|
|
||||||
|
# -------------------- Terminal Interaction Loop --------------------
|
||||||
|
|
||||||
|
if _name_ == "_main_": # type: ignore
|
||||||
|
print("🌍 Travel Planning Agent — Airbnb, Maps, Weather, Calendar (type 'exit' to quit)\n")
|
||||||
|
try:
|
||||||
|
while True:
|
||||||
|
user_input = input("You: ")
|
||||||
|
if user_input.lower() in ["exit", "quit"]:
|
||||||
|
print("👋 Bye!")
|
||||||
|
break
|
||||||
|
asyncio.run(run_agent(user_input))
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print("\n👋 Interrupted. Exiting...")
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
agno==1.2.13
|
||||||
|
mcp==1.6.0
|
||||||
|
streamlit==1.44.1
|
||||||
Loading…
Reference in a new issue