Avery
RuntimeUse casesPricingHelpBlog
← All postsBlog

Build a sales lead qualification agent

2026-06-12 · Avery NXR

Most B2B sales teams waste 60 percent of their time on bad-fit leads.

The reps know it. The VP of Sales knows it. The CFO knows it because the cost-per-customer-acquired number is uglier every quarter. The fix doesn't come from a better CRM, a better lead form, or a better email cadence. It comes from a layer between "lead arrives" and "rep responds" that actually qualifies before anyone touches it.

That layer used to be a junior SDR who read every lead and triaged. Then it was a brittle Zapier rule that matched keywords. Then it was a cloud AI tool that did slightly smarter matching but routed customer data through OpenAI.

The current right answer is a local-first AI agent that reads each lead, scores fit against your ICP, drafts personalized outreach for the high-quality ones, and routes the rest to nurture. This post is the build.

The problem with manual lead qualification

Sales teams under qualification pressure follow a predictable pattern.

The first lead of the day gets a thoughtful, personalized response. The fifth lead gets a slightly less thoughtful one. By lead twenty, the rep is sending a template that doesn't quite fit, doesn't quite acknowledge what the prospect said in their form submission, and doesn't quite earn the next meeting.

Meanwhile, two of those twenty leads were perfect ICP fits with high purchase intent. They got the same template as the tire-kickers. They never replied. Your AE blames the marketing team. Marketing blames the leads. Nobody fixes it.

The underlying issue: humans cannot maintain qualification quality across high lead volume. Throughput and quality trade off.

An AI agent doesn't have this trade off. The hundredth lead gets the same depth of attention as the first.

What the agent actually does

The functional requirements:

Lead ingestion. The agent watches your CRM or form provider for new leads. As they arrive, it pulls them into the processing queue.

Enrichment. For each lead, the agent enriches the data. Look up the company via Clearbit, Apollo, or your enrichment provider. Pull recent funding announcements. Check the prospect's LinkedIn for role-fit signals. Add the data to the lead record.

ICP scoring. The agent scores the lead against your specific ICP criteria. Company size, industry, role, use case fit, urgency signals. Weighted scoring produces a number; threshold determines routing.

Outreach drafting. For leads above the threshold, the agent drafts personalized first-touch outreach. Not a template with the prospect's name swapped in. Actual personalization based on what the prospect said in their form, what their company does, what the recent news about them is.

Routing. High-fit leads go straight to a rep's queue with the drafted outreach attached. Medium-fit leads go to a nurture sequence. Low-fit leads get a polite auto-reply or a clean rejection.

Audit logging. Every decision logged. Lead inputs, enrichment data, scoring outputs, drafted message, routing decision. For sales ops review and compliance.

That's the system. Five Avery NXR CRs, two to three focused days.

The Avery NXR build

CR 1: Lead ingestion.

"Build a HubSpot webhook listener at /webhooks/hubspot/lead. On receipt, parse the contact data and create a Lead record in our local Postgres with fields: id, first_name, last_name, email, company_name, role, form_message, source_url, raw_payload (JSON), created_at, status (enum: new, enriching, scored, routed, completed). Acknowledge to HubSpot within 5 seconds."

The same pattern works for Salesforce, Pipedrive, or generic web forms. Connector libraries handle the differences.

CR 2: Enrichment.

"For each Lead in 'new' status, call the Clearbit API to enrich company data (size, industry, funding, technologies). Call Apollo API for prospect role validation. Store enrichment data in a separate EnrichmentResult table linked to the Lead. Update Lead status to 'enriching' then 'scored' on completion. Retry transient errors with exponential backoff. Skip enrichment if the lead's email is from a free email provider (Gmail, Yahoo, etc.); flag for human review."

The free-email handling matters. Most B2B form spam comes from free emails. Catching it before enrichment saves the API call cost.

CR 3: ICP scoring.

"Score each scored Lead against the ICP using the following criteria. Company size 100-1000 employees: +20 points. Industry in [software, healthcare, finance, retail]: +15 points. Role in [VP, Director, Manager]: +20 points. Recent funding announcement: +10 points. Use case in form message matches our offering: variable +5 to +30 based on match quality. Threshold for high-fit: 60 points. Store score and breakdown in ScoringResult table."

The threshold tunes with experience. Start at 60, adjust based on what your reps confirm is actually high-fit.

CR 4: Outreach drafting.

"For each Lead with score above 60, generate a personalized outreach email. Use the local model with the following prompt structure: (1) the lead's form message verbatim, (2) the enrichment data about their company, (3) a constraint to write in our team's voice (provide 5 examples from past successful outreach), (4) a constraint to be specific about why we think we can help (no generic value props), (5) a CTA for a 15-minute call. Output as a draft to be reviewed before sending."

The voice extraction is critical. Generic AI-drafted outreach reads as AI-drafted outreach. Train the agent on your team's actual best emails so the output matches the voice.

CR 5: Routing and CRM update.

"For each Lead with completed scoring and (if applicable) drafted outreach, route based on score. High-fit (>60): assign to round-robin rep, attach drafted outreach to the CRM record, set follow-up reminder for 2 hours. Medium-fit (30-60): add to nurture sequence in HubSpot, do not assign. Low-fit (<30): send polite auto-reply, mark closed-lost in CRM. Update Lead status to 'routed' or 'completed'. Log full decision trail to AuditLog table."

That's the whole system. Five CRs. The agent runs continuously, processing leads as they arrive.

