Build an AI Lead Qualification Agent

Build an AI-powered lead qualification system that enriches, scores, and routes inbound leads automatically. Three paths: Claude connector, MCP, and Python SDK.

Updated

April 4, 2026

Published: April 3, 2026

A new lead comes in at 11pm. By the time your SDR sees it at 9am, they've already talked to two competitors. Research shows that responding within 5 minutes makes you 21x more likely to qualify a lead than waiting 30 minutes.

Manual lead qualification doesn't scale. Your reps spend hours researching companies, checking firmographic data, and deciding which leads are worth their time. Meanwhile, hot leads go cold.

What you'll build

Here's what your lead pipeline looks like before and after:

Lead contacts before qualification

Qualified deals after AI scoring

An AI-powered lead qualification system that:

  1. Picks up new leads from a form submission or CRM entry
  2. Enriches the lead with company firmographic data
  3. Scores the lead against your ICP criteria
  4. Creates a qualified deal with priority routing
  5. Notifies the assigned rep instantly

Total setup time: 0 min with the Claude connector, 5 min with MCP, 15 min with the SDK.


Path A: Use the Sanka connector in Claude (0 min)

This is the zero-friction path. No API key, no config, no code. Just natural language.

1. Connect Sanka

Go to Claude Settings → Connectors → find Sanka → click Connect. One-time OAuth login — Claude remembers your workspace.

2. Ask Claude what you want

Just describe the lead and let Claude handle the rest:

"I just got an inbound lead from sarah@techflow.io. They're a Series B startup looking for a sales automation solution. Can you create a contact, enrich the company data, score them against our ICP (B2B SaaS, 50-500 employees, North America), and create a deal if they're a good fit?"

3. See the results

Here's what it looks like in action:

Demo: AI agent qualifying leads via Claude connector

Claude will:

  1. Create a contact for sarah@techflow.io
  2. Enrich TechFlow with firmographic data (industry, employee count, funding, tech stack)
  3. Score the lead: "TechFlow scores 85/100 — B2B SaaS, 120 employees, Series B ($18M raised), HQ in Austin. Strong ICP fit."
  4. Create a deal: "TechFlow - Sales Automation Evaluation" with priority: High
  5. Return a summary with next steps

All from a single prompt. No clicking through CRM screens.


Path B: Build it in your IDE with MCP (5 min)

For developers using Claude Code, Cursor, or other MCP-compatible tools. Same capabilities as the connector but integrated into your development workflow.

1. Connect Sanka MCP

Add this to your MCP config:

JSON
{
  "mcpServers": {
    "sanka": {
      "url": "https://mcp.sanka.com/mcp?apiKey=sk_live_YOUR_KEY"
    }
  }
}

Get your API key from sanka.io/developers.

API token setup in Sanka

2. Describe what you want

Paste this prompt into your AI assistant:

Text
Build a lead qualification workflow:

1. Create a contact for the lead email I provide
2. Enrich the company domain with firmographic data
3. Score the company against this ICP:
   - Industry: B2B SaaS or Technology
   - Employee count: 50-500
   - Region: North America or Europe
   - Funding: Series A or later
4. If score >= 70, create a deal with priority "High"
5. If score 50-69, create a deal with priority "Medium"
6. If score < 50, just save the contact (no deal)
7. Return the results with reasoning

Test with: alex@cloudmetrics.com

3. See the results

The agent will execute the full workflow and return:

Text
Lead Qualification Results
==========================

Contact: Alex Chen (alex@cloudmetrics.com)
Company: CloudMetrics Inc.

Enrichment Data:
- Industry: B2B SaaS (Analytics)
- Employees: 180
- HQ: San Francisco, CA
- Funding: Series B ($24M)
- Tech Stack: AWS, Segment, Salesforce

ICP Score: 92/100
- Industry match: +25 (B2B SaaS)
- Employee fit: +25 (180 in target range)
- Region match: +20 (North America)
- Funding stage: +22 (Series B)

Action: Created deal "CloudMetrics - Inbound Evaluation"
- Priority: High
- Stage: Qualification
- Assigned to: Available SDR

Reasoning: Strong ICP fit across all dimensions. Recent Series B
suggests active growth phase with budget for new tooling.

Path C: Build it with the SDK (15 min)

