On this page
What we're building
We'll build an agent that receives new leads, decides how promising each one is, updates the CRM and sends the right follow-up — without a human touching the easy cases.
The same pattern works for support tickets, job applications or any inbound queue.
1. Start with a reliable trigger
Use a Webhook node to receive leads from your website form or ad platform. Normalise the fields immediately — name, email, company, message — so every later step sees the same shape of data.
2. Ask the model for structured output
Give the LLM your ideal-customer profile and ask it to return JSON with a score, a short reason and a recommended next step. Structured output is what makes AI steps dependable inside a workflow.
- score: 0–100
- intent: high / medium / low
- reason: one sentence
- next_step: sales_call / nurture / disqualify
3. Give it tools and branches
Route on the score with an IF or Switch node. High scores create a CRM deal and notify sales; medium scores join a nurture sequence; low scores get a polite reply. Each branch is a tool the agent effectively 'chooses' through its output.
4. Keep a human in the loop
For borderline scores, send a Slack message with the lead summary and two buttons: approve or reject. Humans handle the ambiguous cases; the agent handles the obvious ones.
5. Log everything and ship
Write every decision and its reason to a sheet. After a week, review the log, adjust the prompt and thresholds, and you'll have an agent your sales team actually trusts.