Explanation of
Choices
Here's the architecture and decisions I made, hope they make sense! For the ranking, I chose to filter and then batch candidates by company rather than scoring individually. This lets the model compare peers directly to find the true decision-makers, balancing contextual accuracy with token costs. For the prompt optimization, I implemented a size-aware subsampling strategy—optimizing against a diverse subset of companies to prevent overfitting while keeping the feedback loop fast.
Persona-Driven Ranking Strategy
I built the rubric to adapt based on company size. At a 10-person startup, the CEO is your buyer. At a 500-person company, you're looking for the VP of Sales Development instead.
I score on department_fit, seniority_fit, & size_fit, then assign explicit ranks (1, 2, 3...). No ties allowed.
Gemini & Groq Support
I set Gemini as the default because it's fast, reliable, and highly cost-effective. For flexibility, you can swap to any model on the Groq API to handle specific scale or latency requirements.
Company-Batched Ranking
I group leads by company so the LLM can compare them head-to-head. This guarantees I find the best N contacts per company with clear, relative rankings.
Size-Aware Deterministic Gate
I filter out HR, Finance, and Legal upfront—saving 30-50% of LLM calls. It's context aware too: CTOs pass the gate at startups but get filtered at big enterprises.
Async Agent Pattern
Large lists timeout on Vercel (10-60s limit). I use Trigger.dev to handle this with durable execution and auto-retries. Keeps the UI responsive while the agents work in the background.
Supabase Realtime
Supabase streams live updates as companies get processed. You can literally watch the agent work in real-time—no custom WebSockets or polling needed.
Batch Upserts Over Row-by-Row
Writing 50 leads one-by-one means 50 database calls. I do batch upserts instead—one atomic transaction. 10x faster and no partial failures.
Basically: I built this in a few hours. And definitely is not perfect! Hope you like though!
Inside the Engine
From raw CSV to ranked intelligence. A breakdown of the autonomous agentic workflow that transforms lead lists into prioritized outreach targets.
CSV Ingestion & Normalization
Step 01Upload your lead database as a CSV file. The system automatically ingests data, normalizes company names, titles, and employee ranges, then deduplicates using canonical keys to prevent double-processing.
Company Batching & Context Enrichment
Step 02Leads are grouped by company and enriched with web intelligence. The Scout Agent scrapes company websites to extract signals like funding announcements, hiring patterns, and go-to-market strategies.
Deterministic Pre-filtering
Step 03Before ranking, a rules-based gate excludes obvious non-targets: HR, Finance, Legal, Advisors, and Interns. Dynamic exceptions apply based on company size (e.g., CTOs allowed at startups under 10 employees).
Multi-Model LLM Ranking
Step 04The system defaults to Gemini Flash for industry-leading speed and accuracy. Users can also select any model from the Groq API to optimize for specific latency or reasoning requirements.
Persona-Aware Scoring
Step 05The LLM evaluates each lead against a detailed persona rubric (department fit, seniority fit, size context fit). It classifies roles as decision_maker, champion, or irrelevant and assigns explicit ranks within each company.
Batch Database Persistence
Step 06All rankings, scores, reasoning, and rubric data are persisted to Supabase in batch operations. Progress updates trigger real-time UI changes via Supabase Realtime subscriptions.
Live Leaderboard & Export
Step 07As leads are ranked, they stream into an animated leaderboard with expandable rows showing AI reasoning. Export your top N leads per company to CSV for immediate outreach.
Automatic Prompt Optimization
AdditionalThe system uses AI to optimize its own prompts. It evaluates performance on a pre-ranked eval set, generates natural language gradients from errors, and iteratively refines the prompt to improve F1 score and ranking accuracy.