All posts
AI Automation
May 19, 2026Updated June 4, 20266 min read

Building an AI Sales Copilot That Actually Understands Your Lead Pipeline

We built an AI sales copilot inside KeyesCode that researches leads, audits websites, scores opportunities, and drafts outreach — while keeping humans fully in control. The most interesting part wasn’t automation. It was watching the AI reason through impossible queries and explain the underlying business logic.

T
Tanner Keyes
Founder & CEO, KeyesCode
Building an AI Sales Copilot That Actually Understands Your Lead Pipeline

Building an AI Sales Copilot That Actually Understands Your Lead Pipeline

Most AI sales demos stop at: “Here’s an email draft.”

That wasn’t interesting to me.

I wanted to see what happens when you give an AI agent access to a real lead pipeline — with actual business constraints, imperfect data, scoring systems, and operational guardrails.

So over a couple of late-night coding sessions, I wired an AI sales copilot directly into KeyesCode’s lead-finder platform.

The goal was simple:

Let the AI research, analyze, and recommend. Never let it act without human approval.


What We Built

The system is made up of two main pieces:

1. A standalone MCP server

We built a dedicated MCP server called:

keyescode-sales-copilot-mcp

It exposes 12 internal tools for the AI agent, including:

  • Lead search
  • Website audits
  • Opportunity scoring
  • Personalized outreach drafting
  • Follow-up management
  • Pipeline summaries
  • Reminder scheduling
  • Sales context retrieval

The AI doesn’t just generate text. It can reason across tools and workflows.


2. A lightweight NestJS integration layer

Instead of rebuilding our existing lead infrastructure, we added a thin sales-copilot module onto the current backend.

That module handles:

  • Audit persistence
  • Outreach drafts
  • Approval workflows
  • Reminder tables
  • Follow-up tracking
  • Human review states

The important part:

Zero duplication of the lead-discovery engine.

The AI layer simply plugs into the existing system architecture.


The Most Important Part: Guardrails

This was non-negotiable.

AI systems touching outreach can become dangerous fast if you optimize only for automation.

So every workflow path includes hard constraints:

  • do_not_contact enforcement
  • Maximum of 3 follow-ups per lead
  • Spam-trigger detection
  • Automatic rejection of prompts attempting mass outreach
  • Mandatory human approval before any outbound action

The AI can recommend. The human still pushes the button.

That distinction matters.


The Unexpected Part

I thought I was building:

“AI that writes emails faster.”

What I actually built was something closer to a junior SDR that can reason through data problems.

I tested it with this prompt:

Find me a hot-priority lead in Tampa, Florida that has a website,
then audit the site and score them.

At first glance, this sounds simple.

But the AI came back with something unexpected.


Instead of hallucinating, it diagnosed the dataset

The agent ran multiple searches internally and discovered something structurally important:

  • Every Tampa lead marked as “hot” had no website
  • Every Tampa lead with a website was tagged “warm”

That meant my query was impossible against the current scoring model.

And the AI figured out why.

It reverse-engineered the business logic behind the lead-scoring system:

Businesses without websites are the highest-value opportunities for a web development agency.

So the scoring engine heavily weights:

“absence of website” = “hot lead”

The AI then explained the contradiction back to me instead of fabricating results.

That’s the moment where this stopped feeling like autocomplete.


It proposed multiple reasonable next steps

Instead of failing silently, the system suggested three valid paths forward.

Option 1

Pick a warm lead with a real website and perform a true audit.

Examples:

  • Jerk Hut Jamaican Express
  • The Dan
  • 511 Franklin

Option 2

Pick a hot lead with no website and skip the audit.

Option 3

Adjust the scoring filters entirely.

That’s not prompt completion.

That’s operational reasoning.


Screenshot: AI Diagnosing the Lead Pipeline

AI Diagnosing the Lead Pipeline


Screenshot: AI Explaining the Structural Scoring Conflict

AI Explaining the Structural Scoring Conflict


Why This Matters

The interesting part isn’t:

“AI writes outreach.”

The interesting part is:

AI systems are becoming capable of understanding operational context.

That changes how internal tools should be designed.

Instead of building isolated AI features, we’re moving toward:

  • AI-connected workflows
  • Tool-aware reasoning systems
  • Approval-first automation
  • Context-aware operational assistants

The best AI systems won’t replace human decision making.

They’ll compress the time between:

  • research
  • analysis
  • recommendation
  • execution

while still keeping humans in control.


The Stack

The current stack powering this prototype includes:

  • NestJS
  • PostgreSQL
  • MCP (Model Context Protocol)
  • Claude
  • Internal lead-scoring services
  • Website auditing workflows
  • Approval-state persistence
  • Reminder and follow-up orchestration

The architecture was intentionally designed to stay modular so additional agents and workflows can plug into the same MCP ecosystem later.


Where This Goes Next

The next iteration will likely include:

  • AI-generated sales briefings
  • CRM enrichment
  • Website-performance scoring
  • Competitor analysis
  • Local SEO audits
  • AI-generated proposal drafts
  • Lead intent classification
  • Multi-channel outreach recommendations

But the core philosophy stays the same:

AI should assist humans, not impersonate them.

That’s the line we’re trying to hold while still pushing automation forward.


Want to build AI-powered internal tooling for your business?

We’re actively exploring custom AI workflow systems for:

  • sales teams
  • service businesses
  • operations
  • support workflows
  • internal knowledge systems

Visit KeyesCode to learn more.

Tags
ai
automation
mcp
claude
sales-engineering
ai-agents
nestjs
lead-generation
build-in-public
Free 15-min audit

Want this kind of result for your business?

We'll audit your site for conversion gaps and suggest 2–3 AI integrations you could ship in 30 days. No pitch, no pressure.

Book a call