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.
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
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 | 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. |
This agent uses SendGrid to send real emails.
- Visit SendGrid and create a free account.
- Navigate to Settings (left sidebar) → API Keys → Create API Key.
- Set permissions to "Full Access" (or at least "Mail Send").
- Copy the key immediately (you won't see it again).
- Verify a Sender: Go to Settings → Sender Authentication → Verify a Single Sender to verify the email address you will be sending from.
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
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
- Launch Jupyter Notebook:
jupyter notebook
- Open
sdr_agent.ipynb. - Run the cells sequentially.
- 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").
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.
- 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.