A comprehensive AI-powered system combining autonomous e-commerce arbitrage (AutoBazaaar) with intelligent email automation (AgentMail) to discover deals, negotiate purchases, manage listings, and handle customer communications 24/7.
AutoBazaaar discovers profitable opportunities across marketplaces, negotiates deals, manages inventory, and lists products across platforms - all automated with AI agents.
AgentMail Integration handles all email communications: buyer inquiries, negotiation threads, and customer support using GPT-4o-mini analysis and response generation.
E-Commerce Automation:
- 🔍 Multi-platform opportunity discovery (Craigslist, Facebook Marketplace, eBay)
- 💰 AI-powered deal analysis and profit calculation
- 🤝 Autonomous negotiation with multiple strategies
- 📦 Inventory management and tracking
- 📋 Multi-platform listing creation
- 📊 Real-time metrics and analytics
Email Automation:
- 📧 24/7 email monitoring via AgentMail
- 🤖 GPT-4o-mini analysis (intent, sentiment, urgency)
- 💬 Context-aware automated responses
- 🔄 Real-time activity tracking
- 📈 Queue management with Convex database
- Node.js 20+
- npm 9+
- API Keys:
- Required: OpenAI, Convex, AgentMail
- Optional: Browser-Use, Hyperspell, Perplexity, Composio, Redis
# 1. Clone and install
git clone <repository-url>
cd AgentMail
npm install
# 2. Configure environment
cp .env.example .env
# Edit .env with your API keys
# 3. Setup Convex database
npx convex login
npx convex dev --once
# Copy deployment URL to .env
# 4. Start the system
# Terminal 1: Email orchestrator
npm run orchestrator
# Terminal 2: Backend server (optional - for AutoBazaaar features)
npm run server
# Terminal 3: Dashboard UI
npm run dev┌──────────────────────────────────────────────────────┐
│ AutoBazaaar System │
├──────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────┐ │
│ │ Agents │ │ Integrations │ │ Services │ │
│ ├─────────────┤ ├──────────────┤ ├────────────┤ │
│ │• Market │ │• Browser-Use │ │• EventBus │ │
│ │ Research │ │• Hyperspell │ │• Queue Mgr │ │
│ │• Deal │ │• Perplexity │ │• Metrics │ │
│ │ Analyzer │ │• Composio │ │• Security │ │
│ │• Negotiator │ │• OpenAI │ │ │ │
│ │• Listing │ │ │ │ │ │
│ └─────────────┘ └──────────────┘ └────────────┘ │
│ │
└──────────────────────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ AgentMail Email Automation │
├──────────────────────────────────────────────────────┤
│ │
│ ┌──────────┐ ┌─────────────┐ ┌────────────┐ │
│ │AgentMail │───►│EmailService │──►│EmailProc │ │
│ │ SDK │ │ (Queue) │ │(AI Analyze)│ │
│ └──────────┘ └──────┬──────┘ └────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ Convex │ │
│ │ Database │ │
│ └──────┬──────┘ │
│ │ │
│ ▼ │
│ ┌─────────────┐ │
│ │ Dashboard │ │
│ │ (Next.js) │ │
│ └─────────────┘ │
│ │
└──────────────────────────────────────────────────────┘
# Core Services
OPENAI_API_KEY=sk-proj-your_key_here
OPENAI_MODEL=gpt-4o-mini
# Database
CONVEX_URL=https://your-deployment.convex.cloud
NEXT_PUBLIC_CONVEX_URL=https://your-deployment.convex.cloud
# AgentMail Email Automation
AGENTMAIL_API_KEY=am_your_key_here
AUTO_RESPOND=true
EMAIL_POLL_INTERVAL=30# AutoBazaaar Integrations
BROWSER_USE_API_KEY=your_key_here # Web scraping
HYPERSPELL_API_KEY=your_key_here # Memory system
PERPLEXITY_API_KEY=your_key_here # Market research
COMPOSIO_API_KEY=your_key_here # Marketplace APIs
# Infrastructure
REDIS_HOST=localhost # For queues
REDIS_PORT=6379See .env.example for complete configuration.
Located in src/agents/:
- MarketResearchAgent - Discovers opportunities across platforms
- DealAnalyzerAgent - Analyzes profit potential and risk
- NegotiationAgent - Handles buyer/seller negotiations
- ListingAgent - Creates and manages multi-platform listings
- EmailTemplateEngine - Generates contextual email content
- ResponseAnalyzer - Analyzes buyer responses
Located in src/services/:
- AgentMailClient - Official AgentMail SDK wrapper
- EmailService - Queue management, polling, sending
- EmailProcessor - AI analysis pipeline
- ResponseGenerator - GPT-4o-mini response generation
- NewEmailOrchestrator - System coordinator
AutoBazaaar Tables (11 tables):
opportunities- Discovered deals with analysisnegotiations- Negotiation threads and roundsinventory- Purchased itemslistings- Active platform listingstransactions- Financial recordsconfig,memory,alerts,products,buyerProfiles,negotiationStates
AgentMail Tables (2 tables):
emailQueue- Email processing queue with statusemailActivity- Activity log for dashboard
See convex/schema.ts for complete schema.
# Start orchestrator (processes emails)
npm run orchestrator
# Or directly
npx tsx start-demo.tsThis starts:
- ✅ Email polling from AgentMail
- ✅ AI analysis of incoming emails
- ✅ Automated response generation
- ✅ Real-time dashboard updates
# Terminal 1: Backend services
npm run server
# Terminal 2: Email orchestrator
npm run orchestrator
# Terminal 3: Dashboard
npm run devThis enables:
- ✅ Market opportunity discovery
- ✅ Deal analysis and negotiation
- ✅ Listing management
- ✅ Email automation
- ✅ Full dashboard with all features
The dashboard includes a command interface for manual control:
scrape craigslist iphone
analyze deal <opportunity-id>
negotiate <thread-id> start
list product <inventory-id> ebay
Access at http://localhost:3000
- Total profit, revenue, deals completed
- Conversion rate, response time
- Active listings, emails processed
- Real-time email feed (received, analyzed, sent)
- Queue statistics (pending, processing, completed)
- AI analysis metadata (intent, sentiment, urgency)
- Manual command submission
- Command history tracking
- Real-time feedback
- Discovered opportunities
- Profit analysis
- Quick actions
- System-wide activity log
- Success/error tracking
- Financial history
- P&L tracking
AgentMail/
├── convex/ # Convex database
│ ├── schema.ts # All 13 tables
│ ├── emails.ts # Email queue functions
│ ├── listings.ts # Listing functions
│ └── commands.ts # Command functions
│
├── src/
│ ├── agents/ # AutoBazaaar AI agents
│ │ ├── MarketResearchAgent.ts
│ │ ├── DealAnalyzerAgent.ts
│ │ ├── NegotiationAgent.ts
│ │ └── ListingAgent.ts
│ │
│ ├── services/ # AgentMail services
│ │ ├── AgentMailClient.ts
│ │ ├── EmailService.ts
│ │ ├── EmailProcessor.ts
│ │ └── ResponseGenerator.ts
│ │
│ ├── integrations/ # External APIs
│ │ ├── BrowserUseIntegration.ts
│ │ ├── HyperspellIntegration.ts
│ │ ├── PerplexityIntegration.ts
│ │ └── ComposioIntegration.ts
│ │
│ ├── core/ # Infrastructure
│ │ ├── events/EventBus.ts
│ │ ├── queue/QueueManager.ts
│ │ ├── agents/AgentRegistry.ts
│ │ └── command/CommandExecutor.ts
│ │
│ ├── workflows/
│ │ └── NewEmailOrchestrator.ts # Email orchestration
│ │
│ ├── server/ # Backend API
│ │ ├── index.ts
│ │ └── websocket.ts
│ │
│ └── ui/ # Next.js dashboard
│ ├── pages/index.tsx
│ └── components/
│
├── start-demo.ts # Email orchestrator entry
├── AGENTMAIL_INTEGRATION.md # Email system docs
├── DEVELOPMENT.md # Development guide
├── PROJECT_STATUS.md # AutoBazaaar status
└── README.md
npm run dev # Start dashboard (localhost:3000)
npm run orchestrator # Start email processor
npm run server # Start backend API (AutoBazaaar)
npm run demo # Run demo scenario
npm run type-check # TypeScript checking
npm run lint # ESLint
npm run test # Jest testsnpm run orchestrator → AgentMail email automation only
npm run server → AutoBazaaar backend (EventBus, Redis, agents)
npm run dev → Dashboard UI (shows all features)
-
AGENTMAIL_INTEGRATION.md - Complete AgentMail guide
- Email processing pipeline
- API reference
- Troubleshooting
- Performance tips
-
DEVELOPMENT.md - Development workflow
- Setup instructions
- Code structure
- Testing guide
- Deployment
-
PROJECT_STATUS.md - AutoBazaaar status
- Implementation progress
- Known issues
- Configuration requirements
- ✅ API keys in environment variables only
- ✅ Self-email loop prevention
- ✅ Input validation and sanitization
- ✅ Rate limiting support
- ✅ Error handling with retry logic
- ✅ Webhook signature validation (optional)
docker-compose up -dIncludes:
- AutoBazaaar backend
- Redis
- Dashboard UI
See DEVELOPMENT.md for:
- PM2 process management
- Vercel deployment (UI only)
- Railway/Render deployment
- All API keys configured in .env
- Convex deployed (
npx convex deploy --prod) - Redis running (if using AutoBazaaar)
- Webhook URL configured (for instant email delivery)
- Environment set to production
- Monitoring configured (Sentry optional)
- Create feature branch
- Make changes
- Run
npm run type-checkandnpm run lint - Test thoroughly
- Create pull request
See DEVELOPMENT.md for detailed guidelines.
MIT License
Core:
- AgentMail - Email infrastructure & SDK
- Convex - Real-time serverless database
- OpenAI - GPT-4o-mini AI
- Next.js - Dashboard framework
Integrations (Optional):
- Browser-Use - Web automation
- Hyperspell - Memory system
- Perplexity - Market intelligence
- Composio - Marketplace APIs
Unlike separate tools, AutoBazaaar + AgentMail work together:
- Opportunities discovered → Email negotiations handled automatically
- Buyer inquiries → AI analyzes and responds with context
- Listings created → Customer emails managed 24/7
- Convex database shared across all processes
- Real-time sync between backend, orchestrator, and dashboard
- Persistent state survives restarts
- Scalable to multiple instances
- Error handling with retries
- Comprehensive logging
- Metrics and monitoring
- Docker support
- Complete documentation
Version: 3.0.0 (AutoBazaaar + AgentMail merged) Last Updated: 2025-01-11
Questions? See AGENTMAIL_INTEGRATION.md or DEVELOPMENT.md