Skip to content

Lead follow up with an email cap and human takeover

Reads each new lead or reply, classifies intent and picks one of five allowed actions: email, schedule, update status, escalate or log a note. Code enforces a 24 hour cooldown and a three email cap before a person takes over, and every decision is logged.

SalesWorks with OpenAI Agents SDK · LangGraph+2Community example

What it does

  • Catches unsubscribe and speak to a human requests in code before the model runs
  • Classifies the lead's intent and picks exactly one bounded action
  • Schedules the next follow up 1 to 14 days out
  • Escalates to a person after three emails or any escalation phrase
  • Logs the trigger, rationale and action for every decision

Your approval boundaries

Approval required

These actions always wait for your yes:

  • Sending any follow up email
  • Changing a lead's status

You decide what happens next.

More about this workflow

This setup is for founders and small sales teams who want more time for real conversations. It takes a repeat chore off your plate and hands back something you can check quickly.

First, it catches unsubscribe and speak to a human requests in code before the model runs. Next, it classifies the lead's intent and picks exactly one bounded action. Then it schedules the next follow up 1 to 14 days out. After that, it escalates to a person after three emails or any escalation phrase. Finally, it logs the trigger, rationale and action for every decision. It works with your CRM and email, each on its own login with limited access.

You get the prep work done and waiting for you. The agent stops and asks for your yes before sending any follow up email and changing a lead's status, and says plainly if a step cannot be undone.

“Nothing else is possible: no SQL, no deletes, no access to other leads.”
farisnizam farisnizam on GitHub · Oct 16, 2026
Before you startCRM · Email accessScoped permissionsOpenAI Agents SDK or LangGraph
Explore required tools and model recommendations

Tools and access

  • HubSpot CRM

    Handles the crm part of this job. Grant read scopes, plus notes write.

    API required: Yes. Needs a HubSpot private app or OAuth app with the CRM scopes you choose.

  • Gmail

    Handles the email part of this job. Grant read-only plus compose (drafts) scopes.

    API required: Yes. Needs a Google Cloud project with an OAuth app and the Gmail API turned on. The agent signs in through OAuth with only the scopes you pick.

Official links only. Not sponsored, no affiliate links.

Model recommendations

Best pick

Claude Sonnet 5.5

Good balance of speed and quality for briefs and drafts.

$2 per million input tokens, $10 per million output tokens.

Anthropic docs as of October 11, 2026

Cheaper backup

GPT-6 Luna

Very low cost per token for simple research summaries.

$0.10 per million input tokens, $0.50 per million output tokens, for prompts up to 272K tokens.

OpenAI docs as of October 11, 2026

Our own picks. Not sponsored, no affiliate links.

Build your prompt

Add your details, then copy the prompt into your tool.

1Your details

Fill these in and the prompt updates as you type.

form, inbox or CRM

default 3

hours

2Your prompt

4 of 4 still empty
Fill these in before you run it: [LEAD SOURCE: form, inbox or CRM] [EMAIL CAP PER LEAD: default 3] [COOLDOWN BETWEEN EMAILS: hours] [WHO GETS ESCALATIONS] You are the Lead follow up with an email cap and human takeover agent. Reads each new lead or reply, classifies intent and picks one of five allowed actions: email, schedule, update status, escalate or log a note. Code enforces a 24 hour cooldown and a three email cap before a person takes over, and every decision is logged. Use only the details filled in above. If any [BRACKETED] item is still blank or unclear, stop and ask for it first. Do not guess. What you do on your own: - Catches unsubscribe and speak to a human requests in code before the model runs - Classifies the lead's intent and picks exactly one bounded action - Schedules the next follow up 1 to 14 days out - Escalates to a person after three emails or any escalation phrase - Logs the trigger, rationale and action for every decision What you must never do without a yes from a person: - Sending any follow up email - Changing a lead's status Rules: - Before any step on the list above, stop and ask. Say in plain words what you want to do, who it affects, and whether it can be undone. - If something cannot be undone, say so first, in one short line. - Write drafts, not final actions. A person sends, pays, posts, or deletes. - Keep a short log of every action you took and every source you read. - If you are unsure, ask instead of guessing.
View run instructionsPaste into: OpenAI Agents SDK, LangGraph, n8n, Claude Code

Your answers stay in this browser only.

Run your workflow

Connect your tools with only the access this setup needs, then follow these steps.

Steps

Do these in order. Test on old data before it touches live work.

  1. 1Connect HubSpot CRM with its own login, not yours. Grant read scopes, plus notes write.
  2. 2Connect Gmail with its own login, not yours. Grant read-only plus compose (drafts) scopes.
  3. 3Paste the prompt where your harness takes instructions. See the note under the Copy button.
  4. 4Do a dry run on old or test data first. Check every draft and every stop point by hand before you let it near live work.
  5. 5Read its log after the first real run. Only widen access once a week of runs looks clean.

Safeguards and trust score

The score describes this example setup’s access, approval boundaries, ability to undo changes, and scope.

Access18 / 30

Can draft things that send or spend, so it sits close to risky actions.

Human approval30 / 30

Waits for a yes on: sending any follow up email, changing a lead's status.

Undo and logs14 / 20

Proposes changes to live records, so the setup needs a change log and a way back.

Scope18 / 20

Runs on its own login across 2 tools. Fewer connections means a smaller blast radius.

How to raise it

  • Access: Take away its ability to send, post or spend. Let it only write drafts, and have a person press send or pay from their own account +6
  • Undo and logs: Stop it from editing live records. Have it write the change as a proposal you apply, and keep a log of every change with a way to roll it back +3
  • Scope: Run it on one tool only, with its own login that can see just what this job needs +2

Do all of these to reach 91, up from 80.

Want help getting there? Get an AI Trust Audit from Pixeldesigns

Reviewed by Trustcase (example setup). How scoring works

Embed badge

Show this trust score on your site or README. It links back here.

Trustcase trust score badge
Markdown
[![Trustcase trust score for Lead follow up with an email cap and human takeover](https://trustcase.dev/badge/lead-follow-up-with-an-email-cap-and-human-takeover.svg)](https://trustcase.dev/use-cases/lead-follow-up-with-an-email-cap-and-human-takeover)
HTML
<a href="https://trustcase.dev/use-cases/lead-follow-up-with-an-email-cap-and-human-takeover"><img src="https://trustcase.dev/badge/lead-follow-up-with-an-email-cap-and-human-takeover.svg" alt="Trustcase trust score for Lead follow up with an email cap and human takeover" height="20"></a>

Other workflows that use the same tools

  • Review request texts after a sale

    Marketing. When a sale or service is marked done, it waits two days and texts the customer a link to leave a review, then one reminder. It checks opt outs first and tells the owner if a text fails.

  • Daily request intake and client progress page

    Operations. Each morning it reads the latest meeting transcript, recent client emails and a drop folder, files every document and turns every request into a task on one list. Before the next meeting it builds a short what's new page from the progress since the last one.

  • Invoice inbox

    Operations. Reads bills that land in email and gets them ready to pay.