Lead Qualification & Follow-up Engine
Python · Claude Messages API · CRM stub
The problem
In car sales, speed and prioritisation win deals — a lead contacted in ~5 minutes converts far better than one contacted an hour later. But a sales team's inbox mixes a cash-ready buyer in with someone "just looking", so reps burn time sorting instead of calling the hot ones first.
The approach
For each inbound lead, one Claude call:
- Extracts BANT signals — budget, timeline, financing, trade-in, vehicle of interest
- Assigns a tier — hot / warm / cold against an explicit rubric
- Recommends the next action for the team
- Drafts a personalised follow-up that names the actual vehicle
It logs lead-shaped data to a CRM and prints a prioritised call queue — hottest first — while flagging fleet orders and trade-in valuations for a salesperson.
A deliberate choice: tiers, not a 1–100 score
An open numeric score wobbles run-to-run (the same lead scores 72, then 68, then 75). So the prompt uses stable, well-defined tiers, and the sort priority is derived in code — the model never invents a number, and the queue is reproducible by construction.
Architecture
Sample run — the prioritised queue
PRIORITISED QUEUE (call hot leads first)
[HOT ] Jenny Lao Mitsubishi Xpander
[HOT ] FastCargo Inc. fleet (6–8 vans) → salesperson
[WARM] — Toyota Hilux 4x4
[COLD] — general enquiry Follow-up: "Hi Jenny, thanks for your interest in the Xpander — we'd love to set up that test drive this Saturday. Expect a call shortly, or reach us on (02) 555-0143..."
Measuring & improving it (evals)
The demo ships with a labelled eval harness. It caught an over-escalation bug: the original rule flagged "high-value leads" for a salesperson, so it escalated a cash-ready buyer and a general financing question that should just get a drafted reply. An explicit rule fixed it:
Version needs_human tier exact-match Before (vague "high-value") 75% (6/8) 100% 6/8 After (explicit: fleet + trade-in) 100% (8/8) 100% 8/8
Tiering accuracy held at 100% — the fix removed false positives without touching qualification.
Cost & model choice
Defaults to Claude Haiku 4.5 — qualification is a structured judgement over short text, cheap at sales-team volume. Opus 4.8 is one env var away for nuanced, high-value leads.