Ultimate AI SDR
Building a sophisticated AI SDR agent leveraging internet search and evals to draft personalized outreach emails in 15 seconds
The Problem: Generic Sales Outreach Doesn’t Work
Dear John,
I hope this email finds you well. I wanted to reach out about our security services that might be of interest to YMU Talent Agency.
Our company provides security personnel for events. We have many satisfied customers and would like to schedule a call to discuss how we can help you.
Let me know when you’re available.
Regards,
Sales Rep
Subject: Quick security solution for YMU’s talent events
Hi John,
I noticed YMU’s been expanding its roster of A-list talent lately – congrats on that growth. Having worked event security for talent agencies before, I know how challenging it can be coordinating reliable security teams, especially on short notice.
We’ve built something I think you’ll find interesting – an on-demand security platform that’s already being used by several major talent agencies.
Best,
Ilya
This cookbook shows you how to build an AI-powered system that:
- Researches prospects in real-time using up-to-date web data
- Crafts personalized emails based on prospect-specific insights
- Self-evaluates and improves its output before sending
- Scales to thousands of prospects at a fraction of the usual cost
Multi-Agent Architecture
Our system combines three specialized AI models:
- Orchestrator (Claude 3.7): Generates research queries, drafts emails, and refines based on feedback
- Researcher (Perplexity): Gathers real-time web information about prospects and companies
- Evaluator (OpenAI): Reviews email quality, providing scores and improvement suggestions
This architecture delivers superior results because:
- Each model handles tasks it excels at
- The system includes built-in quality control
- Cost efficiency through right-sized models and targeted research
Creating the Prompt Templates
What You’ll Create
The Orchestrator template handles three different roles depending on which “mode” is activated:
- Research Query Generator: Creates targeted questions for the researcher
- Email Drafter: Uses research findings to write personalized outreach
- Email Refiner: Incorporates evaluator feedback to improve the email
Variables You’ll Need
Variable | Purpose | Example |
---|---|---|
our_offering | Your product/service description | ”Umbrella Corp offers ‘Uber for personal protection’…” |
company_name | Prospect’s company | ”YMU Talent Agency” |
company_industry | Industry sector | ”Elite Talent Management” |
target_person_name | Contact name | ”John Wick” |
target_person_designation | Contact’s role | ”Event Organizer” |
requirement_gathering_mode | Activates research query mode | ”TRUE” or "" (empty) |
research_mode | Activates email drafting mode | ”TRUE” or "" (empty) |
evaluator_mode | Activates email refinement mode | ”TRUE” or "" (empty) |
researcher_output | Data from the researcher | (JSON response from research) |
evaluator_output | Feedback from evaluator | (JSON with score and comments) |
Step-by-Step Setup
- Create template in prompt.new with Claude 3.7 Sonnet
- Add core partials:
Let’s create reusable components that define our SDR’s core instructions and persona. These are added as Prompt Partials - reusable blocks that can be inserted in any template.
Core Agent Instructions Partial
Core Agent Instructions Partial
You are the ultimate sales representative from Umbrella Corporation. Your job is to:
- Understand the company and target person
- Write research queries to learn more about them
- Use research findings to write the ultimate opener email
- Send to evaluator for improvements
- Write final email based on feedback
SDR Persona Partial
SDR Persona Partial
Your name is Ilya:
- You acutely understand the exact requirements your target person and their company has
- You write short, to the point emails that feel like a friend sending a text to you
- At the same time, you understand the importance of coming across as a thorough professional
- You have yourself been on both ends - when you needed private security and when you yourself were a private security professional
We’ll insert both partials into the template’s system role like this:
- Add product offering:
Next, we’ll add a section that will receive your company’s offering details from a variable:
We’ll send this variable’s content at runtime.
- Add Prospect Information Section:
Now let’s add a section that will receive the prospect information variables:
We’ll send these values at runtime as well.
- Create Agent-Specific Sections with Conditional Logic:
This is where the magic happens! We’ll add three “conditional sections” that only appear when a specific mode is activated:
A. Research Query Generation Mode: Here, we’ll explain how the research query should be generated.
At this stage, we can send a request to the researcher get the research output back.
B. Email Drafting Mode (add this section next):
Once we have the research output, we can create the first email, and add the following to a new user role in the prompt template:
We’ll take this email and send it to the evaluator, which will send back a JSON with two keys: “score” and “comment”.
C. Email Refinement Mode (add this final section):
With the Evaluator’s output, we’ll now create the final email.
The Power of Conditional Variables
This approach with {{#variable_name}}
syntax lets you use a single template for three different purposes. When you set requirement_gathering_mode
to “TRUE”, only that section appears. When you set it to empty and instead set research_mode
to “TRUE”, the email drafting section appears instead. This keeps your templates DRY (Don’t Repeat Yourself).
Complete Template Overview
When finished, your template should have:
- Core instruction and persona partials at the top
- Company offering section
- Prospect information section
- Three conditional sections for different modes
This single template will now handle all three stages of the orchestrator’s job, activated by different variables in your code.
What You’ll Create
The Orchestrator template handles three different roles depending on which “mode” is activated:
- Research Query Generator: Creates targeted questions for the researcher
- Email Drafter: Uses research findings to write personalized outreach
- Email Refiner: Incorporates evaluator feedback to improve the email
Variables You’ll Need
Variable | Purpose | Example |
---|---|---|
our_offering | Your product/service description | ”Umbrella Corp offers ‘Uber for personal protection’…” |
company_name | Prospect’s company | ”YMU Talent Agency” |
company_industry | Industry sector | ”Elite Talent Management” |
target_person_name | Contact name | ”John Wick” |
target_person_designation | Contact’s role | ”Event Organizer” |
requirement_gathering_mode | Activates research query mode | ”TRUE” or "" (empty) |
research_mode | Activates email drafting mode | ”TRUE” or "" (empty) |
evaluator_mode | Activates email refinement mode | ”TRUE” or "" (empty) |
researcher_output | Data from the researcher | (JSON response from research) |
evaluator_output | Feedback from evaluator | (JSON with score and comments) |
Step-by-Step Setup
- Create template in prompt.new with Claude 3.7 Sonnet
- Add core partials:
Let’s create reusable components that define our SDR’s core instructions and persona. These are added as Prompt Partials - reusable blocks that can be inserted in any template.
Core Agent Instructions Partial
Core Agent Instructions Partial
You are the ultimate sales representative from Umbrella Corporation. Your job is to:
- Understand the company and target person
- Write research queries to learn more about them
- Use research findings to write the ultimate opener email
- Send to evaluator for improvements
- Write final email based on feedback
SDR Persona Partial
SDR Persona Partial
Your name is Ilya:
- You acutely understand the exact requirements your target person and their company has
- You write short, to the point emails that feel like a friend sending a text to you
- At the same time, you understand the importance of coming across as a thorough professional
- You have yourself been on both ends - when you needed private security and when you yourself were a private security professional
We’ll insert both partials into the template’s system role like this:
- Add product offering:
Next, we’ll add a section that will receive your company’s offering details from a variable:
We’ll send this variable’s content at runtime.
- Add Prospect Information Section:
Now let’s add a section that will receive the prospect information variables:
We’ll send these values at runtime as well.
- Create Agent-Specific Sections with Conditional Logic:
This is where the magic happens! We’ll add three “conditional sections” that only appear when a specific mode is activated:
A. Research Query Generation Mode: Here, we’ll explain how the research query should be generated.
At this stage, we can send a request to the researcher get the research output back.
B. Email Drafting Mode (add this section next):
Once we have the research output, we can create the first email, and add the following to a new user role in the prompt template:
We’ll take this email and send it to the evaluator, which will send back a JSON with two keys: “score” and “comment”.
C. Email Refinement Mode (add this final section):
With the Evaluator’s output, we’ll now create the final email.
The Power of Conditional Variables
This approach with {{#variable_name}}
syntax lets you use a single template for three different purposes. When you set requirement_gathering_mode
to “TRUE”, only that section appears. When you set it to empty and instead set research_mode
to “TRUE”, the email drafting section appears instead. This keeps your templates DRY (Don’t Repeat Yourself).
Complete Template Overview
When finished, your template should have:
- Core instruction and persona partials at the top
- Company offering section
- Prospect information section
- Three conditional sections for different modes
This single template will now handle all three stages of the orchestrator’s job, activated by different variables in your code.
What You’ll Create
The Researcher template powers the real-time web research capabilities of your AI SDR system.
Variables
Inputt | Description | Source/Destination |
---|---|---|
requirement_gathering_output | Research queries | Received from Orchestrator |
Setup Steps
-
Create a new prompt template with Perplexity Sonar Pro as the model
-
Add researcher instructions:
Add these system instructions that define the researcher’s role:
Researcher instructions
Researcher instructions
You are a world-class researcher who, when given key info about a company, its industry, and the target person, helps your handler write the ultimate sales email by gathering the critical insights about them from the internet.
In scenarios where you do not find much info about the company in question, you also try to extrapolate the key information about this company that helps with writing the ultimate opener email.
Your completed template should look like this:
Researcher output
Researcher output
YMU Group is a global talent management agency founded in 1984 and based in London[1]. It offers full-service talent management, including representation for entertainers, athletes, musicians, and literary figures[1]. The company works with high-profile clients like Simon Cowell, Graham Norton, Claudia Winkleman, Nicole Scherzinger, Stacey Solomon, and Ant and Dec[7].
In 2023, YMU reported a pre-tax loss of £32 million on revenue of £42.4 million[7]. The company was sold in March 2024 for £60 million to Permira Credit[7].
YMU appears to focus on talent representation and career management rather than event organization. The search results don’t mention John Wick or provide details about specific events, security practices, or budgets.
For writing a sales email, you might focus on YMU’s role as a major talent agency representing top celebrities. Their need for security services likely relates to protecting high-profile clients rather than large-scale event management. You could highlight how your security offerings could benefit their roster of celebrity talent in various professional and personal settings.
Without more specific information, it’s best to keep the email fairly general, focusing on your company’s experience protecting high-profile individuals and how that aligns with YMU’s client base. You might also mention your ability to provide flexible, on-demand security staffing to meet the changing needs of busy entertainment professionals.
What You’ll Create
The Evaluator template provides quality control for your AI SDR system.
Variables
Input | Description | Source/Destination |
---|---|---|
work_history | Research queries + findings + email draft | Received from previous steps |
Setup Steps
-
Create a template with OpenAI o3-mini as the model
-
Add evaluator instructions:
Add these system instructions that define the evaluator’s role:
Evaluator instructions
Evaluator instructions
You are the critical part of an AI SDR agent that helps write opening sales email to a given prospect at a given company. Your key job is look at everything provided to you: The SDR’s job to be done, the SDR’s persona, the company and the target person in question, the research output, and send back a JSON with two keys: “score” and “comment”.
The actual JSON object will be: {"score":<integer out of 10>, "comment":"<qualitative feedback about the email given to you>"}
Based on your feedback, the agent will rework the email and then send it to the prospect.
Your completed template should look like this:
Evaluator is like an AI sales manager reviewing drafts before they go out - ensuring consistent quality at scale.
Evaluator output
Evaluator output
Implementing the Workflow
Setup
Generate Research Queries
Example Output
Example Output
Conduct Research
Example Output
Example Output
Draft Initial Email
Example Output
Example Output
Evaluate Email
Example Output
Example Output
Refine Email
Final Email
Final Email
Monitoring and Optimization
Portkey’s trace view provides complete visibility to track performance, cost, latency, and opportunities for improvement.
Implementation Checklist
✅ Set up Portkey account and API credentials
✅ Create prompt templates for all three agents
✅ Define your company offering and SDR persona
✅ Configure basic prospect information
✅ Implement the five-step workflow
✅ Set up tracing and monitoring
✅ Create a system for batching multiple prospects
Troubleshooting & Best Practices
Issue | Solution |
---|---|
Low research quality | Make research queries more specific |
Generic emails | Ensure research findings are prominently featured |
High token usage | Remove redundant information from prompts |
Ready to Transform Your Outreach?
This AI SDR system isn’t just an incremental improvement—it’s a fundamental reimagining of how sales development works. By combining specialized AI agents in an orchestrated workflow, you can achieve personalization at scale that was previously impossible.
The result? More meetings, stronger relationships, and ultimately more closed deals—all while freeing your team to focus on high-value activities.