LeadFlow AI is an enterprise-grade, autonomous sales intelligence pipeline. It continuously digests prospect leads, executes concurrent deep research across web and company footprint using LangGraph agents, evaluates qualification through a 7-judge probability-weighted consensus matrix, and synthesizes hyper-personalized outreach drafts for high-fit leads in under 30 seconds.
Built with a high-throughput FastAPI backend, resilient asynchronous queue leasing, and a responsive React 19 dashboard, LeadFlow AI empowers sales teams to focus purely on closing while autonomous agents handle discovery and hyper-contextual drafting.
Evaluated over 60 multi-category leads (spanning strong-fit, competitor traps, non-buyers, adversarial injections, and edge cases) traced on Langfuse:
| Metric | Measured Result | Benchmark Standard |
|---|---|---|
| Accuracy | 98.3% | High (> 90%) |
| Precision | 96.4% | Reliable (> 90%) |
| Recall | 100.0% | Zero false negatives |
| F1 Score | 98.2% | High confidence |
| Spearman Correlation | 82.9% | Robust rank ordering |
| Mean Absolute Error (MAE) | 6.17 pts | Tight scoring spread |
| End-to-End Latency (p50) | 22.1s | Sub-30s pipeline completion |
| Average Cost per Lead | $0.0361 | Ultra-cost-effective inference |
Real-world load testing utilizing live Gemini, Tavily, and Hugging Face inference under concurrent virtual user workflows:
| Concurrent Users | Completed Jobs | Submit-to-Result p50 | Submit-to-Result p95 | Queue Wait p50 | Queue Wait p95 |
|---|---|---|---|---|---|
| 1 | 1 / 1 | 46.4s | 46.4s | 2.7s | 2.7s |
| 5 | 5 / 5 | 45.2s | 49.2s | 2.1s | 8.8s |
| 10 | 10 / 10 | 35.5s | 51.5s | 7.6s | 12.4s |
| 40 | 40 / 40 | 117.8s | 143.7s | 48.7s | 104.2s |
| 80 | 80 / 80 | 146.5s | 215.9s | 75.1s | 182.8s |
| 160 | 160 / 160 | 154.5s | 317.9s | 131.8s | 296.1s |
| 250 | 235 / 250 | 394.9s | 522.8s | 346.8s | 475.0s |
- Ingest Lead & ICP: Sales rep or batch CSV ingestion submits target leads with ideal customer profile (ICP) guidelines. The API enqueues the job and immediately returns
202 Accepted. - Parallel Dual Research: Independent agents fetch company data (via Tavily search and structured extraction) and personal professional footprint simultaneously. Cached company data (
company, ICP) avoids duplicate API queries. - 7-Judge Consensus Scoring: The model triggers 7 parallel judge evaluations across role, seniority, company size, market position, cultural fit, use case, and engagement readiness.
- Outreach Synthesis: Leads scoring above 70 trigger Gemini 3.6 Flash to draft custom outreach incorporating real pain points, recent company milestones, and strategic relevance.
- Review & Dispatch: Sales reps inspect breakdown analysis, refine messaging in the rich editor, and send directly via integrated SMTP with full audit logging.
Every prospect is evaluated across three weighted pillars to ensure rigorous qualification:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LEAD QUALIFICATION (100 pts) β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββ€
β 1. Demographic (20 pts) β 2. Firmographic (20 pts) β 3. Behavioral (60 pts)β
ββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββΌββββββββββββββββββββββββ€
β β’ Role Relevance (15p) β β’ Company Size (10p) β β’ Cultural Fit (30p) β
β β’ Seniority Tier (5p) β β’ Market Presence (10p) β β’ Use Case Fit (20p) β
β β β β’ Engagement (10p) β
ββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββ΄ββββββββββββββββββββββββ
- Threshold > 70: Automatically qualified; triggers high-priority email synthesis.
- Threshold 65β75 (Borderline): Highlighted in dashboard with one-click on-demand draft generator.
- Threshold < 65: Disqualified with structured explanatory reasoning saved in audit logs.
- Python 3.10+
- Node.js 18+
- Supabase account (free tier works)
- Google Gemini API key or Cloudflare Workers AI credentials + Tavily API key
git clone https://github.com/realranjan/leadflow-ai.git
cd leadflow-aiCopy .env.example to backend/.env and supply your keys:
cp backend/.env.example backend/.envKey configuration variables:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your_supabase_service_role_key
SECRET_KEY=generate_a_long_random_jwt_secret
LLM_MODEL=GEMINI
GEMINI_API_KEY=your_gemini_api_key
TAVILY_API_KEY=your_tavily_api_key
JUDGE_PROVIDER=HUGGING_FACE
HUGGINGFACE_API_KEY=your_huggingface_keydocker compose up --build- Dashboard:
http://localhost:5173 - API Swagger Docs:
http://localhost:8000/docs
cd backend
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn backend.backend:app --host 0.0.0.0 --port 8000 --reloadpython backend/worker.pycd frontend
npm install
npm run dev- Stateless HMAC Authentication: 60-minute access tokens + rotating 14-day refresh tokens stored securely in Supabase.
- Database-Backed Rate Limiting: Distributed tenant limits across login, signup, lead processing (30/min/user), and token refreshes.
- Credential Encryption: User-supplied Gemini, Cloudflare, and SMTP credentials are encrypted before database persistence.
- Round-Robin Fair Queue Leasing: Multiple worker instances lease jobs fairly using atomic tenant-level round-robin cursors.
- Resilient Circuit Breakers & Retries: Automated backoff and bounded retries handle transient upstream LLM and search outages gracefully.
Run the comprehensive test suite locally:
# Run unit & API security tests
python tests/test_security.py
python tests/test_settings.py
python tests/test_rate_limits.py
python tests/test_dashboard.py
# Run LangGraph pipeline validation
python tests/test_pipeline.py
# Run queue fairness & worker claim tests
python tests/test_queue_policy.py
# Run frontend test suite
cd frontend && npm test
Ranjan Vernekar
GitHub: @realranjan
Lead Architect & AI Systems Developer
This project is licensed under the MIT License β see the LICENSE file for complete details.
Copyright Β© 2025β2026 Ranjan Vernekar. All rights reserved.