Hook: The Intern Who Never Sleeps (And Never Asks for a Raise)
Meet Sarah. She’s a 23-year-old sales rep at a SaaS company. Every morning, she spends 90 minutes copying data from a spreadsheet, writing “personalized” emails to 50 prospects, and hoping someone replies. Her reply rate? 2%. She’s exhausted. She feels like a human copy-paste machine.
One Tuesday, she learns about AI agents. By Friday, she has an agent named Orion. Orion pulls her prospect list, drafts perfectly tailored emails for each person, and sends them at 8:03 AM. Sarah’s reply rate jumps to 14%. She now spends her time on actual calls and closing deals. Orion never asks for a coffee break. It doesn’t complain about the Monday grind. It just… works.
This isn’t science fiction. It’s Tuesday. Let’s build your Orion.
Why This Matters: The 90-Minute Miracle
Sales outreach is the definition of repetitive work. It’s high-stakes, time-consuming, and prone to human error. Automating this isn’t about replacing the human touch—it’s about amplifying it.
- Time Saved: What takes Sarah 90 minutes takes Orion 5.
- Scale: 50 emails a day becomes 500. Same effort, 10x reach.
- Sanity: No more burnout from tedious admin work.
- Who This Replaces: The junior sales intern, the spreadsheet jockey, the intern who doesn’t remember the CRM’s email rules.
For a business, this means faster pipeline growth and a happier, more productive sales team.
What This Tool / Workflow Actually Is
Think of your AI agent as a tiny, super-smart intern who lives in your browser. It does three things:
- Reads: It pulls contact info and company details from your spreadsheet or CRM.
- Thinks: It uses an AI model (like GPT-4) to write a unique email for each contact, referencing their company and role.
- Acts: It logs into your email account (via a secure, approved method) and sends the message.
What it is NOT:
– It’s NOT magic. You still need a list of prospects.
– It’s NOT a spam machine. You must follow email laws and best practices.
– It’s NOT a full sales closer. It starts the conversation. You close it.
Prerequisites: Your Toolbox
Brutally honest: you need three things. No more.
- An AI API Key: From OpenAI (or Anthropic). Sign up, add a credit card. It’s cheap. This is the “brain.”
- A Spreadsheet of Prospects: At minimum: First Name, Last Name, Company, Role, One notable fact about their company (from their website or LinkedIn).
- A Dedicated Email Account: Don’t use your personal account. Create a new Gmail/Outlook address for outreach. You’ll need its IMAP/SMTP details (Google has guides for this).
Nervous? Don’t be. We’re building with LEGO bricks here, not rewriting the kernel of a satellite.
Step-by-Step Tutorial: Build Your First Agent
We’ll use a simple script that runs on your computer. It requires Python, which comes pre-installed on most Macs and Linux. On Windows, search for “Install Python” and follow Microsoft’s guide.
Step 1: Install Python & Libraries
Open your terminal (Command Prompt on Windows) and run:
pip install openai pandas
Step 2: Create Your Prospect List
Make a CSV file named prospects.csv with these columns:
first_name,last_name,company,role,note
Jane,Doe,Acme Inc,Marketing Director,"They just launched a new product line"
John,Smith,Globex Corp,Sales VP,"They are expanding into Europe"
Step 3: Write the AI Outreach Script
Create a new file called agent.py and paste the code below. It’s your Orion’s brain.
import openai
import pandas as pd
# --- CONFIGURATION ---
OPENAI_API_KEY = "your_openai_api_key_here" # Replace with your actual key
openai.api_key = OPENAI_API_KEY
# --- LOAD PROSPECTS ---
prospects_df = pd.read_csv("prospects.csv")
def generate_email(row):
"""Generates a personalized email for a single prospect."""
first_name = row['first_name']
company = row['company']
role = row['role']
note = row['note']
prompt = f"You are a sales agent. Write a concise, friendly email to {first_name} ({role} at {company})."
prompt += f" Reference this fact about their company: '{note}'."
prompt += " Keep it under 150 words. No fluff. Focus on their needs."
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": prompt}],
max_tokens=300,
)
return response.choices[0].message.content
# --- PROCESS ALL PROSPECTS ---
for index, row in prospects_df.iterrows():
print(f"Generating email for {row['first_name']} {row['last_name']}...")
email_content = generate_email(row)
print("---")
print(email_content)
print("---")
# --- (OPTIONAL) SEND EMAIL ---
# Uncomment and configure the section below to actually SEND emails.
# This requires additional setup (like an SMTP library). We'll cover this in the next lesson.
# import smtplib
# from email.mime.text import MIMEText
#
# sender_email = "your.sender@gmail.com"
# sender_password = "your_app_password" # NOT your normal Gmail password. Generate an app-specific one.
#
# msg = MIMEText(email_content)
# msg['Subject'] = f"Question about {row['company']}"
# msg['From'] = sender_email
# msg['To'] = f"{row['first_name'].lower()}.{row['last_name'].lower()}@{row['company'].lower()}.com" # Replace with real email
#
# with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
# server.login(sender_email, sender_password)
# # server.sendmail(sender_email, [real_email_address], msg.as_string())
# print("Email sent!")
print(f"\
✅ Done with {row['first_name']}!\
")
Step 4: Run Your Agent
Save your files and run from terminal:
python agent.py
You’ll see the AI draft an email for each prospect. The final code block is commented out. We’ll unlock email sending in a later, more advanced lesson where we’ll talk about security and avoiding spam filters.
Complete Automation Example: The Cold Outreach Funnel
Here’s how a small B2B agency uses this exact workflow:
- Lead Scrape: They use a web scraper (like Apify) to pull 100 HR director names from LinkedIn profiles.
- Agent Drafts: Their Orion agent writes a unique email for each, mentioning their recent company hire (from the scraped data).
- Human Review: The founder spends 10 minutes editing 5 key emails, approving the rest.
- Schedule Send: They use a scheduling tool (like Mailchimp) to send emails in batches, mimicking human timing.
- Track Replies: All replies funnel into a shared Gmail label, which the sales team handles.
Result: 3x more meetings booked per week with 20% less time spent on outreach.
Real Business Use Cases
- Consulting Firm: Reaches out to past clients with a “maintenance check” offer. Agent uses notes from last project.
- E-commerce Startup: Sends personalized discount codes to high-value cart abandoners, referencing their viewed products.
- Recruiter: Automates outreach to passive candidates, using their specific skill set from their profile.
- Real Estate Agent: Sends targeted property alerts to potential buyers based on their neighborhood interest.
- SaaS Founder: Reaches out to founders of similar-sized companies for partnership or integration talks.
Common Mistakes & Gotchas
- Blowing Up Your Email Domain: Sending 500 emails a day from a new domain will get you blacklisted. Start with 20-30/day. Warm up the inbox by having the agent send emails to your own accounts first.
- “Personalization” That Isn’t: “Hi [First Name], I saw you work at [Company].” That’s not personalization. That’s a mail-merge. The agent needs real context (the “note” field).
- Ignoring Compliance: You MUST comply with CAN-SPAM/GDPR. Include a clear unsubscribe link. Never harvest emails illegally.
- Over-Automation: The moment you stop monitoring replies and let the AI handle responses, you lose the human edge. This tool drafts emails; YOU manage the relationship.
How This Fits Into a Bigger Automation System
Your outreach agent is the first soldier in a larger army. Here’s how it connects:
- CRM (e.g., HubSpot, Airtable): Your prospect list lives here. The agent pulls data from a CRM row, and after sending, it logs the email sent as a new note or activity.
- Multi-Agent Workflow: Next week, we’ll add a second agent: a “Follow-up Agent” that automatically checks for replies and drafts polite follow-ups 3 days later if there’s no response.
- RAG (Retrieval-Augmented Generation): In a future lesson, you’ll connect this agent to your company’s knowledge base. It will automatically include your latest case studies or pricing sheet in the email.
- Voice Agents: Imagine your agent drafts the email, and a separate AI voice agent leaves a personalized voicemail for your prospect. The two touchpoints work in tandem.
What to Learn Next: From Drafts to Deliveries
You’ve built the brain. Now, let’s teach it to talk. In the next lesson, we’ll unlock the sending module. We’ll cover:
- Secure email setup (IMAP/SMTP) without getting hacked.
- Sending limits and how to avoid spam folders.
- Automating the entire pipeline: from prospect scraping to sending to tracking replies.
Homework: Run the script. Draft 10 emails for your own prospects. See how it feels to have an intern do the heavy lifting. Tweak the prompt in the code to match your voice. This is the start of your automation journey. Your next appointment is with your own AI agent.
Stay curious. Stay building. Professor Ajay.
“,
“seo_tags”: “AI Agent, Sales Automation, Python Script, OpenAI, Business Automation, Outreach Automation”,
“suggested_category”: “AI Automation Courses







