Haqbil.
Work
Real Estate · AI Agents

An agent that scores and routes inbound leads in seconds

A 7-stage workflow that captures a lead, validates it, scores it with an LLM (returning a score, category, and reason), routes it hot/warm/cold, stores it, and fires an instant alert on hot leads. Built on n8n + Postgres, verified end to end.

The problem

Inbound leads decay fast. The gap between a form submission and the first response is where the lead is won or lost, and manual qualification puts that gap in hours rather than seconds.

Qualification done by hand is also inconsistent. The same enquiry gets read differently depending on who picks it up and how many are already in the queue.

What that calls for is not a chatbot. It is a workflow that always runs, always reaches a decision, and can explain the decision it reached.

What I built

A seven-stage workflow on n8n and Postgres that takes a lead from capture to alert with no human in the path.

  • 01

    Capture, then validate before anything else

    The lead arrives at a webhook and is validated first. Malformed and incomplete submissions are caught at the edge, so no model call is spent on input that was never going to score.

  • 02

    LLM scoring with structured output

    The validated lead is scored by an LLM that returns three things: a numeric score, a category, and a written reason. Requiring the reason alongside the score is what makes the output auditable instead of an opaque number.

  • 03

    Routing kept outside the model

    Hot, warm, and cold routing is decided by explicit thresholds in the workflow, not by asking the model to pick a branch. The model estimates; the workflow decides. Routing behaviour can be retuned without touching the prompt.

  • 04

    Postgres as the system of record

    Every lead is persisted with its score, category, and reason. The store is the audit trail — it is what makes it possible to check later whether the scoring was any good.

  • 05

    Instant alert on hot leads

    A hot classification fires an alert immediately. That is the entire point of the system: compressing time-to-first-touch to seconds.

  • 06

    Verified end to end

    The workflow was run as one complete path, capture through alert, rather than checked stage by stage in isolation.

The outcome

92/100
a live lead scored and alerted in seconds

The workflow was verified end to end on a live lead: submitted, validated, scored 92/100 with a category and a written reason, routed hot, stored, and alerted — in seconds.

What that changes is response time and consistency. Every lead gets the same treatment and reaches a decision with its reasoning attached, instead of waiting in a queue for whoever gets to it first. The honest caveat: a score is a prioritisation signal, and the thresholds are meant to be tuned as real outcomes accumulate.

AI AgentsAutomationLLM

Want to see how this was built?

Happy to walk through the system and what a similar build would take.

Book a call