For developers who want version control, CI/CD integration, or custom logic. Full control, production-ready code.

1. Install the SDK

Bash
pip install sanka-sdk

2. Build it

Python
from sanka import Sanka

client = Sanka(api_key="sk_live_...")

def qualify_lead(email: str, icp_criteria: dict) -> dict:
    """
    Qualify an inbound lead: enrich, score, and route.

    Args:
        email: Lead's email address
        icp_criteria: Dict with industry, employee_range, regions, min_funding

    Returns:
        Qualification result with score, reasoning, and created records
    """
    # Extract domain from email
    domain = email.split("@")[1]

    # Step 1: Create or find the contact
    contact = client.contacts.create({
        "email": email,
        "source": "inbound_form"
    })

    # Step 2: Enrich the company
    enrichment = client.ai.enrich({
        "type": "company",
        "domain": domain
    })

    company_data = enrichment.get("data", {})

    # Step 3: Score against ICP
    score_result = client.ai.score({
        "type": "company",
        "record_id": contact.get("company_id"),
        "criteria": icp_criteria
    })

    score = score_result.get("score", 0)
    band = score_result.get("band", "low")
    reasons = score_result.get("reasons", [])

    # Step 4: Route based on score
    result = {
        "contact_id": contact.get("id"),
        "email": email,
        "company": company_data.get("name"),
        "enrichment": company_data,
        "score": score,
        "band": band,
        "reasons": reasons
    }

    if score >= 70:
        # High priority - create deal and assign
        deal = client.deals.create({
            "name": f"{company_data.get('name', domain)} - Inbound Evaluation",
            "contact_id": contact.get("id"),
            "stage": "qualification",
            "priority": "high",
            "source": "inbound_form",
            "score": score
        })
        result["deal_id"] = deal.get("id")
        result["action"] = "deal_created_high_priority"

    elif score >= 50:
        # Medium priority - create deal for nurture
        deal = client.deals.create({
            "name": f"{company_data.get('name', domain)} - Inbound",
            "contact_id": contact.get("id"),
            "stage": "qualification",
            "priority": "medium",
            "source": "inbound_form",
            "score": score
        })
        result["deal_id"] = deal.get("id")
        result["action"] = "deal_created_medium_priority"

    else:
        # Low score - save contact only
        result["action"] = "contact_saved_no_deal"

    return result


# Example usage
if __name__ == "__main__":
    icp = {
        "industries": ["B2B SaaS", "Technology", "Software"],
        "employee_range": [50, 500],
        "regions": ["North America", "Europe"],
        "min_funding_stage": "Series A"
    }

    result = qualify_lead("alex@cloudmetrics.com", icp)

    print(f"Lead: {result['email']}")
    print(f"Company: {result['company']}")
    print(f"Score: {result['score']}/100 ({result['band']})")
    print(f"Action: {result['action']}")
    if result.get("deal_id"):
        print(f"Deal ID: {result['deal_id']}")

3. Automate it

Wire the function to a webhook so leads are qualified instantly:

Python
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route("/webhook/lead", methods=["POST"])
def handle_lead():
    """Webhook endpoint for new leads from forms or CRM."""
    data = request.json
    email = data.get("email")

    if not email:
        return jsonify({"error": "email required"}), 400

    # Use your ICP criteria
    icp = {
        "industries": ["B2B SaaS", "Technology"],
        "employee_range": [50, 500],
        "regions": ["North America", "Europe"],
        "min_funding_stage": "Series A"
    }

    result = qualify_lead(email, icp)

    # Optional: send Slack notification for high-priority leads
    if result["score"] >= 70:
        notify_slack(result)

    return jsonify(result)

if __name__ == "__main__":
    app.run(port=5000)

Connect your form tool (Typeform, HubSpot Forms, etc.) to this webhook endpoint.


Impact

MetricBeforeAfter
Lead response time4-6 hours< 1 minute
SDR research time per lead15-20 min0 min
Qualified leads per SDR per day8-1240-60
Lead-to-meeting conversion12%28%

The biggest win: your reps start every conversation with context. They know the company size, tech stack, funding stage, and ICP fit score before they pick up the phone.


Next steps

Ready to stop losing leads to slow response times? Get your API key and start qualifying leads in minutes.

Related content

Back to blog