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