🏠 ApartmentFinder人工智能代理
ApartmentFinder是一个智能多代理系统,旨在简化搬迁的混乱。用户无需在Zillow、谷歌地图和Reddit之间切换标签,只需与人工智能进行一次对话,即可找到公寓、计算实时公共交通通勤、检查社区安全,并提供精心策划的摘要。
问题
搬迁到一个新城市是压倒性的。用户通常必须:
- 在列表网站上搜索预算/设施。
- 将地址复制到谷歌地图中,以查看高峰时段的通勤时间。
- 搜索谷歌/Reddit,查看附近是否安全。
- 将所有这些编译成电子表格以做出决定。
这个过程是手动的、零碎的、耗时的。
解决方案
ApartmentFinder使用分层多代理架构自动化了整个流程。
“Manager”代理与用户交互,以了解他们的特定需求。一旦收集到需求,它就会部署一个专门的“研究团队”(一系列子代理)来执行搜索,使用谷歌地图MCP服务器验证通勤时间,并使用谷歌搜索验证安全性。
建筑
- 管理者(根代理)
- 角色:用户界面和验证器。
- 行为:它与用户进行循环对话,直到获得4个关键位置:城市、州、预算和地标。
- 交接:只有满足要求时,才会触发研究团队。
- 研究团队(顺序子代理)
一旦触发,该团队将执行线性装配线:
- 🕵️ 分析师代理人(工人)
- fetch_apartments 工具:查询本地Pandas DataFrame(模拟数据库)中的列表。 - check_commutes 工具:连接到本地Node.js MCP服务器,查询实时谷歌地图API的过境时间。
- 🛡️ 审核代理(审核官)
- 工具: google_search 谷歌搜索(ADK内置)。 - 行为:根据找到的特定地址动态搜索社区安全审查。
- 📝 摘要生成器代理(The Closer)
- 工具:无。 - 行为:将原始数据合成一个有说服力的、格式化的音调,帮助用户做出决定。
🛠️ 技术栈
- 框架:谷歌代理开发工具包(ADK)。
- LLM:双子座2.5闪光(通过顶点AI/AI工作室)。
- 数据层:Pandas(处理CSV库存)。
- 基础:谷歌搜索(原生ADK集成)。
安装说明
先决条件
- Python 3.10+
- Node.js v18+(谷歌地图MCP服务器需要)
- 启用了以下API的Google Cloud API密钥:
- 地理编码API - 地点API(新增) - 距离矩阵API - API指南
安装
- 克隆存储库:
git clone https://github.com/yourusername/apartment-finder-ai.git
cd apartment-finder-ai- 安装Python依赖项:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt- 安装MCP服务器:
此项目使用由提供的Google Maps MCP服务器 @模型上下文协议
npm init -y
npm install @modelcontextprotocol/server-google-maps zod- 配置环境:
在根目录中创建.env文件:
GOOGLE_API_KEY="your_gemini_api_key"
GOOGLE_MAPS_API_KEY="your_google_maps_api_key"用法
运行主应用程序脚本。Python代理将在后台自动启动Node.js MCP服务器。
python main.pyExample Interaction:
Agent: "Hello! I can help you relocation. Where are you moving?"
User: "I'm looking for a place in Austin, TX under $2500."
Agent: "Got it. Where will you be commuting to?"
User: "The Tesla Gigafactory."
Agent: (Thinking...) Delegates to Analyst -> Checks Maps -> Checks Reviews...
Agent: "I found a great option for you! The Riverside Lofts are $2,100/month. The commute is 15 mins via car, and reviews indicate the neighborhood is improving..."📂 项目结构
apartment-finder-ai/
├── apartment_finder/
│ ├── __init__.py # Entry point
│ ├── agent.py # Agent Definitions
│ ├── instructions.py # Agent Instruction Prompts
│ └── tools.py # Python Tools & MCP Wrapper Logic
├── data/
│ ├── apartments_cleaned.csv # Cleaned mock apartments database
│ └── apartments_for_rent_classified_100K.csv # Raw dataset (from Kaggle)
├── main.py # Entry point & Runner
├── package.json # Node dependencies (MCP)
├── preprocessing.py # Preprocessing Script for raw data
└── requirements.txt # Python dependencies