Skip to content

Sama-ndari/autonomous-sdr-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

📨 Autonomous SDR Agent

Python OpenAI SendGrid

🧠 Project Description

This repository contains a production-style Autonomous Sales Development Representative (SDR) powered by agentic AI.

The system acts as a fully autonomous sales engine that can generate and send cold outbound emails, interpret incoming replies, maintain conversation memory, and make high-level decisions (like escalating hot leads or rebutting objections)—all orchestrated from a single Jupyter Notebook. It moves beyond simple chatbots by implementing a State Machine architecture, allowing it to manage the full lifecycle of a sales conversation.

🏗️ Architecture: The Decision Engine

The system is orchestrated by a central SDR Manager Agent that controls the conversation flow. It delegates tasks to specialized sub-agents and uses tools to interact with the outside world.

graph TD
    Start((Start)) --> Init[Initialize Memory]
    Init --> Writer[✍️ Outbound Writer Agent]
    Writer --> Email{Send Email Tool}
    Email --> Wait[Wait for Reply]
    
    Wait --> Classifier[🧠 Reply Classifier Agent]
    Classifier --> Decision{Decision Engine}
    
    Decision -- "Interested" --> Escalate[🔥 Escalation Agent]
    Escalate --> Handoff(Human Handoff Summary)
    
    Decision -- "Objection" --> Objection[🛡️ Follow-up Writer]
    Objection --> ReplyEmail(Send Rebuttal Email)
    
    Decision -- "Not Interested" --> Close[❌ Close Workflow]
    
    Handoff --> End((End))
    ReplyEmail --> End
    Close --> End

Loading

🎯 Problem Statement

Sales development is a critical but often repetitive process. Human SDRs spend countless hours writing initial emails, tracking replies, and deciding when to follow up. This manual effort limits scalability and introduces inconsistencies.

The AI Solution: An autonomous SDR agent automates the entire top-of-funnel process. It handles the "grunt work" of outreach and qualification, allowing human sales teams to focus strictly on high-value closing conversations.

🤖 Agent Responsibilities

Agent Role
SDR Manager The central brain. It determines the current state and decides the next action (e.g., follow up, escalate, stop).
Outbound Writer Crafts highly personalized cold outreach emails based on prospect data.
Reply Classifier Reads inbound replies and categorizes them into actionable buckets (Interested, Objection, OOO).
Follow-up Writer Generates contextual rebuttals or nudges based on conversation history.
Escalation Agent Summarizes the entire thread into a concise briefing for a human Account Executive.

🛠️ Prerequisites & Setup

1. SendGrid Configuration (Required)

This agent uses SendGrid to send real emails.

  1. Visit SendGrid and create a free account.
  2. Navigate to Settings (left sidebar) → API Keys → Create API Key.
  3. Set permissions to "Full Access" (or at least "Mail Send").
  4. Copy the key immediately (you won't see it again).
  5. Verify a Sender: Go to Settings → Sender Authentication → Verify a Single Sender to verify the email address you will be sending from.

2. Environment Variables

Create a .env file in the root directory and add your keys:

OPENAI_API_KEY=sk-...
SENDGRID_API_KEY=SG...
SENDER_EMAIL=your_verified_email@example.com

3. Installation

Clone the repository and install dependencies:

git clone [https://github.com/Sama-ndari/autonomous-sdr-agent.git](https://github.com/Sama-ndari/autonomous-sdr-agent.git)
cd autonomous-sdr-agent
pip install -r requirements.txt

🚀 How to Run

  1. Launch Jupyter Notebook:
jupyter notebook
  1. Open sdr_agent.ipynb.
  2. Run the cells sequentially.
  3. The final cell executes a Simulation Run, where the agent sends an email to a dummy prospect and processes a simulated reply (e.g., "Tell me more about pricing").

🧠 Memory Model

State is maintained in-memory using a Python dictionary structure. Each prospect record tracks:

  • emails_sent & replies_received: Full interaction logs.
  • classification: The sentiment of the last customer message.
  • status: Current lifecycle stage (e.g., contacted, replied, escalated).
  • last_action: A log of the agent's decision-making process.

⚠️ Limitations & Future Work

  • Persistence: Currently uses in-memory dictionaries. Restarting the kernel clears data. Future versions will integrate a database (SQLite/PostgreSQL).
  • Reply Ingestion: The current demo simulates receiving a reply. Production deployment requires a webhook listener (e.g., Flask/FastAPI) to parse incoming SendGrid webhooks.
  • Rate Limiting: No safeguards against API rate limits for bulk sending.

For questions or contributions, contact Samandari.

About

An Autonomous SDR Agent powered by agentic AI that generates outbound emails, maintains conversation memory, interprets replies, and autonomously decides whether to follow up or escalate--fully orchestrated via SendGrid and OpenAI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors