AI-powered B2B lead qualification system that automatically enriches, scores, and routes sales leads using LangGraph and Groq LLM.
Automatically processes incoming sales leads through an intelligent workflow:
- Enrichment - Fetches company data (size, revenue, industry) via Clearbit API
- AI Scoring - Uses Groq LLM to score lead quality (0-100) based on ideal customer profile
- Smart Routing - Routes hot leads to CRM + Slack, warm leads to nurture, cold leads to drip campaigns
- Actions - Creates Salesforce records and sends real-time notifications
Processing time: ~3 seconds per lead
New Lead → Enrich → AI Score → Route → CRM/Notify → Complete
Tech Stack:
- Orchestration: LangGraph (stateful agent framework)
- LLM: Groq API (Llama 3.3 70B)
- Language: Python 3.9+
# Clone the repository
git clone https://github.com/abdul-ITexpert/sales-lead-qualification-agent.git
cd sales-lead-qualification-agent
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env and add your Groq API keyfrom src.agent import create_lead_qualification_graph, process_lead
from src.config import Config
# Set API key
Config.GROQ_API_KEY = "your_groq_key_here"
# Initialize agent
graph = create_lead_qualification_graph()
# Process a lead
lead_data = {
"email": "[email protected]",
"company": "Acme Corp",
"first_name": "John",
"last_name": "Doe",
"source": "website_form"
}
result = process_lead(lead_data, graph)
print(f"Score: {result['scoring'].score}/100")
print(f"Tier: {result['scoring'].tier}"){
"email": "[email protected]",
"company": "Enterprise Tech Solutions",
"first_name": "Sarah",
"last_name": "Johnson"
}{
"score": 92,
"tier": "hot",
"reasoning": "VP-level decision maker at mid-market enterprise",
"recommended_action": "Immediate outreach - schedule demo within 24 hours"
}Edit src/config.py to customize scoring criteria:
IDEAL_COMPANY_SIZE = (200, 1000) # Employees
MIN_REVENUE = 10_000_000 # $10M
TARGET_SENIORITY = ["VP", "C-Level", "Director"]
HOT_THRESHOLD = 70 # Score threshold| Metric | Value |
|---|---|
| Processing Speed | 3.2s per lead |
| Accuracy vs Manual | 92% agreement |
| Hot Lead Precision | 89% |
pytest tests/python examples/flask_api.pyMIT License - see LICENSE file for details.
Your Name - [email protected]
Project Link: https://github.com/yourusername/sales-lead-qualification-agent