Intelligent multi-platform product search agent powered by AI, LangChain, and MCP (Model Context Protocol)
An advanced AI-powered e-commerce search agent that simultaneously searches across multiple online platforms, providing intelligent product comparisons with structured results, price analysis, and smart recommendations.
- Multi-Platform Search: Simultaneously search across 11+ e-commerce platforms
- AI-Powered Intelligence: GPT-4o with ReAct agents for smart decision making
- Structured Responses: Organized results using Pydantic models with type validation
- Smart Analysis: Intelligent price comparison, rating analysis, and best deal detection
- Professional Web Interface: Modern Bootstrap-based responsive frontend
- Multiple MCP Providers: Support for BrightData, FireCrawl, and Tavily
| Platform | Region | Type | Availability |
|---|---|---|---|
| 🔸 Amazon | Global | General E-commerce | All versions |
| 🔸 eBay | Global | Marketplace | All versions |
| 🔸 Walmart | US | Retail Chain | All versions |
| 🔸 Best Buy | US | Electronics | BrightData/FireCrawl |
| 🔸 Target | US | Retail Chain | BrightData/FireCrawl |
| 🔸 Costco | US | Warehouse Club | BrightData/FireCrawl |
| 🔸 Newegg | Global | Technology | BrightData/FireCrawl |
| 🔸 MercadoLibre Colombia | LATAM | Marketplace | Tavily version |
| 🔸 Falabella | LATAM | Department Store | Tavily version |
| 🔸 Alibaba | Global | B2B | Tavily version |
| 🔸 AliExpress | Global | B2C Retail | Tavily version |
🐍 Python 3.13+ - Core language
🌐 Flask 3.1+ - Web framework
🧠 LangChain 0.3+ - AI framework
🤖 LangGraph 0.6+ - ReAct agents
🔗 MCP 1.13+ - Model Context Protocol
📊 Pydantic - Data validation
🎨 Bootstrap 5 - Frontend styling
⚡ OpenAI GPT-4o - Language model
Ecommerce_AI_Agent/
├── 📄 app.py # Version 1: BrightData MCP (Production-ready)
├── 📄 app_firecrawl.py # Version 2: FireCrawl MCP (Content extraction)
├── 📄 app_tavily.py # Version 3: Tavily MCP (Most advanced) ⭐
├── 📁 templates/
│ ├── base.html # Base template with Bootstrap
│ └── index.html # Main interface with smart dashboard
├── 📁 static/
│ └── style.css # Custom styling
├── ⚙️ .env # Environment variables (create this)
├── 📋 pyproject.toml # Python dependencies
├── 📖 CLAUDE.md # Claude Code integration docs
├── 📚 README.md # This file
└── 🔐 requirements.txt # Alternative dependency format
- Python 3.13+
- Node.js 16+ (for MCP servers)
- API Keys (OpenAI + chosen provider)
git clone https://github.com/yourusername/ecommerce-ai-agent.git
cd ecommerce-ai-agent
# Using uv (recommended)
uv sync
# Or using pip
pip install -r requirements.txtCreate a .env file:
# Core - Required for all versions
OPENAI_API_KEY=your-openai-api-key-here
# Version 1: BrightData (app.py)
WEB_UNLOCKER_ZONE=your-zone
BROWSER_AUTH=your-browser-auth
API_TOKEN=your-api-token
# Version 2: FireCrawl (app_firecrawl.py)
FIRECRAWL_API_KEY=your-firecrawl-api-key
# Version 3: Tavily (app_tavily.py) ⭐ Recommended
TAVILY_API_KEY=your-tavily-api-key# For Tavily version (recommended)
npm install -g tavily-mcp@latest
# For BrightData version
npm install -g @brightdata/mcp
# For FireCrawl version
npm install -g firecrawl-mcp# Recommended version (Advanced features + International platforms)
python app_tavily.py
# Alternative versions
python app.py # BrightData (Most reliable)
python app_firecrawl.py # FireCrawl (Clean extraction)Visit: http://localhost:8000
- 📝 Enter Search Query: "iPhone 15 Pro", "Samsung Galaxy S24", "wireless headphones"
- 🎯 Select Platforms: Choose from available e-commerce sites
- 🚀 Execute Search: AI agent searches and structures results
- 📊 View Results: Organized by platform with smart analysis
{
"platforms": [
{
"platform": "Amazon",
"results": [
{
"title": "Samsung Galaxy Buds2 Pro Wireless Earbuds",
"url": "https://amazon.com/dp/B0B4RJP5J1",
"rating": "4.3 out of 5 stars (15,240 reviews)",
"price": "$149.99"
}
]
}
],
"summary": {
"total_products": 42,
"platforms_count": 8,
"price_range": "$24.99 - $299.99",
"best_deal": {...},
"top_rated": {...}
}
}| Feature | BrightDataapp.py |
FireCrawlapp_firecrawl.py |
Tavilyapp_tavily.py ⭐ |
|---|---|---|---|
| Platforms | 7 | 7 | 11 |
| Reliability | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ |
| International | ❌ | ❌ | ✅ |
| Price Analysis | ❌ | ❌ | ✅ |
| Smart Dashboard | ❌ | ❌ | ✅ |
| Error Handling | Basic | Basic | Advanced |
| Prompt Engineering | Simple | Hardcoded | Advanced |
| Best For | Production | Clean Data | Development |
graph TD
A[🔍 User Query] --> B[🌐 Flask App]
B --> C[🔗 MCP Client]
C --> D[🧰 Load LangChain Tools]
D --> E[🤖 ReAct Agent Processing]
E --> F[📊 Multi-Platform Search]
F --> G[✅ Structured Response]
G --> H[🎨 Web Template Rendering]
style A fill:#e1f5fe
style E fill:#f3e5f5
style G fill:#e8f5e8
- 🌐 Flask Application: Web server with async MCP integration
- 🔗 MCP Client: Bridge to external scraping tools via stdio
- 🧠 LangChain Integration: Loads MCP tools into LangChain ecosystem
- 🤖 LangGraph Agent: ReAct pattern for intelligent decision making
- 📊 Pydantic Models: Type-safe response structuring and validation
- 🎨 Jinja2 Templates: Dynamic HTML rendering with Bootstrap styling
# Add your own MCP server
server_params = StdioServerParameters(
command='your-custom-mcp-server',
args=['--config', 'config.json'],
env={'API_KEY': os.getenv('YOUR_API_KEY')}
)# Add new platforms to PLATFORMS list
PLATFORMS = ['Amazon', 'eBay', 'YourPlatform']
# Update system prompt for new platform
SYSTEM_PROMPT += "For YourPlatform: use specific extraction logic..."❌ MCP Server Not Found
# Verify MCP server installation
npm list -g tavily-mcp
npm install -g tavily-mcp@latest❌ API Key Errors
# Check environment variables
echo $OPENAI_API_KEY
echo $TAVILY_API_KEY❌ Node.js Issues
# Update Node.js to latest LTS
nvm install --lts
nvm use --lts# Enable debug logging
import logging
logging.basicConfig(level=logging.DEBUG)We welcome contributions! Here's how to get started:
# Fork and clone
git clone https://github.com/yourusername/ecommerce-ai-agent.git
cd ecommerce-ai-agent
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install development dependencies
uv sync --dev- 🍴 Fork the repository
- 🌿 Create feature branch (
git checkout -b feature/amazing-feature) - ✅ Test your changes thoroughly
- 📝 Commit with clear messages (
git commit -m 'Add: amazing feature') - 📤 Push to branch (
git push origin feature/amazing-feature) - 🔄 Open a Pull Request
- ✅ Type hints for all functions
- 📚 Docstrings for public methods
- 🧪 Unit tests for new features
- 🎨 Black formatting (
black .) - 🔍 Linting with ruff (
ruff check .)
- 🔒 User Authentication: Save searches and preferences
- 💾 Database Integration: Store search history
- 📱 Mobile App: React Native companion
- 🌍 More Platforms: Add 20+ international platforms
- 📈 Analytics Dashboard: Search trends and insights
- 🔔 Price Alerts: Notify when prices drop
- 🤖 Advanced AI: GPT-4 Vision for product images
- 💰 Price Prediction: ML models for price forecasting
- 🛒 Shopping Lists: Collaborative shopping features
- 📊 Business Intelligence: Enterprise analytics suite
| Metric | Target | Current |
|---|---|---|
| Response Time | < 10s | ~8s |
| Platforms Searched | 15+ | 11 |
| Success Rate | > 95% | ~92% |
| Concurrent Users | 100+ | 50 |
- ✅ No Data Storage: Search queries are not logged
- ✅ Secure API Keys: Environment variable protection
- ✅ HTTPS Ready: SSL/TLS support for production
- ✅ Rate Limiting: Built-in request throttling
- ✅ Input Sanitization: XSS and injection prevention
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License - Feel free to use, modify, and distribute!
Edwin Quintero
- 🐙 GitHub: @edwinquintero
- 💼 LinkedIn: Edwin Quintero
- 📧 Email: edwin@example.com
- 🌐 Website: edwinquintero.dev
Special thanks to these amazing projects and services:
- 🦜 LangChain - AI framework foundation
- 🧠 OpenAI - GPT-4o language model
- 🔍 Tavily - Web search API
- 🌐 BrightData - Enterprise web scraping
- 🔥 FireCrawl - Clean web extraction
- 🐍 Flask - Web framework
- 🎨 Bootstrap - UI framework