This AI Sales Agent is a comprehensive automation system built with Vercel AI SDK v5 that revolutionizes your sales process through intelligent lead generation, proposal writing, web scraping, and email automation.
- AI-Powered Lead Management - Extract, score, and enrich leads from any data source
- Upwork Job Analyzer - Analyze jobs and generate winning proposals with streaming AI
- Intelligent Web Scraper - Extract business contacts from websites using AI
- Email Automation System - Generate, personalize, and optimize email campaigns
- Multi-Provider AI Strategy - Smart model selection for cost optimization
AI Sales Agent
├── 🧠 AI Core (Vercel AI SDK v5)
│ ├── Multi-provider support (Claude, OpenAI, Groq)
│ ├── Streaming responses
│ ├── Structured data generation
│ └── Cost optimization
│
├── 📊 Feature Blocks
│ ├── /leads - Lead extraction & management
│ ├── /upwork - Job analysis & proposals
│ ├── /scraper - Web data extraction
│ └── /emails - Email automation
│
└── 🔧 Infrastructure
├── Next.js 15 with App Router
├── PostgreSQL with Prisma ORM
├── TypeScript for type safety
└── Tailwind CSS for UI
- Node.js 18+ installed
- PostgreSQL database
- AI API keys (at least one provider)
# Clone the repository
git clone [your-repo-url]
cd codebase-underway
# Install dependencies
pnpm install
# Copy environment variables
cp .env.local.example .env.localEdit .env.local with your API keys:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/dbname"
# Authentication
AUTH_SECRET="your-auth-secret-here"
NEXTAUTH_URL="http://localhost:3000"
# AI Providers (at least one required)
GROQ_API_KEY="gsk_..." # Recommended for cost-effective operations
ANTHROPIC_API_KEY="sk-ant-..." # For high-quality analysis
OPENAI_API_KEY="sk-..." # For general purpose
# Optional
REDIS_URL="" # For caching (reduces costs by 70%)# Generate Prisma client
pnpm prisma generate
# Push schema to database
pnpm prisma db push
# (Optional) Seed with sample data
pnpm prisma db seed# Development mode
pnpm dev
# Production build
pnpm build
pnpm startExtract and manage leads from any text source using AI.
- Text Extraction - Paste any text containing contact information
- Smart Templates - Pre-configured extraction patterns
- Lead Scoring - Automatic quality assessment (0-100)
- Lead Enrichment - Gather additional information
- Duplicate Detection - Prevents redundant entries
- Bulk Import - Process multiple leads simultaneously
- Navigate to
/en/leads - Click on "AI Lead Extraction" section
- Paste text containing lead information:
- LinkedIn profiles
- Email signatures
- Conference attendee lists
- Company directories
- Click "Extract" to process
- Review and save extracted leads
- Use "Score Selected" for quality assessment
John Smith
CEO at TechCorp
john.smith@techcorp.com
+1 555-123-4567
LinkedIn: linkedin.com/in/johnsmith
Based in San Francisco, CA
- Extraction: Groq Llama 3.1-70B (cost-optimized)
- Scoring: Claude 3.5 Sonnet (quality-optimized)
- Enrichment: Claude 3.5 Sonnet
Analyze Upwork jobs and generate customized proposals with AI.
- Real-time Analysis - Streaming job evaluation
- Multi-criteria Scoring - Technical, business, scope, client, budget
- Viability Assessment - Determines if job is worth pursuing
- Proposal Generation - Creates personalized proposals
- Tone Variations - Professional, friendly, or casual
- Performance Tracking - Score your proposals
- Navigate to
/en/upwork - Select "AI Analyzer" tab
- Paste Upwork job description
- Review the analysis:
- Overall score (0-10)
- Score breakdown by category
- Red flags and recommendations
- Click "Generate Proposal" for AI-written response
- Choose tone and regenerate if needed
- Copy proposal to clipboard
- 7-10: Excellent match, pursue actively
- 5-7: Good potential, worth considering
- 0-5: Poor match, likely not worth time
- Analysis: Claude 3.5 Sonnet
- Proposal Writing: Claude 3.5 Sonnet
- Variations: GPT-4o
Extract business contacts and intelligence from websites.
- Static Site Scraping - Extract from HTML content
- AI Lead Extraction - Identify contacts automatically
- Page Analysis - Determine page type and lead potential
- Company Intelligence - Extract business information
- CSV Export - Download scraped leads
- Multi-page Support - Breadth/depth strategies
- Navigate to
/en/scraper - Enter website URL (e.g.,
https://example.com/about) - Click "Scrape" to extract data
- Review page analysis:
- Page type (landing, about, contact, etc.)
- Lead potential (high/medium/low)
- Company information
- View extracted leads
- Export to CSV for CRM import
/about- Team members and leadership/team- Staff directory/contact- Direct contact information/partners- Business relationships
- Extraction: Groq Llama 3.1-70B
- Analysis: Claude 3.5 Sonnet
Generate, analyze, and optimize email campaigns with AI.
- Template Generation - AI-created email templates
- Tone Control - Professional, friendly, or casual
- Effectiveness Analysis - Score emails before sending
- Follow-up Sequences - Automatic follow-up generation
- Personalization - Customize for each recipient
- Spam Risk Assessment - Avoid spam filters
- Navigate to
/en/emails - Choose email purpose or describe what you need
- Select tone (professional/friendly/casual)
- Generate template with AI
- Review in "Compose" tab
- Click "Analyze" for effectiveness score
- View analysis:
- Overall score (0-100)
- Category breakdown
- Predicted open/click rates
- Spam risk level
- Generate follow-up sequence if needed
- Subject Line - Compelling and clear
- Personalization - Relevance to recipient
- Clarity - Easy to understand
- Value Proposition - Clear benefits
- Call to Action - Specific next steps
- Tone - Appropriate for audience
- Generation: Claude 3.5 Sonnet
- Analysis: Claude 3.5 Sonnet
- Personalization: GPT-4o-mini
-
Use Groq for Bulk Operations
- Lead extraction from large texts
- Processing multiple items
- Initial screening tasks
-
Use Claude for Critical Tasks
- Final proposals
- Important email campaigns
- Complex analysis
-
Enable Caching (if Redis available)
- Reduces repeated API calls
- Saves 70% on costs
- Improves response times
- Quality over Quantity: Better to extract fewer high-quality leads
- Provide Context: Include company descriptions and roles
- Use Templates: Leverage pre-built templates for common formats
- Verify Emails: Always verify extracted email addresses
- Be Specific: Reference exact requirements from job posting
- Show Experience: Include relevant project examples
- Keep Concise: 200-300 words optimal
- Personalize Opening: Grab attention in first sentence
- Clear CTA: End with specific next step
- Test First: Always analyze before sending
- A/B Testing: Generate variations to test
- Follow-up Timing: 3-5 days between emails
- Personalization: Use recipient data effectively
- Monitor Metrics: Track open and response rates
The system automatically selects the best AI model based on task:
// Task-based selection
- Analysis → Claude 3.5 Sonnet (best reasoning)
- Extraction → Groq Llama 3.1-70B (cost-effective)
- Generation → Claude 3.5 Sonnet (quality writing)
- Streaming → Groq Llama 3.1-8B (fast response)You can override model selection based on priority:
- Cost Priority → Groq models
- Quality Priority → Claude models
- Speed Priority → Groq instant modelsBe aware of provider limits:
- Groq: 30 requests/minute
- Claude: 4000 requests/minute
- OpenAI: 10000 requests/minute
- Lead Extraction: 2-3 seconds
- Job Analysis: 3-5 seconds (streaming)
- Proposal Generation: 4-6 seconds (streaming)
- Email Generation: 3-4 seconds
- Web Scraping: 5-10 seconds per page
- Lead Extraction: 85-95%
- Email Detection: 95%+
- Phone Detection: 90%+
- Company Identification: 80-90%
- Lead Extraction: $5-10
- Job Analysis: $15-25
- Proposal Writing: $20-30
- Email Generation: $10-15
- Web Scraping: $5-10
-
"API Key not configured"
- Add API keys to
.env.local - Restart the development server
- Add API keys to
-
"Rate limit exceeded"
- Wait 1 minute for Groq
- Switch to different provider
- Implement caching
-
"Failed to extract leads"
- Check text format
- Ensure contact info is present
- Try different templates
-
Database Connection Error
- Verify DATABASE_URL in
.env.local - Check PostgreSQL is running
- Run
pnpm prisma generate
- Verify DATABASE_URL in
- Monitor API usage in provider dashboards
- Track lead conversion rates
- Measure email campaign effectiveness
- Analyze proposal success rates
- Set up billing alerts
- Use Groq for non-critical tasks
- Implement caching layer
- Batch operations when possible
# Install Vercel CLI
pnpm i -g vercel
# Deploy
vercel
# Set environment variables in Vercel dashboard- All API keys from
.env.local - DATABASE_URL (use connection pooling)
- AUTH_SECRET (generate new for production)
extractLeadsFromText(rawText: string, source: string)
scoreLeads(leadIds: string[])
enrichLead(leadId: string)analyzeJobStreaming(jobDescription: string)
analyzeJobStructured(jobDescription: string)
generateProposalStreaming(jobDetails: any, tone: string)scrapeAndExtractLeads(url: string)
analyzeWebsite(url: string)
scrapeMultiplePages(startUrl: string, strategy: string, maxPages: number)generatePersonalizedEmail(template: string, leadData: object, tone: string)
generateEmailTemplateStreaming(purpose: string, audience: string, keyPoints: string[], tone: string)
analyzeEmailEffectiveness(emailContent: string)
generateFollowUpSequence(initialEmail: string, count: number, daysBetween: number)Feel free to submit issues and enhancement requests!
This project is part of your private codebase.
- Built with Vercel AI SDK v5
- Powered by Claude, OpenAI, and Groq
- UI components from shadcn/ui
Built with ❤️ using Claude Code Max
Transform your sales process with AI-powered automation!