Real numbers from a deployment

A deployment I worked with at a Series B SaaS company processing 400 leads per month:

Before the agent: 18-hour average rep response time. 12 percent close rate from form-submitted leads.

After the agent: 2-hour average rep response time on high-fit leads. 60 percent of total leads filtered out before reaching reps. 23 percent close rate on the leads that did reach reps.

The reps spent the same total time on sales work but on much higher-quality leads. The close rate nearly doubled because the leads they saw were actually qualified.

The CFO loved the cost-per-customer-acquired improvement. The reps loved not spending their day on tire-kickers. Marketing loved having actual data on what made a high-fit lead.

The total build effort: about 20 hours of focused engineering work spread over a week. The infrastructure cost (workstation running Avery NXR, enrichment API costs): a fraction of what a single underperforming SDR cost them per quarter.

The privacy advantage for European leads

If you sell into Europe, your B2B form data falls under GDPR. The prospect's name, email, company, and any role information they provided are personal data subject to processing rules.

Cloud AI tools that route this data to OpenAI or Anthropic for scoring or drafting create a real exposure. Your DPA probably doesn't disclose them as processors. Your prospect didn't consent. You're technically out of compliance.

A local-first agent keeps the data on your infrastructure. The processor question doesn't arise. The DPA accurately reflects the data flow. The compliance posture is clean.

For European sales teams specifically, this is a real competitive advantage. Your DPA is easier to negotiate. Your security questionnaire is easier to fill in. Your sales motion has fewer compliance friction points.

When NOT to build a qualification agent

A few cases where the math doesn't work.

You get under 50 leads per month. The build effort isn't worth it. A junior SDR or a careful AE can handle the volume manually with high quality.

Your sales motion requires high-touch from the very first contact. Some enterprise sales cycles benefit from a partner reading every lead personally. An agent intermediating reduces that signal.

Your team doesn't have a clear ICP yet. The agent depends on scoring criteria you can write down. If you're still discovering who your ideal customer is, write the criteria as you learn them; don't try to encode uncertainty.

You can't get your CRM team to enable the webhook. Sometimes the political battle to get integration access takes longer than the build itself. Pick your battles.

For most B2B teams above modest scale with a clear ICP, the math works. The build pays back in the first month.

The honest accuracy reality

Local models score B2B leads at high accuracy after some prompt iteration. They're not better than a great senior SDR reading every lead carefully. They're better than the rushed manual qualification that actually happens at scale.

Specifically, expect:

True positive rate (correctly identifies high-fit leads): 85 to 95 percent after iteration.

False positive rate (flags a low-fit lead as high-fit): 5 to 10 percent. These leads waste rep time but the rep can quickly disqualify in their first response.

False negative rate (flags a high-fit lead as low-fit): 3 to 7 percent. These leads get lost to nurture. The risk is real but typically less costly than the false positives that fully manual systems generate.

Tune the thresholds based on which error you can tolerate more. Most teams set the bar a bit lower than perfect because the cost of missing a real lead exceeds the cost of one extra rep conversation.

The v1.1 additions

After you ship the core system, the obvious extensions:

Multi-step outreach sequences. The agent drafts not just the first email but the second, third, and fourth follow-ups, each tailored to whether the prospect responded.

Account-based scoring. For larger deals, score the company-level signal (other people from the same company also engaging, news about the company) and roll up to the lead level.

Pipeline forecasting. The agent processes the historical data and predicts which currently-in-pipeline deals will close based on patterns from prior wins.

Win-loss analysis. The agent reads closed-lost notes and surfaces patterns. Are you losing to a specific competitor? On price? On feature gaps?

Each is a separate CR set. Ship the core system first. Add as you learn.

The CRM integration patterns

The biggest implementation gotcha is the CRM integration. Each system has its own model.

HubSpot: webhooks for new contacts and form submissions. REST API for updates. Properties for custom fields. Workflows for automation hooks.

Salesforce: triggers and Platform Events for new leads. Apex callouts for enrichment hooks. Custom objects for the audit log. Lightning components for any UI.

Pipedrive: webhooks for new deals or persons. REST API for updates. Custom fields for ICP scoring. Filters for routing.

The Avery NXR build handles HubSpot natively. For other CRMs, plan an additional CR or two for the integration plumbing.

What sales operations gets from this

Beyond the rep-level impact, sales ops gets visibility that's hard to build any other way.

Every scoring decision is logged. You can pull a report on "leads scored 50-60 in the last quarter" and ask reps to validate whether the agent's borderline calls were right. The data improves the scoring criteria over time.

Conversion at each stage is measurable. High-fit leads have a known conversion rate. Medium-fit leads have a known nurture-to-opportunity rate. The funnel becomes a numbers game with real numbers.

Coaching becomes data-driven. "Your high-fit leads convert at 40 percent; the team average is 25 percent. What are you doing differently?" Same question with hard data instead of hunches.

The closing thought

Sales has been searching for the qualification layer for a long time. SDRs were the first answer. Marketing automation was the second. Cloud AI tools were the third. Each had structural issues that limited the impact.

Local-first AI agents are the current right answer because they're cheap, fast, accurate, privacy-clean, and customizable to your specific ICP.

For B2B teams running modern sales motions, the agent is no longer a "nice to have." It's the layer that determines whether your reps spend their time on revenue or on noise.

If you're tired of watching reps work on bad leads, build it.

avery.software