An intelligent AI-powered lead generation system built with 7 autonomous agents that work together to find, qualify, engage, and track B2B prospects. Built for the Analytos.ai assessment using Google Gemini AI, SendGrid, and real-time tracking.
This project implements a complete autonomous lead generation workflow that:
- 🔍 Finds and enriches prospect data
- 🎯 Scores leads based on ICP criteria
- ✍️ Generates personalized emails using AI
- 📧 Sends real emails via SendGrid
- 📊 Tracks opens, clicks, and responses in real-time
- 🔄 Learns from feedback to continuously improve
Real Results: Successfully sent 10 personalized AI-generated emails with 100% delivery rate!
graph LR
A[Prospect Search] --> B[Data Enrichment]
B --> C[Scoring]
C --> D[Outreach Content]
D --> E[Outreach Executor]
E --> F[Response Tracker]
F --> G[Feedback Trainer]
G -.->|Insights| A
- Prospect Search Agent - Finds companies matching ICP criteria
- Data Enrichment Agent - Enriches with technologies, news, signals
- Scoring Agent - Ranks leads by fit (0-100 score)
- Outreach Content Agent - Generates personalized emails with Gemini AI
- Outreach Executor Agent - Sends emails via SendGrid
- Response Tracker Agent - Monitors engagement metrics
- Feedback Trainer Agent - Analyzes performance and suggests improvements
- ✅ Dynamic Workflow: JSON-driven configuration
- ✅ AI-Powered: Google Gemini 2.5-flash for email generation
- ✅ Real Email Sending: SendGrid integration
- ✅ Real-Time Tracking: Flask webhook server with live dashboard
- ✅ Self-Improving: Feedback loop for continuous optimization
- ✅ Production-Ready: Error handling, logging, dry-run mode
- ✅ Zero Cost: Uses only free tiers (Gemini, SendGrid free plan)
Python 3.9+
pip# Clone repository
git clone https://github.com/yourusername/LeadGenerator.git
cd LeadGenerator
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keysCreate .env file:
# AI Provider (gemini recommended - FREE!)
AI_PROVIDER=gemini
GEMINI_API_KEY=your_gemini_api_key
# SendGrid (for email sending)
SENDGRID_API_KEY=your_sendgrid_api_key
SENDGRID_FROM_EMAIL=your_verified_email@domain.com
# Optional: Dry run mode
ENABLE_DRY_RUN=false# Execute complete workflow
python langgraph_builder.py
# Start tracking dashboard
python webhook_server.py
# Visit http://localhost:5000📬 Emails Sent: 10/10 (100% success)
✅ Status: 202 Accepted by SendGrid
👥 Recipients: Friends at OpenAI, Google, Meta, AWS, NVIDIA, Adobe, Anthropic, Tesla, IBM, Hugging Face
🎯 Personalization: Each email references company-specific news and technologies
📝 Disclaimers: Friendly P.S. explaining it's a test project
Subject: OpenAI's Sales Growth: An AI Edge?
Hi there,
Huge congratulations on the GPT-5 launch and your expanded Microsoft partnership!
OpenAI's leadership in enterprise AI, leveraging technologies like GPT-5 and Azure,
is truly groundbreaking.
Given your pioneering work in *building* such advanced AI, I thought of Analytos.ai.
We help B2B companies apply AI to *optimize their sales processes*, translating
powerful models into consistent revenue growth.
I'd love to briefly share how we enable sales teams to achieve efficiency gains,
much like OpenAI achieves AI breakthroughs. Would you be open to a quick 15-minute
chat next week?
---
P.S. Hey Lade Sai Teja! 👋
This is Sai Teja testing an AI-powered lead generation system I built for
Analytos.ai assessment. You're one of my test subjects! 😄
The email above was 100% generated by Google Gemini AI based on your company's
recent news. Pretty cool, right?
Let me know what you think! (And sorry for the spam! 😅)
- Sai Teja, SASTRA University
LeadGenerator/
├── agents/ # 7 AI Agents
│ ├── prospect_search.py
│ ├── data_enrichment.py
│ ├── scoring.py
│ ├── outreach_content.py
│ ├── outreach_executor.py
│ ├── response_tracker.py
│ └── feedback_trainer.py
│
├── tools/ # API Integrations
│ ├── apollo_api.py
│ ├── clearbit_api.py
│ ├── google_sheets.py
│ ├── openai_client.py # Supports OpenAI & Gemini
│ └── sendgrid_client.py
│
├── utils/ # Utilities
│ ├── config_loader.py
│ ├── logger.py
│ └── validators.py
│
├── workflow.json # Dynamic workflow configuration
├── langgraph_builder.py # Main orchestrator
├── webhook_server.py # Real-time tracking server
├── real_leads_data.json # Test data (10 friends)
├── requirements.txt
└── .env
- Language: Python 3.13
- AI Model: Google Gemini 2.5-flash (FREE - 2M tokens/month)
- Email Service: SendGrid (100 emails/day free)
- Web Framework: Flask (for tracking dashboard)
- APIs: SendGrid, Apollo, Clearbit, Google Sheets
- Architecture: Agent-based, modular, event-driven
The system includes a real-time tracking dashboard:
- 📬 Delivery Status - Track which emails were delivered
- 👀 Open Tracking - See who opened emails
- 🖱️ Click Tracking - Monitor link clicks
⚠️ Bounce Detection - Handle failed deliveries- 📊 Live Stats - Real-time metrics and per-email breakdown
python webhook_server.py
# Visit: http://localhost:5000/# Simulate SendGrid events locally
python test_webhook.py
# Check dashboard for results
open http://localhost:5000/# Test each agent independently
python agents/prospect_search.py
python agents/scoring.py
python agents/outreach_content.pyThe workflow is entirely configured via workflow.json:
{
"workflow_name": "OutboundLeadGeneration",
"target_icp": {
"industry": "SaaS",
"employee_count": { "min": 100, "max": 1000 },
"revenue": { "min": 20000000, "max": 200000000 }
},
"config": {
"scoring": {
"weights": {
"revenue_fit": 0.3,
"employee_fit": 0.2,
"tech_stack": 0.2,
"growth_signals": 0.3
},
"min_score": 20
},
"outreach": {
"persona": "SDR",
"tone": "friendly",
"max_emails_per_day": 50
}
},
"steps": [...]
}- ✨ Self-Improving: Feedback loop analyzes results and suggests optimizations
- 🎯 Context-Aware: Emails reference actual company news and technologies
- 🔄 Fully Autonomous: Runs end-to-end without human intervention
- 📊 Production-Ready: Real email sending, tracking, error handling
- 📝 Well-Documented: Comprehensive docstrings and comments
- 🏗️ Modular: Easy to extend and modify
- 🐛 Error Handling: Graceful failures with detailed logging
- ✅ Type Hints: Clear function signatures
- 🧪 Testable: Each agent can run independently
- BEGINNER_GUIDE.md - Step-by-step learning guide
- WORKFLOW_PLAN.md - Visual workflow diagrams
- TRACKING_SETUP.md - Tracking system setup
- PROJECT_COMPLETE.md - Completion summary
- Google Gemini API - FREE at https://ai.google.dev/
- SendGrid API - FREE (100 emails/day) at https://sendgrid.com/
- Apollo API - Prospect search (has mock data fallback)
- Clearbit API - Data enrichment (has mock data fallback)
- Google Sheets API - Feedback logging
Video Demo: [Watch on Veed](#) (click)
Live Dashboard: Run python webhook_server.py and visit http://localhost:5000/
| Metric | Result |
|---|---|
| Total Agents | 7 |
| Lines of Code | 3,000+ |
| Email Delivery Rate | 100% (10/10) |
| AI Cost | $0 (Free Gemini tier) |
| Execution Time | ~30 seconds |
| Error Rate | 0% |
from agents.base_agent import BaseAgent
class MyNewAgent(BaseAgent):
def execute(self, inputs: Dict[str, Any]) -> Dict[str, Any]:
self.log_execution_start(inputs)
# Your logic here
result = {"key": "value"}
self.log_execution_end(result, success=True)
return self.format_output(result)- Add agent to
workflow.json - Implement agent class in
agents/ - Run
python langgraph_builder.py
This is a personal assessment project, but feedback and suggestions are welcome!
MIT License - Feel free to use this for learning and inspiration!
Lade Sai Teja
- University: SASTRA University
- Email: 126156075@sastra.ac.in
- Project: Analytos.ai LangGraph Assessment
- Date: October 2025
- Analytos.ai - For the awesome assessment challenge
- Google Gemini - For FREE AI API
- SendGrid - For email delivery
- GitHub Copilot - For AI-assisted development
For questions about this project:
- Email: 126156075@sastra.ac.in
- Assessment: Analytos.ai LangGraph Challenge
Built with ❤️ and AI in 4 hours!